http://stackoverflow.com/comment/35105612
has text: @cYrixmorten: Can you please tell me why the location is duplicating(i.e., giving the same location) from the point after GPS takes long time to listen(in the bus or in the train or in the more congested public place). I think the mistake in my code, but i was unable to predict it. Thanks.
comment on: http://stackoverflow.com/q/22987062
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23068221
upvote count: 2
answer count: 2
has body: I want to find if a utility is in one of the utilities. I have a JUnit test as following @Test public void testUtilityInUtilities() { final String utilities = "Pacific Gas &amp; Electric (PG&amp;E),San Diego Gas &amp; Electric (SDG&amp;E), Salt River Project (SRP),Southern California Edison (SCE)"; final String utility = "San Diego Gas &amp; Electric (SDG&amp;E)"; assertTrue(utilities.contains(utility)); } Is it a good enough test? or shall I do something similar to following? String[] splitString = (utilities.split(",")); for (String string : splitString) { if (string.equals(utility)) {return true;} } return false; which method is recommended? split or contains or anything else?
tagged with: string
has title: recommended way to find a word in a comma-separated string?
favorite count: 0
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23068372
type: Question
has answer: http://stackoverflow.com/a/23068388

http://stackoverflow.com/comment/35144602
type: Comment
comment on: http://stackoverflow.com/a/23006851
type: AnswerComment
has text: @MadProgrammer Thanks I'll make note of that
score: 0

http://stackoverflow.com/a/23096157
type: Answer
answers question: http://stackoverflow.com/q/23096031
downvote count: 0
score: 1
has body: The answer is simple: you define b as object of type BankAccount, not SavingsAccount. If method addInterest() is only defined in SavingsAccount then it is not possible to call it on BankAccount instance. However your SavingsAccount extends (or implements) BankAccount so you can store reference to SavingsAccount in b which is of type BankAccount because SavingsAccount is also a BankAccount.
upvote count: 1

http://stackoverflow.com/a/35492189
type: Answer
upvote count: 4
has body: To answer the initial question of I have an AWS EC2 instance deployed, and I need to find out its public IP. You can do in Java using the AWS API: EC2MetadataUtils.getData("/latest/meta-data/public-ipv4"); This will directly give you the public IP if one exists
downvote count: 0
answers question: http://stackoverflow.com/q/23081848
score: 4

http://stackoverflow.com/a/23061394
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/35239783
downvote count: 0
has body: You can define a generic type (let's say in the scope of the enclosing method) and use it as a type for the generic Class and the generic Vector (or even better, a generic Collection). public &lt;T&gt; void method(Class&lt;T&gt; clazz, Collection&lt;T&gt; collection) { Map&lt;Class&lt;T&gt;,Collection&lt;T&gt;&gt; map = new HashMap&lt;Class&lt;T&gt;, Collection&lt;T&gt;&gt;(); map.put(clazz, collection); //this will compile } You can invoke it with: method(String.class, new ArrayList&lt;String&gt;()); //or method(String.class, new Vector&lt;String&gt;()); and you can note that this statement doesn't compile: method(Integer.class, new Vector&lt;String&gt;());
type: Answer
answers question: http://stackoverflow.com/q/23061313
has comment: http://stackoverflow.com/comment/35239743

http://stackoverflow.com/q/23022869
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35185254
tagged with: java
has answer: http://stackoverflow.com/a/23022980
linked to: http://stackoverflow.com/q/11930
type: Question
answer count: 2
tagged with: network-programming
has body: the way how we get Ip address using java code is clear and many questions about this subject were answered. but assuming that you have Vmware or VirtualBox on your machine,so you will have extra virtual network cards each one have its own Ip Address. when executing a little program the result was like 192.168.x.x which belongs to one of my virtual network adapters. but using "What Is My IP" the result was like 197.x.x.x so how can i get the ip adress of the connected interface ?
has comment: http://stackoverflow.com/comment/35174196
has answer: http://stackoverflow.com/a/23023210
accepted answer: http://stackoverflow.com/a/23023210
score: 0
has title: how to get the ip address of the connected interface
possible better answer: http://stackoverflow.com/a/23022980
tagged with: ipv4
has comment: http://stackoverflow.com/comment/35170769

http://stackoverflow.com/a/23102254
upvote count: 2
has comment: http://stackoverflow.com/comment/35312850
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35312828
has body: Compiler is forcing you to return the value because it may be possible that you never satisfy the condition for the while loop, hence you don't enter the while loop and return the value. In that case you won't be having return statement for the method which is supposed to return an int. In your case if length of int[] a is 0, you wont be returning anything as you don't satisfy condition for while loop. In such scenario, you need to validate the input and if input does not pass validation check, you can return an exception. Here, IllegalArgumentException seems suitable to me, but it totally depends on you that which exception you want to throw. throw new IllegalArgumentException("Error message");
accepted answer of: http://stackoverflow.com/q/23101700
type: Answer
answers question: http://stackoverflow.com/q/23101700
score: 2

http://stackoverflow.com/q/23010842
has comment: http://stackoverflow.com/comment/35147638
upvote count: 8
has answer: http://stackoverflow.com/a/23010989
answer count: 5
has comment: http://stackoverflow.com/comment/35148973
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35148878
has answer: http://stackoverflow.com/a/23011477
has comment: http://stackoverflow.com/comment/35147773
has comment: http://stackoverflow.com/comment/35148213
has answer: http://stackoverflow.com/a/23011800
downvote count: 1
tagged with: computer-science
type: Question
has comment: http://stackoverflow.com/comment/35147820
tagged with: java
has answer: http://stackoverflow.com/a/23011336
tagged with: http://stackoverflow.com/tag/c
has title: "Less than or Equal to" versus "Less than" for processing
has answer: http://stackoverflow.com/a/23011152
has body: Consider the following conditions: if(a &lt; 10) and if(a &lt;= 9) Considering only int. I know these conditions serve the same purpose and the processing difference would be negligible. Yet, what can be the processing difference between the two?
score: 7
has comment: http://stackoverflow.com/comment/35147424
favorite count: 0

http://stackoverflow.com/q/23052019
downvote count: 2
linked to: http://stackoverflow.com/q/13105048
tagged with: spring
tagged with: spring-mvc
has body: I started study Spring MVC and tomcat just. I want to display html page by Spring and ThymeLeaf VewTemplate Engine. But It doesn't work. below my configure File and Controller. web.xml File DispatcherServlet org.springframework.web.servlet.DispatcherServlet 1 DispatcherServlet /* EncodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 EncodingFilter /* /webapp/WEB-INF/DispatcherServlet-serlvet.xml <context:component-scan base-package="com.everblog.controller" /> <property name="prefix" value="/WEB-INF/view/" /> <property name="suffix" value=".html" /> <property name="templateMode" value="HTML5" /> <property name="characterEncoding" value="UTF-8" /> <property name="templateResolver" ref="templateResolver" /> <property name="templateEngine" ref="templateEngine" /> <property name="order" value="1" /> <property name="viewNames" value="*.html" /> And Controller @Controller public class PostItemController { @RequestMapping(value="/hello", method = RequestMethod.GET) public String helloWorld() { System.out.println("IS IN"); return "index"; } } I typed localhost:9000/hello on browser, then browser display this error messages. HTTP Status 500 - Could not resolve view with name 'index' in servlet with name 'DispatcherServlet' type Exception report message Could not resolve view with name 'index' in servlet with name 'DispatcherServlet' description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: Could not resolve view with name 'index' in servlet with name 'DispatcherServlet' org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1190) org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) org.springframework.web.servlet.Fra…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23052594
possible better answer: http://stackoverflow.com/a/31730130
tagged with: java
has answer: http://stackoverflow.com/a/31730130
upvote count: 10
tagged with: servlets
has comment: http://stackoverflow.com/comment/35222904
type: Question
answer count: 2
tagged with: tomcat
has comment: http://stackoverflow.com/comment/35222762
has answer: http://stackoverflow.com/a/23052594
has title: I can't find answer that Could not resolve view with name 'index' in servlet with name 'DispatcherServlet'
score: 8
favorite count: 0

http://stackoverflow.com/comment/35152556
has text: Looking at your posted code, only the first `ImagePanel` has a .png file extension passed to it. That _may_ be the problem.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23007814
type: Comment

http://stackoverflow.com/comment/35219225
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23049991
has text: It's not clear to me what you are trying to say. So where should I change?
score: 0

http://stackoverflow.com/a/23050107
downvote count: 0
score: 1
has body: You're trying to refer a reference to string, which probably doesn't exist in R.java, instead of the reference to an id, which you declared in xml layout android:id="@+id/edit_message". It causes a NullPointerException. Use: EditText editText = (EditText) findViewById(R.id.edit_message); instead of: EditText editText = (EditText) findViewById(R.string.edit_message);
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23050026
accepted answer of: http://stackoverflow.com/q/23050026
type: Answer

http://stackoverflow.com/comment/35351889
has text: Path: C:\Program Files\Java\jdk1.7.0_25\bin
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23123813

http://stackoverflow.com/a/22980021
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35092585
has comment: http://stackoverflow.com/comment/35092620
has comment: http://stackoverflow.com/comment/35092552
answers question: http://stackoverflow.com/q/22979939
has comment: http://stackoverflow.com/comment/35092739
has body: That is because you cannot use the AND &amp;&amp; and OR || operators with integers, so you may want to re-define the condition: if (left &amp;&amp; up &amp;&amp; dots[x - 1][y - 1]) ------------------ this is an integer I can't give you a "real " fix, because it depends on what you are trying to do. You can try this, but may not work as you expect: if (left &amp;&amp; up)

http://stackoverflow.com/a/23047186
has comment: http://stackoverflow.com/comment/35282139
score: 0
has comment: http://stackoverflow.com/comment/35281304
has comment: http://stackoverflow.com/comment/35281834
type: Answer
has comment: http://stackoverflow.com/comment/35269088
has comment: http://stackoverflow.com/comment/35281703
has body: Probably, my DummyJMX class has not been published (or I just cannot find it). When you are using the registryPort configuration for JmxServer then it will not show up in the "Local Process" list under Jconsole. It will be able to be accessed as a "Remote Process" with localhost:8123. If you are on a Linux box, you might use netstat -an | grep LISTEN to see what ports your application is listening on. If you don't see 8123 in the list then maybe it already has a RMI server configured? If you want to use the platform mbean-server which does show up as a local process then use the new setter or constructor in version 1.9 which was released recently (4/2014). Unfortunately, SimpleJMX cannot programmatically register itself so it shows up in the process list -- that's not code that the JVM exports. &lt;bean id="jmxServer" class="com.j256.simplejmx.server.JmxServer" init-method="start" destroy-method="stop"&gt; &lt;property name="usePlatformMBeanServer" value="true" /&gt; &lt;/bean&gt;
answers question: http://stackoverflow.com/q/23014067
has comment: http://stackoverflow.com/comment/35225808
has comment: http://stackoverflow.com/comment/35269686
has comment: http://stackoverflow.com/comment/35226371
has comment: http://stackoverflow.com/comment/35241368

http://stackoverflow.com/comment/35297336
comment on: http://stackoverflow.com/q/23092985
score: 0
type: QuestionComment
type: Comment
has text: Am i not doing that? Name of the player? Or am I thinking too much? name.add();

http://stackoverflow.com/comment/37561786
type: Comment
type: QuestionComment
has text: @MandarPandit: The dialog that you recommended will not allow me to set the COLORS of those tags at all. Just the tag name and priority.
score: 0
comment on: http://stackoverflow.com/q/23048171

http://stackoverflow.com/comment/35138078
score: 0
type: QuestionComment
type: Comment
has text: yeah sorry, just a typo, because i want to remove my email and password
comment on: http://stackoverflow.com/q/23005468

http://stackoverflow.com/comment/35222028
has text: can u gv me an example???im quite new to android...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23051569

wcf
tags question: http://stackoverflow.com/q/23076478
type: Tag
tag name: wcf
tags question: http://stackoverflow.com/q/22972656
tags question: http://stackoverflow.com/q/23059814

http://stackoverflow.com/q/23090263
has body: I am beginner of java. i am trying a write and show file. But my txt file show another symbol. I can not understand what my Error. I am using this code. import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Main { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { // TODO Auto-generated method stub try { FileOutputStream output=new FileOutputStream("C:\\Users\\BAPPY\\Desktop\\temp.txt"); for (int i = 0; i &lt;=10; i++) { output.write(i); } output.close(); FileInputStream input=new FileInputStream("C:\\Users\\BAPPY\\Desktop\\temp.txt"); int value; while ((value=input.read())!=-1) { System.out.println(value+" "); } input.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } my txt file did not show result why please tell me??
has title: File input and output in java
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/35291899
has comment: http://stackoverflow.com/comment/35295468
type: Question
has answer: http://stackoverflow.com/a/23090560
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35292506
score: -3

http://stackoverflow.com/q/22984438
has title: java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver Exception occurring. Why?
tagged with: jdbc
has answer: http://stackoverflow.com/a/22996068
linked to: http://stackoverflow.com/q/42275749
has comment: http://stackoverflow.com/comment/35100431
has comment: http://stackoverflow.com/comment/35118848
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25340576
has answer: http://stackoverflow.com/a/59733881
has body: I have created an MS Access database and assigned a DSN to it. I want to access it through my Java application. This is what I am doing: public class AccessDbConnection { public static void main(String[] args) { System.out.println("**ACCESS DB CONNECTION**"); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // for MS Access ... MS access driver loading String conURL = "jdbc:odbc:sampleDNS"; Connection con = DriverManager.getConnection(conURL); Statement statement = con.createStatement(); String qry = "SELECT * FROM Table1"; ResultSet rs = statement.executeQuery(qry); while(rs.next()) { String id = rs.getString("ID") ; String fname = rs.getString("First_Name"); String lname = rs.getString("Last_Name"); System.out.println(id + fname + lname); } } catch (ClassNotFoundException ex) { System.out.println("Classforname Exception!!"); Logger.getLogger(AccessDbConnection.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { System.out.println("DriverManager Exception!!"); Logger.getLogger(AccessDbConnection.class.getName()).log(Level.SEVERE, null, ex); } } } I am getting the exception at the first line of try block. That is class.forname("..");. Why am I having this Exception?
type: Question
upvote count: 37
tagged with: java
linked to: http://stackoverflow.com/q/19709843
has comment: http://stackoverflow.com/comment/35100178
has answer: http://stackoverflow.com/a/62494093
score: 37
has comment: http://stackoverflow.com/comment/35115700
tagged with: jdbc-odbc
downvote count: 0
tagged with: ms-access
favorite count: 0
has comment: http://stackoverflow.com/comment/35099775
has answer: http://stackoverflow.com/a/25514346
linked to: http://stackoverflow.com/q/21955256
has comment: http://stackoverflow.com/comment/35102514
answer count: 5

http://stackoverflow.com/q/22989140
answer count: 0
has comment: http://stackoverflow.com/comment/35111179
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35119361
type: Question
tagged with: dependency-injection
has body: I have a pb with a test case that i run. I set an obj throught a interface. Inbetween the interface and the class is a abstractclass where the getter for that obj is. When i call the getter for that obj. it returns null.......?i think it's something with the proxy obj but i don't know how proxy obj realy work public interface RequestHandler{ public void setRequest(ImporterRequest request);} public abstract class AbstractRequestHandler implements RequestHandler{ private ImporterRequest request; public ImporterRequest getRequest() { return request; } @Override public void setRequest(ImporterRequest request) { this.request = request; } @Component("WBRequestHandler") @Scope(value= "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS) public class WBRequestHandler extends AbstractRequestHandler implements RequestHandler{ // here only implemented methods from the AbstrcCllass for read/write csv @Override public List&lt;Object&gt; getData(ExportRequest request1) {...} @Override public CellProcessor[] createExportCellProcessor(ExportRequest request1) {...} @Override protected void parseLines(CsvPreference preferences, StringReader reader, LngDTO LngDTO, String username) throws IOException {....} @Override protected CellProcessor[] createProcessors(ImporterRequest request1) {.....} } @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/META-INF/spring-config.xml" }) public class Test{ @Resource private RequestHandler WBRequestHandler; @Resource private ImporterFactory importerFactoryImpl; @Test @Transactional public void CSVReadTest() { //the importerRequest obj is a simple one - non-annotated ImporterRequest ir = new ImporterRequest(); ir.setImportTyp(RequestTyp.Artikel); //this instantiation works, i made a test case for a export file with the same line WBRequestHandler = importerFactoryImpl.getHandler(ir); WBRequestHandler.setRequest(ir); //in the test the req is null, ImporterRequest req = ((AbstractRequestHandler) WBRequestHandler).getRequest()…
has comment: http://stackoverflow.com/comment/35110687
tagged with: proxy-classes
upvote count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35137385
type: UnansweredQuestion
tagged with: spring
has title: Spring @Resource injectition abstract class getter returns null

http://stackoverflow.com/comment/35116572
comment on: http://stackoverflow.com/a/22990110
score: 0
type: AnswerComment
has text: If you're willing to write that much code, you might as well use `Matcher#find()` in a loop to match the tokens directly.
type: Comment

http://stackoverflow.com/a/22990326
type: Answer
has body: I think it would be easier and would scale better is you define a class to hold your values and then store them in a Vector or an ArrayList of them. For example class Values { int value1; int value2; } ArrayList&lt;Values&gt; valueList = new ArrayList&lt;Values&gt;() for (int i = 0, i &lt;= 100, i++) { currentValue = Values(); currentValue.value1 = i + 1; currentValue.value2 = i + 2; valueList[i] = currentValue; } In terms of performance, depending on how you traverse your 2d or your 3d array, you could get a linear or a quadratic order performance.
answers question: http://stackoverflow.com/q/22990029
score: 0

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/23045857
tags question: http://stackoverflow.com/q/23107835
tags question: http://stackoverflow.com/q/23020058
tags question: http://stackoverflow.com/q/23051119
tags question: http://stackoverflow.com/q/22983466
tags question: http://stackoverflow.com/q/23110114
tags question: http://stackoverflow.com/q/23044996
tags question: http://stackoverflow.com/q/23046106
tag name: jfreechart
tags question: http://stackoverflow.com/q/23112345

http://stackoverflow.com/a/23011982
answers question: http://stackoverflow.com/q/23011833
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35149551
upvote count: 1
score: 1
has body: Try query string to pass vars URL url = new URL("http://localhost:8080/ProjectCharterApproval2/CharterApprover?var1="+var1+"&amp;var2="+var2+"&amp;var3[]="+arr1); this array approach works fine with php but don't know about JAVA. Please try this. Or if you don't want to use this, try this class Param implements Serializable{ private String var1; private String var2; private String []var3; public String getVar1() { return var1; } public void setVar1(String var1) { this.var1 = var1; } public String getVar2() { return var2; } public void setVar2(String var2) { this.var2 = var2; } public String[] getVar3() { return var3; } public void setVar3(String[] var3) { this.var3 = var3; } public Demo(String var1, String var2, String[] var3) { super(); this.var1 = var1; this.var2 = var2; this.var3 = var3; } } Now in your java class Param pr=new Param(var1,var2,arr1); serialize this pr object in any persistent storage Like File and De-serialize the object in servlet.

http://stackoverflow.com/q/23020587
accepted answer: http://stackoverflow.com/a/23027107
tagged with: java
tagged with: blackberry
has body: I was hired by a group to develop a mobile application that ran on the three major mobile os platforms. I chose to use codenameone as it makes cross platform development easy. However, the group have recently changed their design plan to include in-app billing. I would like to know the process for doing in-app billing using codenameone. Is there a go-to tutorial? My preliminary research shows there is a com.codename1.payment library which can be used but the method of implementation is not clear. Any help will be much appreciated. NB: Please note that I am already registered with Android, BlackBerry and Apple as an app vendor. All I require is a tutorial/guide on how to integrate my app with the stores using codenameone. Thanks
type: Question
downvote count: 0
tagged with: ios
tagged with: android
tagged with: codenameone
answer count: 1
favorite count: 0
upvote count: 2
has title: Codenameone in-app billing for android, ios and blackberry
has answer: http://stackoverflow.com/a/23027107
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/35294629
has text: Which part are you asking about, how to detect the user-agent or how to redirect?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23089283

http://stackoverflow.com/a/23006657
has body: Change this, instead of Intent intent = new Intent(MainActivity.this, Activity2.class); try this Intent intent = new Intent(getApplicationContext(), Activity2.class);
answers question: http://stackoverflow.com/q/22998828
score: 0
has comment: http://stackoverflow.com/comment/35181711
type: Answer

http://stackoverflow.com/comment/35232074
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23049956
has text: You should see the "recicle view" in ListView to get performance.

http://stackoverflow.com/comment/35357119
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23126587
has text: First try this and check if it is downloading any pdf `public String getPdf() throws Exception { inputStream= new FileInputStream(new File("C:\\downloadfile.pdf")); return SUCCESS; }`
score: 0

authentication
tags question: http://stackoverflow.com/q/23046136
tags question: http://stackoverflow.com/q/23061816
tags question: http://stackoverflow.com/q/23028964
tags question: http://stackoverflow.com/q/23051866
tag name: authentication
tags question: http://stackoverflow.com/q/23084029
type: Tag
tags question: http://stackoverflow.com/q/23044889
tags question: http://stackoverflow.com/q/23121805
tags question: http://stackoverflow.com/q/23062340

http://stackoverflow.com/q/23002983
tagged with: java
has comment: http://stackoverflow.com/comment/35165865
tagged with: log4j2
type: Question
has body: I have a jersey app using jdk 1.7 on ubuntu. The log4j2.xml is: <?xml version="1.0" encoding="UTF-8"?> %d %p %C{1.} [%t] %m%n <TimeBasedTriggeringPolicy /> <SizeBasedTriggeringPolicy size="250 MB" /> <DefaultRolloverStrategy max="50"/> <appender-ref ref="RollingFile"/> <appender-ref ref="Async" /> On ubuntu: 2014-04-11 03:24:26,295 DEBUG ? [qtp510734793-482 - /id/1.0/session/start?appKey=e5c5f919c068447d1c49] thread qtp510734793-482 - /id/1.0/session/start? On my mac: 2014-04-10 20:21:08,183 DEBUG c.c.p.r.UpdateNeighborResource [qtp875070127-192 - /id/1.0/uns/testEvent?appKey=72df66fcd61449588b98bc57ef7043e4] testEvent: id: 6442450986 message # 18 Class and package shows up fine running locally, but when I deploy to ubuntu, I get a ? mark where the package/class should be. Any ideas?
has comment: http://stackoverflow.com/comment/35165710
upvote count: 1
downvote count: 0
favorite count: 0
duplicate of: http://stackoverflow.com/q/9713429
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9713429
has title: Deploying on ubuntu, running java, with log4j2, class names don't show up
answer count: 0
score: 1

http://stackoverflow.com/q/23119018
type: Question
answer count: 2
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35343509
has comment: http://stackoverflow.com/comment/35343100
has answer: http://stackoverflow.com/a/23133311
tagged with: servlets
has answer: http://stackoverflow.com/a/41136689
has comment: http://stackoverflow.com/comment/35343471
downvote count: 0
tagged with: jsp
accepted answer: http://stackoverflow.com/a/23133311
tagged with: tomcat
possible better answer: http://stackoverflow.com/a/41136689
has title: SEVERE: Allocate exception for servlet, error when trying to call a servlet from JSP page
type: AnsweredQuestion
has body: When I run the jsp on the tomcat server and it runs ok, but when I click submit it throws the following error, I have checked over everything and I am not sure where to go from here because it seems like it should work, any help would be much appreciated, Thank you. Error Stack Trace: SEVERE: Allocate exception for servlet RegistrationServlet java.lang.ClassNotFoundException: logon.RegistrationServlet.java at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:529) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:511) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:139) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1148) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:864) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:134) 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:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315) at java.uti…
score: 1
favorite count: 0

http://stackoverflow.com/q/23046449
tagged with: inheritance
tagged with: class
linked to: http://stackoverflow.com/q/7959335
score: 0
has comment: http://stackoverflow.com/comment/35212603
answer count: 1
has comment: http://stackoverflow.com/comment/35216829
has comment: http://stackoverflow.com/comment/35212832
has body: I'm writing a HuffmanTree class for a Java project that inherits from a BinaryNode class. I want to work with HuffmanTree nodes instead of BinaryNode nodes. BinaryNode has left and right instance variables of type BinaryNode, and I want HuffmanTree to have the same instance variables (i.e. left and right), but of type HuffmanTree instead. How would I go about doing this? Thanks! EDIT: Here's some of the BinaryNode code: public class BinaryNode&lt;T&gt; implements BinaryNodeInterface&lt;T&gt;, java.io.Serializable { //The BinaryNode's instance variables were changed to protected so we can access them //from the HuffmanTree class. private T data; private BinaryNode&lt;T&gt; left; private BinaryNode&lt;T&gt; right; public BinaryNode() { this(null); // call next constructor } // end default constructor public BinaryNode(T dataPortion) { this(dataPortion, null, null); // call next constructor } // end constructor public BinaryNode(T dataPortion, BinaryNode&lt;T&gt; leftChild, BinaryNode&lt;T&gt; rightChild) { data = dataPortion; left = leftChild; right = rightChild; } // end constructor
has comment: http://stackoverflow.com/comment/35212804
has answer: http://stackoverflow.com/a/23048833
accepted answer: http://stackoverflow.com/a/23048833
type: AnsweredQuestion
has title: In Java, how do I make instance variables of a subclass have the type of the subclass, rather than of the superclass?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35212683

http://stackoverflow.com/q/23082397
has comment: http://stackoverflow.com/comment/35284216
tagged with: criteria
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35278559
has comment: http://stackoverflow.com/comment/35278662
type: Question
has title: hibernate Group By clause return NullPointerException
has comment: http://stackoverflow.com/comment/35278757
score: 0
tagged with: java
tagged with: hibernate
has body: I try to use group by clause in hibernate using criteria but when I use ResultTransformer it getting error NullPointerException here is my code : @SuppressWarnings("unchecked") public List&lt;ModelNilai&gt; getListNilaiAwal(Integer page, Integer id, Integer idm) { // TODO Auto-generated method stub List&lt;ModelNilai&gt; list = new ArrayList&lt;ModelNilai&gt;(); Criteria c = getCurrentSession().createCriteria(ModelNilai.class); c.createAlias("mahasiswa","mh"); c.add(Restrictions.eq("mh.id", id)); c.createAlias("makul","m"); c.setProjection(Projections.projectionList() .add(Projections.groupProperty("m.id"), "id")); c.setResultTransformer(Transformers.aliasToBean(ModelNilai.class)); list.addAll(c.list()); System.out.println("size"+list.size()); if(page==null){ setTotalPage(c); } return list; } This is the query result: Hibernate: select m2_.id_makul as y0_ from tbl_nilai this_ inner join tbl_mhs mh1_ on this_.id_mhs=mh1_.id_mahasiswa inner join tbl_makul m2_ on this_.id_makul=m2_.id_makul where mh1_.id_mahasiswa=? group by m2_.id_makul I think my query is right, because when i try to see the list.size() , it give me the right size,, But still getting NullPointerException. java.lang.NullPointerException id.ac.undip.mlearning.controller.NilaiController.listNilaiAwal(NilaiController.java:60) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) org.springframework.web.servlet.mvc.method.annotation.RequestMap…
has comment: http://stackoverflow.com/comment/35315210

http://stackoverflow.com/q/23103928
tagged with: collabnet
has answer: http://stackoverflow.com/a/23142841
tagged with: tortoisesvn
type: Question
tagged with: svn
tagged with: java
score: 0
upvote count: 1
downvote count: 1
answer count: 1
favorite count: 0
has title: How to create users in collabnet?
has body: I am working on collabnet subversion repository. I installed CollabNetSubversionEdge-4.0.6_setup-x86_64 software and I created users in Collabnet GUI to access my repository. And I and my users accessing my repository and everything is working fine.But, Here my task is Insted of creating users in Collabnet Create users in Data base(MySql or Oracle) and make them to lo-gin from our DataBase to access collabnet I googled a lot but I didn't get even a single answer for this one.May be this is not possible. If it possible please tell me how to achieve this one.Thank you very much.
type: UnansweredQuestion

http://stackoverflow.com/comment/35129012
has text: sorry to bother you then.
type: Comment
comment on: http://stackoverflow.com/a/22997804
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35285758
type: Comment
type: QuestionComment
has text: @Lissy still the same exception after removing `eu.doInBackground(myUri);`???
comment on: http://stackoverflow.com/q/23086805
score: 0

http://stackoverflow.com/comment/35240859
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23060994
has text: I would try `flush()` after every write exactly what @GermannArlington said. Try this and see if it works for you.
type: Comment

http://stackoverflow.com/comment/35346823
comment on: http://stackoverflow.com/q/23120768
score: 1
type: QuestionComment
type: Comment
has text: The original file may contain these characters in some encoding, such as UTF-8 or MacRoman, and your Java program expects another encoding. Also possible: the characters may be decomposed into base character plus accent.

http://stackoverflow.com/comment/35244071
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23063636
type: QuestionComment
has text: Added code, the // out lines is me trying to figure it out by the way

http://stackoverflow.com/q/23098794
accepted answer: http://stackoverflow.com/a/23201509
upvote count: 2
tagged with: web-services
type: AnsweredQuestion
tagged with: heroku
score: 2
has title: (Java) Create new REST web services dynamically during runtime
tagged with: java
has comment: http://stackoverflow.com/comment/35316401
has comment: http://stackoverflow.com/comment/35356288
type: Question
has comment: http://stackoverflow.com/comment/35388156
has answer: http://stackoverflow.com/a/23201509
has comment: http://stackoverflow.com/comment/35368028
has comment: http://stackoverflow.com/comment/35353838
downvote count: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/35353418
answer count: 1
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/35353409
has comment: http://stackoverflow.com/comment/35308835
has comment: http://stackoverflow.com/comment/35308769
favorite count: 0
has body: I am experimenting stuffs with web services, and I am thinking to create new web services during runtime. My idea is by creating new Java file with appropriate JAX-RS annotation, and making it executable as new web service available for my web app. For example, I have localhost:8080/services as initial web service, upon executing some command, the new java file will be created with localhost:8080/services/time as the new path for a new web service. Is this possible? Creating new java file is no problem, it even resides in the correct path. but is there any way to force the newly created java file to be compiled and working appropriately? or maybe, lets say if i deploy it in heroku, can i force it to redeploy with that new addition?

http://stackoverflow.com/comment/35245268
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23063969
type: Comment
has text: This isn't going to work, basically what I'm trying to do is get the user to put their finger onto an image and "follow" it with their finger as it moves around the screen which is why I thought my other way of tackling this would work.

http://stackoverflow.com/q/22998395
accepted answer: http://stackoverflow.com/a/22998589
has comment: http://stackoverflow.com/comment/35125625
downvote count: 1
type: AnsweredQuestion
has title: Exception string index out of bounds
has body: i have this error in my java program, any help !! Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 19 at java.lang.String.charAt(Unknown Source) at Password_Constrainer.main(Password_Constrainer.java:31) here is the code public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); System.out.print("Please Enter Your Password: "); String inputString = input.nextLine(); System.out.println(inputString); if (inputString.length() &lt; 10) // less than 10 characters { System.out.println("Validation failed, word was too short"); } else // Contain a letter in upper case { int sum1 = 0; for (int i = 0; i &lt;= inputString.length(); i++) { if (Character.isUpperCase(inputString.charAt(i))) sum1++; } if (sum1 == 0) System.out.println("Validation failed, word has no Capital Letters"); can you help me in this ??
tagged with: java
has comment: http://stackoverflow.com/comment/35125794
score: -1
type: Question
has answer: http://stackoverflow.com/a/22998493
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/35125963
has answer: http://stackoverflow.com/a/22998589
tagged with: string
favorite count: 0
possible better answer: http://stackoverflow.com/a/22998493
has comment: http://stackoverflow.com/comment/35125698
has comment: http://stackoverflow.com/comment/35125565

http://stackoverflow.com/comment/35127537
has text: @tarrsalah Yes, that seems appropriate for `String` return type. There should be a `@HeaderParam` for that I believe.
comment on: http://stackoverflow.com/a/22999332
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35115982
has text: Does the direction of the arrow mean is subinterface or is superinterface?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22993320
score: 0

http://stackoverflow.com/comment/35140674
comment on: http://stackoverflow.com/a/23006974
type: Comment
has text: Is the other way, I need a String[] and I have an ArrayList
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35274366
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23080295
has text: "Cannot convert String to Enum"

http://stackoverflow.com/comment/35154307
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23014329
has text: Ok I think I see what is going on, the examples all have a declaration like: public static void main(String[] args) throws Exception { At the start of the class. Can I do something similar?

http://stackoverflow.com/comment/35293993
comment on: http://stackoverflow.com/q/23087782
type: QuestionComment
type: Comment
has text: oh ok, well its not in there
score: 0

http://stackoverflow.com/a/23091186
has body: Your results look correct. Lucene doesn't respect the order in which documents are added,it orders results by relevance score. "This is line 1 with some custom data" matches 8 terms in your query, while "This is line 4" has 4 matched terms, thus the former has a higher score. There is more complexity to scoring, including some factors that would equalize these somewhat, but in this case I believe that is the dominant behavior. You can sort your results by passing in a Sort to your search call. Sort.INDEXORDER is easy and sorts by Doc ID, which would serve your purpose somewhat. However, Doc IDs are not guaranteed to be in insert order. The more correct way to do this would be to add a field to sort on, which indexes either the time or order in which documents are indexed, and create a Sort on that field.
has comment: http://stackoverflow.com/comment/35356024
answers question: http://stackoverflow.com/q/23074690
score: 0
accepted answer of: http://stackoverflow.com/q/23074690
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/23127991
has body: In your case Hive will call Zodiac UDF's evaluate method exactly 50 times. You can add logging to the evaluate method and check it by yourself.
score: 0
has comment: http://stackoverflow.com/comment/35359144
type: Answer
answers question: http://stackoverflow.com/q/23127840

http://stackoverflow.com/a/23006677
has comment: http://stackoverflow.com/comment/35140218
upvote count: 4
has comment: http://stackoverflow.com/comment/35141652
answers question: http://stackoverflow.com/q/23006614
has comment: http://stackoverflow.com/comment/35141241
has comment: http://stackoverflow.com/comment/35140050
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/35140114
type: Answer
has comment: http://stackoverflow.com/comment/35139966
has comment: http://stackoverflow.com/comment/35141444
has body: There is a spell mistake. [ acivity => activity ] Change &lt;acivity android:name="com.example.library1.Aa" android:label="@string/app_name" /&gt; to &lt;activity android:name="com.example.library1.Aa" android:label="@string/app_name" /&gt; Activity is defined in package com.example.library1, however it is launched as com.example.androidcamera3/com.example.library1.Aa.
has comment: http://stackoverflow.com/comment/35140256
has comment: http://stackoverflow.com/comment/35140080

http://stackoverflow.com/comment/35183569
score: 0
has text: Do I really need to parse the whole corpus if I'm literally only looking to see how frequently a given string appears?
comment on: http://stackoverflow.com/q/23030234
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35159992
type: QuestionComment
comment on: http://stackoverflow.com/q/22995038
has text: sounds like you have some firefox settings possibly not letting you. What you should try, is to set a debug point right before you click the button, then do it manually (using the same browser selenium opened). If it returns just text, then maybe you should investigate the options you are passing to firefox. you can limit things like loading images and css.
score: 0
type: Comment

http://stackoverflow.com/comment/35111559
comment on: http://stackoverflow.com/a/22979423
has text: I checked the connection url with a java program. It works. But my jsp code with the exact same url doesn't work. So I guess, there should be a problem with tomcat7 recognizing that url.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35143466
has text: basically its a client requirement to see the logs . so they have developed some code(which we really don't know) and we are sending them the file through email.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23007799
type: Comment

http://stackoverflow.com/q/22996407
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35122498
has comment: http://stackoverflow.com/comment/35336888
linked to: http://stackoverflow.com/q/3540613
type: Question
duplicate of: http://stackoverflow.com/q/2190161
answer count: 2
has comment: http://stackoverflow.com/comment/35123613
has comment: http://stackoverflow.com/comment/35123780
linked to: http://stackoverflow.com/q/2190161
has title: java: throws RuntimeException
has answer: http://stackoverflow.com/a/22996540
has comment: http://stackoverflow.com/comment/35123634
possible better answer: http://stackoverflow.com/a/22997037
accepted answer: http://stackoverflow.com/a/22996540
has answer: http://stackoverflow.com/a/22997037
has comment: http://stackoverflow.com/comment/35121794
downvote count: 1
score: 8
favorite count: 0
upvote count: 9
has body: How is the below one correct? I expected compiler to tell me to use throws Exception or throws RuntimeException public void method1() throws NullPointerException { throw new RuntimeException(); } why I think its not correct -> Bcoz a NPE is a RTE, but a RTE is not a NPE How is this correct? I expected compiler to tell me to use throws Exception or throws RuntimeException or throws NumberFormatException public void method2() throws NullPointerException { throw new NumberFormatException(); } public void method3() throws Exception { // this is fine, as expected throw new RuntimeException(); } public void method4() throws RuntimeException { // this is fine, as expected throw new NullPointerException(); } public void method5() throws Exception { // this is fine, as expected throw new NullPointerException(); } Answer: for RTE even if u don't add throws clause to the method, compiler won't say anything public void method6() { // no compile time errors!! throw new NullPointerException(); } But when we explicitly say that 'throw new NullPointerException();' , why compiler ignores it? It is same as 'throw new SQLException();' It is not thrown on runtime say some object was evaluated to null, and invoked an action on that null object. Normally a function must declare all the exceptions that it can throw, but RTE's is bypassing it! RTE's are unchecked exceptions. But when you say throw new RTE, still unchecked?! Question - Isn't this a flaw? or please correct me in understanding why is it like that Update: Please note that this question is not about difference between checked exception and unchecked exception. The question is not about difference between any type of exception or error. The question is why an explicitly marked RunTimeException is not handled, or left without forcing the compiler to handle it. eg: public void methodA() { // methodA is not forced to handle the exception. methodB(); } public void methodB() throws RuntimeException { }
has comment: http://stackoverflow.com/comment/35123937
has comment: http://stackoverflow.com/comment/35124059
linked to: http://stackoverflow.com/q/23041570
has comment: http://stackoverflow.com/comment/35122542

http://stackoverflow.com/a/25652843
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23009797
downvote count: 0
score: 1
has body: Follow the Steps provide on Github repository and use Kepler It works for me

http://stackoverflow.com/comment/35362423
score: 0
has text: for testing it's <0,100>, leter it will be set by the user. And sorry,i did't see that part about range.
comment on: http://stackoverflow.com/q/23129754
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35095467
type: Comment
type: QuestionComment
has text: Assumming you're printing out `bulkString1` (would do with more meaningful name btw), then `bulkString1.append(bulkString + ":");` since you're not resetting `bulkString` to '' for each row it will append to the previous row. Just put `bulkString = "";` after `while (rows.hasNext()) {` and this should help.
score: 1
comment on: http://stackoverflow.com/q/22981722

http://stackoverflow.com/comment/35245522
has text: Which version of Jackson?
score: 0
comment on: http://stackoverflow.com/q/23064009
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35312116
type: Comment
type: QuestionComment
has text: @Spock post the full stacktrace.
comment on: http://stackoverflow.com/q/23100745
score: 0

http://stackoverflow.com/a/23041315
upvote count: 1
score: 1
has body: If any collection is unsorted, you cannot really "guess" where the element is going to be and the complexity is always going to be linear. Array is probably not the best option for you - you may want to use either TreeSet, which provides methods lower() and higher() from NavigableSet interface, these methods have logarithmic complexity. However, be aware that it won't contain duplicate elements, but I think it should be OK for the stuff you need.
downvote count: 0
answers question: http://stackoverflow.com/q/23041234
type: Answer

http://stackoverflow.com/q/23076073
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35267589
has title: How to handle DatePicker (Calendar Control) using selenium + Java?
score: 0
has body: I have a scenario to enter Date Of Birth for some agents. I gave Agent Names, DOB in excel. I wrote the code in Java. But while running the script it is not working. How can I automate Date Picker for the required date using Selenium?
has comment: http://stackoverflow.com/comment/35315853
tagged with: selenium-webdriver

http://stackoverflow.com/q/23007409
tagged with: jstl
answer count: 1
downvote count: 0
tagged with: javabeans
favorite count: 0
has answer: http://stackoverflow.com/a/23007909
accepted answer: http://stackoverflow.com/a/23007909
has comment: http://stackoverflow.com/comment/35141380
score: 2
upvote count: 2
has title: JSTL <c:if> tag - Checking whether Java Bean method returns True
type: AnsweredQuestion
tagged with: if-statement
has comment: http://stackoverflow.com/comment/35142030
tagged with: java
has comment: http://stackoverflow.com/comment/35141457
type: Question
has body: I currently have a .jsp file as follows (partly shown): &lt;jsp:useBean id="cart" class="edu.unsw.comp9321.assignment1.CartBean" scope="session" /&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="submit" name="cartBtn" value="Go To Checkout"/&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="submit" name="cartBtn" value="Remove From Cart"/&gt;&lt;/td&gt; &lt;c:if test="${cart.isCartListEmpty eq true}"&gt; &lt;td&gt;&lt;input type="submit" name="cartBtn" value="Back To Search"/&gt;&lt;/td&gt; &lt;/c:if&gt; &lt;/tr&gt; The bean cart has the code: public boolean isCartListEmpty(){ if (this.cart.isEmpty()) return true; return false; } The problem is I am getting an error with the following line: &lt;c:if test="${cart.isCartListEmpty eq true}"&gt; Could someone please tell me the correct way to evaluate whether the bean method is returning true or false? Thank you for your help.

http://stackoverflow.com/q/23009220
tagged with: eclipse-plugin
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: eclipse
has body: I have tried the code below but there is no match. Please help me with this. SearchPattern pattern = SearchPattern.createPattern(packageName,IJavaSearchConstants.PACKAGE,IJavaSearchConstants.PACKAGE,IJavaSearchConstants.ALL_OCCURRENCES); IJavaSearchScope scope = SearchEngine.createWorkspaceScope(); PackageSearchRequestor requestor=new PackageSearchRequestor(); SearchEngine searchEngine = new SearchEngine(); searchEngine.search(pattern, new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() }, scope, requestor, null); Note:I currently achieve this by iterating through all projects in workspace and calling getAllPackageFragmentRoots() of IJavaProject and iterating the package and matching the element name. But i think using SearchPattern will be better approach.
score: 0
answer count: 1
has title: search package by name in eclipse workspace
has answer: http://stackoverflow.com/a/23010406

http://stackoverflow.com/q/23038325
accepted answer: http://stackoverflow.com/a/23038412
has body: I need to write a code to load a square matrix, then swap the first row with the row with the largest element in the first column, then print the array exchanged. I can get the largest element of the first column but I don't how to do the exchange. import java.io.*; import java.util.*; import static java.lang.System.out; class Matriz4_Metodos{ static String cadena; static InputStreamReader entrada = new InputStreamReader(System.in); static BufferedReader recibedatos = new BufferedReader(entrada); public static void main (String[] args) throws java.io.IOException { int n,mayor=0; n=LeerNumero("Ingresa el numero de los renglones y columnas:"); int Matriz[][] = new int [n][n]; Matriz=CargarMatriz(Matriz); ImprimirMatriz(Matriz); out.println("\nEl mayor de la primera columna es:"+EncontrarMayor(Matriz,mayor)); } public static int LeerNumero (String msgtxt) throws java.io.IOException{ do{ int xnm; out.print(msgtxt); cadena=recibedatos.readLine(); try{ xnm=Integer.parseInt(cadena); if (xnm&lt;0){ out.println("Solo positivos"); continue; } return xnm; } catch (NumberFormatException e){ out.println("Numero de dato incorrecto"); } }while(true); } public static int[][] CargarMatriz (int xMatriz[][]) throws java.io.IOException{ Random Aleatorio =new Random(); int nal; for(int i=0; i&lt;xMatriz.length; i++){ for(int j=0; j&lt;xMatriz[0].length; j++){ nal=Aleatorio.nextInt(10); xMatriz[i][j]=nal; } } return xMatriz; } public static void ImprimirMatriz (int xMatriz[][]){ out.println("\n"); for(int i=0; i&lt;xMatriz.length; i++){ for(int j=0; j&lt;xMatriz[0].length; j++){ out.print(xMatriz[i][j]+" "); } out.println("\n"); } } public static int EncontrarMayor (int xMatriz[][],int xmayor) throws java.io.IOException { xmayor=0; for(int i=0; i&lt;xMatriz.length; i++){ for(int j=0; j&lt;xMatriz[0].length; j++){ if(j==0){ if(xMatriz[i][j]&gt;xmayor){ xmayor=xMatriz[i][j]; } } } } return xmayor; } }
downvote count: 1
has comment: http://stackoverflow.com/comment/35198283
has comment: http://stackoverflow.com/comment/35198252
tagged with: matrix
type: AnsweredQuestion
tagged with: arrays
score: 1
has answer: http://stackoverflow.com/a/23038412
has title: Matrix Swapping Rows- Java
favorite count: 0
has comment: http://stackoverflow.com/comment/35198240
type: Question
possible better answer: http://stackoverflow.com/a/23038421
upvote count: 2
has answer: http://stackoverflow.com/a/23038421
tagged with: java
answer count: 2

http://stackoverflow.com/q/23027315
has answer: http://stackoverflow.com/a/47527525
has title: Does application.yml support environment variables?
score: 192
type: AnsweredQuestion
tagged with: spring-boot
accepted answer: http://stackoverflow.com/a/23027709
tagged with: java
has body: I tried using env variables in my application.yml configration like: spring: main: show_banner: false --- spring: profiles: production server: address: $OPENSHIFT_DIY_IP port: $OPENSHIFT_DIY_PORT but the env variables are not resolved. Do I have to provide a different notation? In Rails you can e.g. use &lt;%= ENV['FOOVAR'] %> The only alternative is to run the app like: java -jar my.jar --server.address=$OPENSHIFT_DIY_IP --server.port=$OPENSHIFT_DIY_PORT
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/73276887
upvote count: 192
has answer: http://stackoverflow.com/a/71932470
tagged with: yaml
has answer: http://stackoverflow.com/a/23027709
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/78800285
possible better answer: http://stackoverflow.com/a/47527525
tagged with: spring

http://stackoverflow.com/q/23059753
type: Question
has comment: http://stackoverflow.com/comment/35239007
answer count: 2
has comment: http://stackoverflow.com/comment/35243905
has comment: http://stackoverflow.com/comment/35358238
has comment: http://stackoverflow.com/comment/35238455
has comment: http://stackoverflow.com/comment/35237270
has comment: http://stackoverflow.com/comment/35240720
has comment: http://stackoverflow.com/comment/36116239
downvote count: 0
has title: Java memory leak with native C and Fortran code
favorite count: 0
has answer: http://stackoverflow.com/a/23813067
has body: I'm working on an old java program that includes a native library with Fortran calls. So, I have Java that calls C via JNI, and then calls Fortran. In production we have an out of memory error like : Native memory allocation (malloc) failed to allocate 120000 bytes for jfloat in C:\BUILD_AREA\jdk6_37\hotspot\src\share\vm\prims\jni.cpp I suspect it's a memory leak. I'm new in the company, and I would like to work on linux but they have me working on Windows :( Under production we are using .so file because we are on solaris, and I use DLL on Windows (logical.) First, I tried to reproduce the production problem. So, I created a unit test that loads the DLL and calls the java class that calls the native method many times. When I did that, I saw with processExplorer.exe that the memory grew up to 2MB every 2 seconds. And I have the exception like in production. I'm happy I successfully reproduced the problem, and I could say that the problem came from the C or Fortran Code. Next, I tried to remove the call to Fortran, and my java only called C (without Fortran, this test permitted me to see if the problem was coming from C or Fortran.) And the result was that the memory did't move! Cool! I could say that I didn't have any problem with malloc/free in C. So, I decided to learn a little Fortran to look through the code. :) I learned that in Fortran we can use the allocate and deallocate keywords to play with the memory. And my code doesn't contains these keywords. :( After all of this, someone give me access on Solaris to launch my junit test that calls Java->JNI->C=>Fortran and to use the .so instead of DLL. And surprise - the memory didn't move!!! I don't have any problem under Solaris or RedHat. I'm stuck because the problem exists on production, but I can't reproduce it clearly. :( Why do I see a difference between DLL and SO? The code (java/C/Fortran) is exactly the same because it's me that compiles it. How can I investigate more? I have try to do a memory dump under…
tagged with: fortran
type: UnansweredQuestion
tagged with: memory-leaks
score: 6
has comment: http://stackoverflow.com/comment/35239592
upvote count: 6
has answer: http://stackoverflow.com/a/52725012
has comment: http://stackoverflow.com/comment/35242571
tagged with: java
tagged with: memory
has comment: http://stackoverflow.com/comment/35241523

http://stackoverflow.com/q/23028320
has comment: http://stackoverflow.com/comment/35180137
tagged with: entitymanager
tagged with: jpql
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35180186
has title: Is there a way to update database table in JPQL with value from a Map?
answer count: 0
type: Question
has body: Assume, I have a map: Map&lt;Long, String&gt; idsToValue = new HashMap&lt;Long, String&gt;(); idsToValue.put(1L, "New Value 1"); idsToValue.put(3L, "New Value 3"); And column in database: ID VALUE ...some other columns 1 "old value 1" ... 2 "old value 2" ... 3 "old value 3" ... Is there a way to update database rows with values from a Map, where ID is Map's key, and VALUE is Map's value, through one request to database? Something like: EntityManager.createquery("update MyColumn set VALUE =:idsToValue.value where ID =:idsToValue.key").setParameters("idsToValue", idsToValue).executeUpdate();
tagged with: java
score: 0

http://stackoverflow.com/q/22969558
answer count: 1
favorite count: 0
has body: Function countHi counts the number of "hi" in a given string. If countHi is called with "abc hi ho" as parameter, i is first set to 4, before for loop. i reset to -1 within 1st loop. After 1st loop, condition (i != -1) is false, and whole condition statement is false. I expect routine will exit loop, but it does not, and I don't understand why. public static int countHi(String str) { int cnt = 0; int i = str.indexOf("hi"); for (; (i &lt; str.length()) &amp;&amp; (i != -1); i++) { cnt++; i = str.indexOf("hi", i + 1); } return cnt; } In the following version, the condition exits loop correctly: for (; i!=-1;) { cnt++; i = str.indexOf("hi", i + 1); } Revision is more economical, but it would be nice to understand why first version produces an unexpected result.
type: UnansweredQuestion
upvote count: 4
downvote count: 0
tagged with: java
has title: Why does Java For condition statement seemed to be ignored?
type: Question
has answer: http://stackoverflow.com/a/22969591
score: 4

http://stackoverflow.com/q/23104127
has title: Getting a NullPointerException when loading an image
score: 0
has answer: http://stackoverflow.com/a/23105156
has body: I am trying to print a report designed by iReport (5.0.4). This report uses a company logo (logo.png). When I remove this image from the report everything works fine. When I leave it in the report, the report execution crashes. java.lang.NullPointerException at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:1034) I am loading the picture in Java. BufferedImage logo = null; try { logo = ImageIO.read(getClass().getResource("logo.png")); } catch (Exception ex) { throw new ReportException(ex.getMessage()); } try { JasperReport report = (JasperReport)JRLoader.loadObjectFromLocation(reportName); parameter.put("SUBREPORT", report); parameter.put("SUBREPORTDS", new JRBeanCollectionDataSource(subreport)); ResourceBundle resourceBundle = ResourceBundle.getBundle( "resources.Brief", Locale.GERMAN, getClass().getClassLoader()); parameter.put("REPORT_RESOURCE_BUNDLE", resourceBundle); parameter.put("logo", logo); JasperReport baseReport = (JasperReport) JRLoader.loadObjectFromLocation(BASE_REPORT); JasperPrint jprint = JasperFillManager.fillReport(baseReport, parameter, new JRBeanCollectionDataSource(nutzerListe)); return JasperExportManager.exportReportToPdf(jprint); The image is found, loaded and send to the report as a parameter "logo". The report parameter itself is defined as: &lt; parameter name="logo" class="java.lang.Object" /&gt; The image is defined in the report as: &lt; image scaleImage="RealSize"&gt; &lt; reportElement uuid="2e5316ac-fc10-4658-92b5-4cf7714b1c22" x="252" y="3" width="201" height="33"/&gt; &lt; imageExpression&gt;&lt; ![CDATA[$P{logo}]]&gt;&lt; /imageExpression&gt; &lt;/image&gt; When I debug into the code (Jasperreport 3.7.4) the exception is thrown because in the method evaluateImage the expressionClass is null. Is there anyone with an idea?
answer count: 1
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: jasper-reports

http://stackoverflow.com/comment/35219460
type: Comment
comment on: http://stackoverflow.com/a/23050115
score: 1
has text: No problem. Java enums are pretty powerful compared to other languages. Once you're done with the assignment, try working through the examples in the [docs](http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html).
type: AnswerComment

http://stackoverflow.com/comment/35087478
comment on: http://stackoverflow.com/a/22970710
score: 0
type: AnswerComment
has text: *"This method is intended for use by focus implementations. Client code should not use this method; instead, it should use requestFocusInWindow()."* - From the [JavaDocs](http://docs.oracle.com/javase/7/docs/api/javax/swing/JComponent.html#grabFocus())
type: Comment

max
tags question: http://stackoverflow.com/q/23072659
tags question: http://stackoverflow.com/q/23103666
tags question: http://stackoverflow.com/q/23098535
tag name: max
type: Tag

http://stackoverflow.com/q/23111468
has comment: http://stackoverflow.com/comment/35328936
has comment: http://stackoverflow.com/comment/35329459
has answer: http://stackoverflow.com/a/23112239
has title: StringIndexOutOfBoundsException Error
has comment: http://stackoverflow.com/comment/35329506
downvote count: 1
has comment: http://stackoverflow.com/comment/35329067
type: AnsweredQuestion
has body: I want to parse a numeric file. I achieve parsing but when I changed the file content, I get a StringIndexOutOfBoundsException. Any help will be appreciated. My code is like below: public void fileParse() throws IOException { File f = new File("180214.txt"); File f1 = new File("salelog.txt"); String s = null; FileWriter fw = new FileWriter(f1); PrintWriter pw = new PrintWriter(fw); BufferedReader br = new BufferedReader(new FileReader(f)); while((s=br.readLine())!=null) { if(s.charAt(0) == '0') { pw.println("&lt;receipt&gt;"); pw.println(s); continue; } if(s.charAt(0)=='8') { pw.println(s); pw.println("&lt;/receipt&gt;"); continue; } pw.println(s); } // br.close(); pw.close(); br1.close(); } } My file content is like this: 001021402180000000000000000 4869359340051000000011001000000100000000000 58693593400510800000000008000 0 600000001100100 800300000001070002075700000001100000000008 001021402180000000000000000 4869697119156000000003001000000100000000000 58696971191560800000000002000 0 600000000300100 800500000001060002080000000000300000000002 001021402180000000000000000 4869069850477000000010001500000200000000000 58690698504770800000000015000 0 4000008691497000000012001500000100000000000 50000086914970800000000009000 0 4000004082260000000008001000000100000000000 50000040822600800000000006000 0 600000004000100 800500000001060003080100000004000000000030 001021402180000000000000000 4000008090548000000028501400000100000000000 50000080905480800000000021000 0 600000002850100 800500000001060004080900000002850000000021 001021402180000000000000000 4869088520157000000049501200000100000000000 58690885201571800000000076000 0 600000004950100 800500000001060005080900000004950000000076 001021402180000000000000000 4869749799821000000019501400000100000000000 58697497998210800000000014000 0 4869076767108000000049501500000100000000650 58690767671080800000000032000 0 986907676710801$0000000065000001 600000006250100 800500000001060006081200000006250000000046 001021402180000000000000000 …
tagged with: java
tagged with: file
score: -1
has comment: http://stackoverflow.com/comment/35329945
type: Question
has comment: http://stackoverflow.com/comment/35329020
has comment: http://stackoverflow.com/comment/35329869
accepted answer: http://stackoverflow.com/a/23112239
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35329515
tagged with: file-io
has comment: http://stackoverflow.com/comment/35330100
has comment: http://stackoverflow.com/comment/35329362
tagged with: parsing
favorite count: 0

http://stackoverflow.com/q/22972381
has comment: http://stackoverflow.com/comment/35078704
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22978791
has comment: http://stackoverflow.com/comment/35078744
tagged with: java
linked to: http://stackoverflow.com/q/70579
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/35079493
has answer: http://stackoverflow.com/a/22978791
answer count: 3
has title: How to escape backslash in xpath webdriver java
has body: I am using the xpath with Selenium web driver Java to locate an element using id and it's id is like this: name\params\etc to represent this in java, I am using String id = "\\name\\params\\etc" driver.findElement(By.xpath("//"+"a"+"[@id='"+id+"']")); please let me know how to resolve it.
upvote count: 1
has answer: http://stackoverflow.com/a/22974406
has comment: http://stackoverflow.com/comment/35078990
has answer: http://stackoverflow.com/a/22972583
tagged with: xpath
downvote count: 0
score: 1
tagged with: selenium
possible better answer: http://stackoverflow.com/a/22972583

http://stackoverflow.com/a/22984130
accepted answer of: http://stackoverflow.com/q/22984097
has comment: http://stackoverflow.com/comment/35099513
score: 2
answers question: http://stackoverflow.com/q/22984097
upvote count: 2
has comment: http://stackoverflow.com/comment/35099019
has comment: http://stackoverflow.com/comment/35098993
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35099442
has body: Your views belong to the dialog layout. So initialize using dialog.findViewById ImageView image = (ImageView)dialog.findViewById(R.id.image_display); Similarly the other views that belong to the dialog layout. Get rid of View layout = ((Activity) mContext).findViewById(R.layout.wish_dialog); findViewById looks for a view with the id mentioned in the current view hierarchy. You set the custom layout to the dialog. So use the dialog object to find views.
type: Answer

http://stackoverflow.com/comment/79993579
has text: This is the best Answer, using the modern java.time classes rather than the troublesome old legacy date-time classes `Calendar` & `Date`.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23003472
type: AnswerComment

http://stackoverflow.com/comment/35104427
type: QuestionComment
comment on: http://stackoverflow.com/q/22987016
has text: Any screenshots or code blocks which you can share?
score: 0
type: Comment

http://stackoverflow.com/comment/35319490
type: QuestionComment
comment on: http://stackoverflow.com/q/23106077
has text: Could it just look like it stops because you are not printing the result?
score: 0
type: Comment

http://stackoverflow.com/q/23007251
linked to: http://stackoverflow.com/q/176118
has answer: http://stackoverflow.com/a/23007330
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Where should I declare my variables?
upvote count: 6
has comment: http://stackoverflow.com/comment/35140996
has comment: http://stackoverflow.com/comment/35140961
has comment: http://stackoverflow.com/comment/35141341
tagged with: java
downvote count: 1
has body: When declaring my variables at the beginning of the class, I can't use them in a conditional statement in other methods. I tried declaring them inside the method it works but I can't use the variables outside the method. This is a sample of my code protected void onClick(View v){ switch(v.getId()){ int counter; case R.id.btsend: for (int i = 0;i&lt;=0;i++){ if (true) counter += 1; } TextView.setText(counter); break; } }
type: Question
score: 5
has answer: http://stackoverflow.com/a/23007303
has comment: http://stackoverflow.com/comment/35140928
has comment: http://stackoverflow.com/comment/35141368
tagged with: scope
has comment: http://stackoverflow.com/comment/35141099
answer count: 3
has comment: http://stackoverflow.com/comment/35141411
has comment: http://stackoverflow.com/comment/35141566
has comment: http://stackoverflow.com/comment/35140967
has answer: http://stackoverflow.com/a/23007308

http://stackoverflow.com/comment/35079217
comment on: http://stackoverflow.com/q/22972306
score: 0
has text: I see you added the code, but this was nearly at the same time as Jared gave an answer. It should basically as easy as he described it in your case: The `main` method and the `JFrame` will be no longer required. Instead you create a new class extending `JApplet` and add your `Main` JPanel as the content pane.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35166441
score: 0
comment on: http://stackoverflow.com/a/23020770
type: Comment
has text: Ahh ok that makes sense. But I already have the toString in my node class printing out a customized display with all of the fields, so that display is what would be added to the file then right?
type: AnswerComment

http://stackoverflow.com/comment/35349827
has text: Why do you need the inner for loop? seems like you just want `palindromeList[x] = ...; x++;` in the innermost if.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23122693

http://stackoverflow.com/comment/35276965
score: 0
type: Comment
has text: You haven't stated what is supposed to update.
type: QuestionComment
comment on: http://stackoverflow.com/q/23082053

http://stackoverflow.com/comment/35352712
type: Comment
has text: Please share input data and expected output.
comment on: http://stackoverflow.com/a/23124234
score: 0
type: AnswerComment

http://stackoverflow.com/q/23104778
has answer: http://stackoverflow.com/a/23104940
type: Question
score: -1
has answer: http://stackoverflow.com/a/23104931
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35316886
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35318100
answer count: 4
possible better answer: http://stackoverflow.com/a/23104931
type: AnsweredQuestion
has title: Create List with two items e.g. List<String, Integer>
upvote count: 0
tagged with: list
has answer: http://stackoverflow.com/a/23104926
accepted answer: http://stackoverflow.com/a/23104926
tagged with: java
has body: I would like to create a List which contains a String file path and an Integer (the int stores the position of the filepath). I will end up with a list of for example 100 items, could be more or could be less. I would then like to split this List into 5 smaller lists. I need to store the int too, as when the Lists will be split into the smaller ones, I need to also store its correct position from the original large list. For example, here is a list with 10 items abc, 0 bgs, 1 dwd, 2 th, 3 ht, 4 hth, 5 ef, 6 fe, 7 fe, 8 fef, 9 After splitting, it would look like: abc, 0 bgs, 1 dwd, 2 th, 3 ht, 4 hth, 5 ef, 6 fe, 7 fe, 8 fef, 9 I looked at using a hashmap, but I couldn't find an example of how to split it. After it is split, I need to retrieve both values from each element, e.g. I will loop through each List and use 'abc' and '0' etc etc
has answer: http://stackoverflow.com/a/23105071

http://stackoverflow.com/comment/35086675
type: QuestionComment
has text: The first thing you're doing wrong is that you aren't checking for end of stream anywhere. If you're expecting exactly two bytes I would use DataInputStream.readFully().
comment on: http://stackoverflow.com/q/22973797
score: 0
type: Comment

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

http://stackoverflow.com/comment/35180589
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23017646
type: Comment
has text: OK, it's stop crashing with your example, but the game itself doesn't quite work. If I insert the first number and click the button, it give me the "Invalid input" message, and to make the number disappear I have to try and insert a second number in a the "Guess number" EditText. From there, if I try to guess the first person's number it won't give me any message, only if I type the correct number and then I get the last part of the IF. In short, why only the last part of the IF works?

http://stackoverflow.com/comment/35199652
has text: Also check out some of [these](https://www.google.com/search?q=local%20va#q=local%20variable%20needs%20to%20be%20declared%20final)
score: 0
comment on: http://stackoverflow.com/a/23039045
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35293410
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23089768
has text: Just make it an inner class?
type: AnswerComment

http://stackoverflow.com/comment/35336138
has text: Maybe the int is too big for the database to handle. I saw it's type is NUMBER(5), that means that it can only hold 5 digits
score: 0
comment on: http://stackoverflow.com/q/23114562
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23123920
linked to: http://stackoverflow.com/q/513832
possible better answer: http://stackoverflow.com/a/23123952
score: -2
favorite count: 0
duplicate of: http://stackoverflow.com/q/513832
downvote count: 2
accepted answer: http://stackoverflow.com/a/23124059
type: AnsweredQuestion
tagged with: if-statement
tagged with: java
has comment: http://stackoverflow.com/comment/35351849
has body: import java.util.Scanner; class Lev { //main class public static void main(String args[]){ Scanner read = new Scanner(System.in); Calculator obj1 = new Calculator(); Per obj2 = new Per(); String des; System.out.print("Enter your choice= "); des = read.nextLine(); if(des=="calc" || des=="calculator"){ obj1.calcultr(); } if(des=="per" || des=="percentage") { obj2.percentage(); } else { System.out.println("Argument not understood"); } read.close(); } } //main class ends import java.util.Scanner; //2nd class public class Calculator { Scanner inp = new Scanner(System.in); public void calcultr(){ double num1,num2,strge = 0; char q; System.out.println("Enter 2 numbers to continue"); System.out.print("Num1= "); num1 = inp.nextDouble(); System.out.print("Num2= "); num2 = inp.nextDouble(); System.out.print("Enter what do you want to do= "); q = inp.next().charAt(0); if(q=='+'){ strge = num1+num2; System.out.print("Result= " + strge); }; if(q=='-'){ strge = num1 - num2; System.out.print("Result= " + strge); } if(q=='*'){ strge = num1 * num2; System.out.print("Result= " + strge); } if(q=='/') { strge = num1/num2; System.out.print("Result= " + strge); } } } import java.util.Scanner; //3rd class public class Per { Scanner inp = new Scanner(System.in); public void percentage(){ double numa,from,per; System.out.println("Enter total number attained= "); System.out.print("Number Attained= "); numa = inp.nextDouble(); System.out.print("Enter total marks from which marks attained= "); from = inp.nextDouble(); per = (numa/from)*100; System.out.print("Percentage Achieved= " + per); } }
type: Question
answer count: 2
upvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/23123952
has answer: http://stackoverflow.com/a/23124059
has title: Why my if Statement is doing opposite of what i am tellling it to do Java

http://stackoverflow.com/a/23036220
downvote count: 0
has comment: http://stackoverflow.com/comment/35195271
has comment: http://stackoverflow.com/comment/35195280
has comment: http://stackoverflow.com/comment/35196169
answers question: http://stackoverflow.com/q/23036149
type: Answer
has comment: http://stackoverflow.com/comment/35195887
has comment: http://stackoverflow.com/comment/35196043
has comment: http://stackoverflow.com/comment/35195509
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35195359
has body: Here is what it means that equals should compare the fields/properties. public boolean equals(Object obj) { if (obj instanceof Point) { Point pt = (Point)obj; return (x == pt.x) &amp;&amp; (y == pt.y); } return super.equals(obj); } This example is taken from java.awt.Point which is one of the Java's built-in classes. So Point has 2 properties x and y, and in its equals method it is comparing them. See also: java.awt.Point.equals

http://stackoverflow.com/comment/35327854
has text: Sure, there's no actual upper limit. But there's got to be a fairly practical maximum file size that you can target. If you have a working regex, it's easier than the alternatives of re-writing that part of the code.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23095177

http://stackoverflow.com/comment/35278169
score: 0
type: Comment
has text: in Vaadin7 Book, Bean Validation Section, says: Bean validators are automatically created when using a BeanFieldGroup. I can't understand why doesn't work.
comment on: http://stackoverflow.com/a/23082051
type: AnswerComment

http://stackoverflow.com/q/23030280
has answer: http://stackoverflow.com/a/23030351
accepted answer: http://stackoverflow.com/a/23030413
has comment: http://stackoverflow.com/comment/35183596
downvote count: 2
has comment: http://stackoverflow.com/comment/35183494
tagged with: object
type: AnsweredQuestion
has body: Good day, Here is my code: public class ArrayDirectory implements Directory { private int allocatedSize = 0; public Entry[] entryDirectory = new Entry[allocatedSize]; @Override public void addEntry(Entry newEntry) { newEntry = findFreeLocation(); entryDirectory = Arrays.copyOf(entryDirectory, entryDirectory.length + 1); } private Entry findFreeLocation() { Entry returnedEntry = new Entry(); for (int i = 0; i &lt; entryDirectory.length; i++) { if (entryDirectory[i] == null) { break; } returnedEntry = entryDirectory[i]; } return returnedEntry; } I've made the size of the entryDirectory dynamic; it increments each time the addEntry method is used. However, when I am trying to call a method of an entry object from the entryDirectory array, a NullPointerException is thrown. public static void main(String[] args) { ArrayDirectory d = new ArrayDirectory(); d.addEntry(new Entry("Jack", "Jones", 1234)); d.addEntry(new Entry("Brad", "Jones", 1234)); d.addEntry(new Entry("Olga", "Jones", 1234)); System.out.println(d.entryDirectory[0].getInitials()); } Here is the getInitials() method of the Entry object. public Entry(String surname, String initials, int extension){ this.surname = surname; this.initials = initials; this.extension = extension; } public String getInitials() { return initials; }
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23030413
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/35183531
favorite count: 0
tagged with: exception
has title: NullPointerException when calling a method from a dynamic object array
possible better answer: http://stackoverflow.com/a/23030351

http://stackoverflow.com/comment/35095799
type: AnswerComment
has text: new LinkedList<MyObject>(myQueue); should do
score: 4
type: Comment
comment on: http://stackoverflow.com/a/22982249

http://stackoverflow.com/a/22988086
score: 0
has body: Create a subclass of JComponent instead of Graphics. An instance of Graphics is then passed in to the paintComponent method: class GUI extends JComponent { public void paintComponent(Graphics g) { super.paintComponent(g); g.drawString("Hello People!", 2, 10); } } If you try creating an instance of Graphics or a subclass yourself, then they'll be no useful way to use it.
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22987613
accepted answer of: http://stackoverflow.com/q/22987613

http://stackoverflow.com/a/23042027
has comment: http://stackoverflow.com/comment/35205973
score: 0
has comment: http://stackoverflow.com/comment/35210272
upvote count: 1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23041975
has comment: http://stackoverflow.com/comment/35210680
has body: In your manifest, in your activities definition add android:configChanges="orientation". Example: &lt;activity android:name=".MainActivity" android:label="@string/title_activity_main" android:configChanges="orientation"&gt; else add as well screenSize: android:configChanges="orientation|screenSize"

http://stackoverflow.com/q/23114782
has answer: http://stackoverflow.com/a/23116192
type: UnansweredQuestion
tagged with: swing
tagged with: java
linked to: http://stackoverflow.com/q/22041915
has body: My problem is this code producing a Swing GUI, goes out of display bounds in my laptop. Why? It's using DesignGridLayout as layout library. This is a code taken from answer in: Why does my components go out of boundaries, please help me to align it with the necessary code import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.table.DefaultTableModel; import net.java.dev.designgridlayout.DesignGridLayout; public class Demo { private void createAndShowGUI() { JLabel i5l1 = new JLabel("FREIGHT DETAILS"); JLabel i5l2 = new JLabel("Date : "); JLabel i5l3 = new JLabel("Vehicle No. : "); JLabel i5l4 = new JLabel("From : "); JLabel i5l5 = new JLabel("Item : "); JLabel i5l6 = new JLabel("Quantity : "); JLabel i5l7 = new JLabel("Kg."); JLabel i5l8 = new JLabel("Rate : Rs."); JLabel i5l15 = new JLabel("SALE DETAILS"); JLabel i5l16 = new JLabel("Cash Sales : Rs. "); JLabel i5l17 = new JLabel("Credit : Rs. "); JLabel i5l18 = new JLabel("EXPENSES"); JLabel i5l19 = new JLabel("Food &amp; Tea : Rs. "); JLabel i5l20 = new JLabel("Wages : Rs. "); JLabel i5l21 = new JLabel("Miscellaneous Expenses : Rs. "); JTextField i5t1 = new JTextField(20); JTextField i5t2 = new JTextField(20); JTextField i5t3 = new JTextField(20); JTextField i5t4 = new JTextField(20); JTextField i5t11 = new JTextField(20); JTextField i5t12 = new JTextField(20); JTextField i5t13 = new JTextField(20); JTextField i5t14 = new JTextField(20); JComboBox i5cb1 = new JComboBox&lt;&gt;(); JComboBox i5cb2 = new JComboBox&lt;&gt;(); JComboBox i5cb3 = new JComboBox&lt;&gt;(); JButton i5b1 = new JButton("Save"); JButton i5b2 = new JButton("Reset"); JButton i5b3 = new JButton("Close"); JSeparator i5sep1 = new JSeparator(); JSeparator i5sep…
type: Question
tagged with: layout
tagged with: layout-manager
has title: DesignGridLayout goes out of boundaries
score: 0
answer count: 1
tagged with: user-interface

http://stackoverflow.com/comment/35274492
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23079698
has text: @user3533531 Rightio, I've fixed it in that case. Again, [the code is on this ideone](https://ideone.com/MjEBJo). You should keep in mind the fact that if you put in a number that isn't in the sequence, you'll still get an answer that is likely wrong.
score: 0

http://stackoverflow.com/a/40805822
has comment: http://stackoverflow.com/comment/68832972
has body: Run Eclipse as Administrator, it should work then.
type: Answer
score: -1
downvote count: 1
upvote count: 0
answers question: http://stackoverflow.com/q/23048399

http://stackoverflow.com/q/23129080
tagged with: driver
favorite count: 0
has title: On other pc java.sql.SQLException: No suitable driver found for jdbc:sqlserver
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35360810
has answer: http://stackoverflow.com/a/23129147
tagged with: java
has comment: http://stackoverflow.com/comment/35364426
linked to: http://stackoverflow.com/q/17484764
downvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18158864
has comment: http://stackoverflow.com/comment/35360833
type: Question
tagged with: sql
has body: I wrote an app and it works fine by me. But on other pc-s it throws an exception. java.sql.SQLException: No suitable driver found for jdbc:sqlserver I give it (only the app.jar file) to my college, and he gets this error. I give him a jdbcdriver.jar file and, nothing changed. However I use jre7, I added a line to the code: Class.forName("com.mysql.jdbc.Driver"); And than he gets another exception: Error: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver What can I do to run this app properly on other pc-s?
tagged with: jdbc
score: 1
has comment: http://stackoverflow.com/comment/35367189

http://stackoverflow.com/q/22992032
tagged with: java
type: Question
has title: DeSerialized Object containing ArrayList has all null values
has body: Hopefully someone can provide some insight on this issue. I have created an instance of an object that contains an ArrayList of information (username, password, password hint). I am trying to serialize the object. It looks like it is serializing properly, but when I restart the project to deserialize, it returns null values in the ArrayList. Why is it returning null values for the ArrayList objects? Driver Class: import java.io.Serializable; public class TestingDriver implements Serializable{ private static final long serialVersionUID = 12345L; private static TestingAccount users = new TestingAccount(); public static void main(String[] args) { int foreverLoop = 0; users = DeSerialize.main(); while (foreverLoop &lt; 1) { int selection = users.displayMainMenu(); if (selection == 1) { users.listUsers(); } else if (selection == 2) { users.addUser(); } else if (selection == 3) { users.deleteUser(); } else if (selection == 4) { users.getPasswordHint(); } else if (selection == 5) { Serialize.main(users); System.exit(0); } else { System.out.println("That option does not exist. Please try again."); } } } } TestingUser Class (objects of this class will populate the ArrayList): import java.io.Serializable; public class TestingUser extends UserAccount implements Serializable, Comparable &lt;TestingUser&gt; { private static final long serialVersionUID = 12345L; public TestingUser(String username, String password, String passwordHint) { super(username, password, passwordHint); } public TestingUser() { } @Override public void getPasswordHelp() { System.out.println(""); System.out.println("Password hint: " + passwordHint); System.out.println(""); } @Override public int compareTo(TestingUser otherAccount) { if (this.username.compareToIgnoreCase(otherAccount.username) &lt; 0) { return -1; } else if (this.username.compareToIgnoreCase(otherAccount.username) &gt; 0) { return 1; } else { return 0; } } } TestingAccount class (calling this class creates an object that contains the ArrayLis…
has answer: http://stackoverflow.com/a/23001654
answer count: 1
downvote count: 0
tagged with: deserialization
score: 1
favorite count: 0
tagged with: serialization
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35119430
accepted answer: http://stackoverflow.com/a/23001654
has comment: http://stackoverflow.com/comment/35115721
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/23080976
downvote count: 0
upvote count: 2
has body: you should use i.getBooleanExtra and i.getStringExtra, since you did not provide a Bundle (you did not call i.setExtras(Bundle) )
type: Answer
accepted answer of: http://stackoverflow.com/q/23080931
score: 2
answers question: http://stackoverflow.com/q/23080931
type: AcceptedAnswer

http://stackoverflow.com/q/23003830
has comment: http://stackoverflow.com/comment/35135077
has title: while there is input from user
has answer: http://stackoverflow.com/a/23003910
has answer: http://stackoverflow.com/a/23050986
tagged with: java
possible better answer: http://stackoverflow.com/a/23003911
answer count: 4
has answer: http://stackoverflow.com/a/23003911
has comment: http://stackoverflow.com/comment/35135131
has answer: http://stackoverflow.com/a/23004149
has comment: http://stackoverflow.com/comment/35135122
has body: I'm new to java. In my program, I have the user enter the integers that are being added to an array list. I need to set up a while loop that will be something like this: arrayList = new ArrayList&lt;int&gt;; int i = scanner.nextInt(); while(there is input from user) { arrayList.add(i); } I expect the user to enter 5 values. What do I put as the condition statement of the while loop. In other words, how do I say "while there is input?" Thanks
accepted answer: http://stackoverflow.com/a/23003910
tagged with: while-loop
type: AnsweredQuestion
favorite count: 0
type: Question
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/23047454
has answer: http://stackoverflow.com/a/23047687
accepted answer: http://stackoverflow.com/a/23047687
answer count: 1
has title: Does the node.js callback mimic the java accept socket?
tagged with: sockets
tagged with: node.js
has body: I have written some code in node.js a while back and I used the magic of sockets to accomplish what I wanted. io.sockets.on("connection", function(socket){ //code }); I understood from this code that the socket given as the argument to the callback is the socket that just connected and just gets served the code into the callback. Recently however I have tried to move a bit into java and I have met this code: ServerSocket client_socket = new ServerSocket(port); Socket socket = client_socket.accept(); My question now is weather the accept function will fetch me the socket that just connected exactly the way that the callback would do it in node.js?
type: AnsweredQuestion
type: Question
tagged with: java
score: 0

http://stackoverflow.com/a/23075337
has body: Refer the answer to this question Please ensure you've read the java mail API FAQs completely.
has comment: http://stackoverflow.com/comment/35266035
has comment: http://stackoverflow.com/comment/35317759
answers question: http://stackoverflow.com/q/23075140
score: 0
has comment: http://stackoverflow.com/comment/35314232
type: Answer
has comment: http://stackoverflow.com/comment/35265581

http://stackoverflow.com/comment/35210882
has text: I will do that. Sorry I haven't quite done it yet...
comment on: http://stackoverflow.com/q/22976815
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35215399
has text: @wiz3kid: I have updated my question with the code but still confuse how do I extend this? If you can provide an example then this will help me a lot. Thanks.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23047589

http://stackoverflow.com/q/23083764
tagged with: android
has answer: http://stackoverflow.com/a/23084435
has comment: http://stackoverflow.com/comment/35279756
tagged with: android-edittext
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23084622
has comment: http://stackoverflow.com/comment/35279750
tagged with: java
has body: Hi everyone, I want to do text watcher. What I really want is that the text watcher will count the message like they do in real phone. ( e.g 1/160 160 starts decreasing with every letter I wrote in edit text and when letters are more then 160 it will become 2/160 ). What I have done is simple text watcher. With counts all the characters. Here is my code private final TextWatcher mTextEditorWatcher = new TextWatcher() { public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { textView2.setText(String.valueOf(s.length())); } public void afterTextChanged(Editable s) { } and EditMsg.addTextChangedListener(mTextEditorWatcher); Hope you got my question. Thank you in advance.
type: UnansweredQuestion
score: -3
downvote count: 4
has comment: http://stackoverflow.com/comment/35279794
favorite count: 0
has comment: http://stackoverflow.com/comment/35280027
type: Question
has title: Character change like they do in real phone messaging

http://stackoverflow.com/a/23048574
accepted answer of: http://stackoverflow.com/q/23048216
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23048216
type: Answer
has comment: http://stackoverflow.com/comment/37156362
downvote count: 0
score: 1
has body: Here's the code, I added some comments to make it more clear. Please note that the array in the code should be sorted Logic Horizontal A1 =&gt; 01 A2 =&gt; 02 A3 =&gt; 03 A4 =&gt; 04 So A2 - A1 = 1 Vertical A1 =&gt; 01 B1 =&gt; 11 C1 =&gt; 21 D1 =&gt; 31 So B1 - A1 = 10 Code: public static void main(String[] args) { String[] spots0 = { "A1", "B1", "C1", "D1" }; String[] spots1 = { "A1", "A2", "A3", "A4" }; String[] spots2 = { "A1", "B1", "B2", "B3" }; System.out.println(isCorrect(spots0) ? "correct" : "incorrect"); System.out.println(isCorrect(spots1) ? "correct" : "incorrect"); System.out.println(isCorrect(spots2) ? "correct" : "incorrect"); } public static boolean isCorrect(String[] spots) { int NONE = -1; int HORIZONTAL = 1; int VERTICAL = 2; int pattern = NONE; //BY DEFAULT NONE for (int i = 0; i &lt; spots.length - 1; i++) { //difference between 2 consecutive element in spots[]. If A2 - A1 = 1, and B1 - A1 = 10 int diff = toNum(spots[i + 1]) - toNum(spots[i]); if (diff == 1) { // if HORIZONTAL if (pattern == NONE) // if the first time pattern = HORIZONTAL; // set pattern to vertical, this is used for later to check if any illigal change happen else if (pattern == VERTICAL) { //if it was Vertical and changed, then error return false; } } else if (diff == 10) { // if VERTICAL if (pattern == NONE) // if the first time pattern = VERTICAL; // set pattern to horizontal, this is used for later to check if any illigal change happen else if (pattern == HORIZONTAL) { //if it was Horizontal and changed, then error return false; } } else { return false; } } return true; } public static int toNum(String s) { // A1 =&gt; 01 , B1 =&gt; 11, C2 =&gt; 22 return Integer.parseInt("" + ((int)s.charAt(0) - 'A') + s.charAt(1)); }

http://stackoverflow.com/comment/35349714
has text: Post full code, please
score: 0
comment on: http://stackoverflow.com/q/23121831
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23085908
has comment: http://stackoverflow.com/comment/35283842
has comment: http://stackoverflow.com/comment/35284124
type: AnsweredQuestion
upvote count: 2
accepted answer: http://stackoverflow.com/a/23086195
type: Question
has body: I am about to write a platform-game (like the old Super Mario), and I want to write that in Java. Which of the graphic classes is the better one to use for this purpose? I have found JFrame, Graphics, Graphics2d, JApplet etc. The game will consist of a moving background (an image), a charachter with motions (also images), and some blocks for the level (also images). I want to be able to run it in fullscreen. Which class should I use?
tagged with: java
has comment: http://stackoverflow.com/comment/35283916
has comment: http://stackoverflow.com/comment/35283945
has comment: http://stackoverflow.com/comment/35283885
downvote count: 4
has comment: http://stackoverflow.com/comment/35283773
linked to: http://stackoverflow.com/q/12344464
answer count: 1
has answer: http://stackoverflow.com/a/23086195
favorite count: 0
score: -2
has title: Which java class should I use for my 2D game graphics?

http://stackoverflow.com/comment/35089376
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22978403
has text: yes, that's much better!

http://stackoverflow.com/q/23102350
tagged with: java
has answer: http://stackoverflow.com/a/28061088
downvote count: 0
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/39261984
has body: I am trying to send "String" as argument in sendKeys method [type WebElement] but system is using it as char sequence, so I am not getting proper output. public static void setGridDropDownValue(Selenium selenium, WebDriver webDriver, String strGridId, int nRowIndex, int nCellIndex, String strValue) { String strXPath = "//div[@id='"+strGridId+"']//table/tbody/tr[2]/td/div/div/table/tbody/tr["+(nRowIndex+2)+"]/td["+(nCellIndex+1)+"]/"; selenium.click(strXPath); selenium.doubleClick(strXPath); strXPath = "//select"; Select selStatus = new Select(webDriver.findElement(By.xpath(strXPath))); List&lt;WebElement&gt; we = selStatus.getOptions(); for(int i = 0; i&lt; we.size();i++) { WebElement wei = we.get(i); System.out.println("Options : "+wei.getText().toString()); if(wei.getText().toString().equals(strValue)) { wei.sendKeys(strValue); break; } } } For example : My dropdown have 4 options(Partial,Done,Verified,Delete). If selected value is "Partial" and I am sending key "Done" then it is working fine, but if selected value is "Verified" and I am sending "Done" then system is selecting "Delete". I am not getting its working procedure but I think system is comparing characters. If selected value is "Verified" and I am sending "Partial" then system is selecting "Partial"(working proper). F.Y.I. : My dropdown is invisible until user double click on that element. Please let me know if there is any way to send "String" with sendKeys method. TIA
has title: unable to use sendKeys"sendKeys(CharSequence[]) in the type WebElement is not applicable for the arguments (String)"
answer count: 4
tagged with: selenium-webdriver
score: 2
tagged with: xpath
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/34655130
has answer: http://stackoverflow.com/a/23103335
has comment: http://stackoverflow.com/comment/44507066
type: Question

http://stackoverflow.com/comment/35341166
type: QuestionComment
has text: @Braj sorry, getHeight(); wasnt subject of this question.
type: Comment
comment on: http://stackoverflow.com/q/23116845
score: 0

http://stackoverflow.com/q/22986101
has answer: http://stackoverflow.com/a/23020078
has comment: http://stackoverflow.com/comment/35136738
tagged with: javasound
has comment: http://stackoverflow.com/comment/35135495
has title: Java audio player cuts audio at the end
favorite count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/23020078
type: AnsweredQuestion
tagged with: audio
tagged with: java
has comment: http://stackoverflow.com/comment/35113340
type: Question
has body: Hey there stack overflow. I'm creating a playlist player in Java, so far so good, I got all the logic down and the project is nearing completion. We've been testing the playback by creating some large playlist and just let the thing go from start to end. The playback sounds good, but sometimes the audio is cut off at the end. This happens very rarely. The last x seconds (time varies) are not played. The files im testing with are all PCM wave file of 16 or 24 bit sampling size. Im using the Java sound engine in combination with Java zooms mp3 and ogg spi to support other types of audio files. So far I have this logged a couple of times and my first thought was that the file might be corrupt, this is not the case. I've tried playing the file on its own and it played fully! I've tried to find the problem but i just cant find it. I dont think theres anything wrong with my audio player, im running out of ideas. Here is how i create my audio input stream: public static AudioInputStream getUnmarkableAudioInputStream(Mixer mixer, File file) throws UnsupportedAudioFileException { if (!file.exists() || !file.canRead()) { return null; } AudioInputStream stream; try { stream = getAudioInputStream(file); } catch (IOException e) { logger.error("failed to retrieve stream from file", e); return null; } AudioFormat baseFormat = stream.getFormat(); DataLine.Info info = new DataLine.Info(SourceDataLine.class, baseFormat); boolean supportedDirectly = false; if (mixer == null) { supportedDirectly = AudioSystem.isLineSupported(info); } else { supportedDirectly = mixer.isLineSupported(info); } // compare the AudioFormat with the desired one if (baseFormat.getEncoding() != AudioFormat.Encoding.PCM_SIGNED || !supportedDirectly) { AudioFormat decodedFormat = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, baseFormat.getSampleRate(), 16, baseFormat.getChannels(), baseFormat.getChannels() * 2, baseFormat.getSampleRate(), false); // convert the audio format to the supported one if (AudioSyste…
answer count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/35205678
comment on: http://stackoverflow.com/q/23042803
type: Comment
has text: How are you using the AAR in the other project?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35111543
type: Comment
type: QuestionComment
has text: you cant really do this in the pointcut around `new`. its unrelated to assignment.
comment on: http://stackoverflow.com/q/22984781
score: 0

http://stackoverflow.com/q/23031999
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40759727
has comment: http://stackoverflow.com/comment/35187617
has comment: http://stackoverflow.com/comment/40759707
tagged with: rotten-tomatoes
has comment: http://stackoverflow.com/comment/40759685
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Parsing JSON data from Rotten Tomatoes
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26023202
has comment: http://stackoverflow.com/comment/40759551
has comment: http://stackoverflow.com/comment/35189226
has body: I am parsing this JSON data from Rotten Tomatoes website. I am just trying to get the genres array and put it in a toast. But no toast is coming. Here is my code: public class MovieInfo extends Activity { private static final String API_KEY = "xxxxxxxxxxxxxxxxxxxxxxx"; String[] Genres; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.movieinfo); String MovieID = getIntent().getExtras().getString("MovieID"); new RequestTask().execute("http://api.rottentomatoes.com/api/public/v1.0/movies/"+MovieID+".json?apikey=" + API_KEY); } private class RequestTask extends AsyncTask&lt;String, String, String&gt; { // make a request to the specified url @Override protected String doInBackground(String... uri) { HttpClient httpclient = new DefaultHttpClient(); HttpResponse response; String responseString = null; try { // make a HTTP request response = httpclient.execute(new HttpGet(uri[0])); StatusLine statusLine = response.getStatusLine(); if (statusLine.getStatusCode() == HttpStatus.SC_OK) { // request successful - read the response and close the connection ByteArrayOutputStream out = new ByteArrayOutputStream(); response.getEntity().writeTo(out); out.close(); responseString = out.toString(); } else { // request failed - close the connection response.getEntity().getContent().close(); throw new IOException(statusLine.getReasonPhrase()); } } catch (Exception e) { Log.d("Test", "Couldn't make a successful request!"); } return responseString; } @Override protected void onPostExecute(String response) { super.onPostExecute(response); if (response != null) { try { // convert the String response to a JSON object, // because JSON is the response format Rotten Tomatoes uses JSONObject jsonResponse = new JSONObject(response); // fetch the array of movies in the response JSONArray genres = jsonResponse.getJSONArray("genres"); Genres = new String[genres.length()]; for (int i = 0; i &lt; genres.length(); i++) { JSONObject…
score: 0
has comment: http://stackoverflow.com/comment/40759477
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/35188497
favorite count: 0
has comment: http://stackoverflow.com/comment/35187999

http://stackoverflow.com/a/23039801
has comment: http://stackoverflow.com/comment/35200841
score: 0
type: AcceptedAnswer
has body: You can use this regex Pattern p = Pattern.compile("^(\"[^\"]+?\"-[a-z]-)+\"[^\"]+?\"$"); As you said: "It begins with a string of characters in quotes then followed by a single lowercase letter surrounded by minus signs and must end with a string of characters in quotes".
has comment: http://stackoverflow.com/comment/35201271
accepted answer of: http://stackoverflow.com/q/23039756
type: Answer
answers question: http://stackoverflow.com/q/23039756
has comment: http://stackoverflow.com/comment/35200889
has comment: http://stackoverflow.com/comment/35201681
has comment: http://stackoverflow.com/comment/35201369
has comment: http://stackoverflow.com/comment/35201275

http://stackoverflow.com/a/23101310
downvote count: 1
score: 14
has comment: http://stackoverflow.com/comment/35338329
has body: The interface is not initialized because the constant field InterfaceType.init , which is being initialized by non constant value (method call), is not used anywhere. It is known at compile time that constant field of interface is not used anywhere, and the interface is not containing any default method (In java-8) so there is no need to initialize or load the interface. Interface will be initialized in following cases, constant field is used in your code. Interface contains a default method (Java 8) In case of Default Methods, You are implementing InterfaceType. So, If InterfaceType will contain any default methods, It will be INHERITED (used) in implementing class. And Initialization will be into the picture. But, If you are accessing constant field of interface (which is initialized in normal way), The interface initialization is not required. Consider following code. public class Example { public static void main(String[] args) throws Exception { InterfaceType foo = new InterfaceTypeImpl(); System.out.println(InterfaceType.init); foo.method(); } } class InterfaceTypeImpl implements InterfaceType { @Override public void method() { System.out.println("implemented method"); } } class ClassInitializer { static { System.out.println("static initializer"); } } interface InterfaceType { public static final ClassInitializer init = new ClassInitializer(); public void method(); } In above case, Interface will be initialized and loaded because you are using the field InterfaceType.init. I am not giving the default method example as you already given that in your question. Java language specification and example is given in JLS 12.4.1 (Example does not contain default methods.) I can not find JLS for Default methods, there may be two possibilities Java people forgot to consider the case of default method. (Specification Doc bug.) They just refer the default methods as non-constant member of interface. (But mentioned no where, again Specification Doc bug.)
has comment: http://stackoverflow.com/comment/35328804
upvote count: 15
has comment: http://stackoverflow.com/comment/35336170
has comment: http://stackoverflow.com/comment/35393770
answers question: http://stackoverflow.com/q/23096084
has comment: http://stackoverflow.com/comment/35394964
type: Answer
has comment: http://stackoverflow.com/comment/35335943

http://stackoverflow.com/comment/35113365
comment on: http://stackoverflow.com/q/22991726
type: Comment
type: QuestionComment
has text: The guy responsible for printing "and goes after green box" should be in the guy iterating over the list because he has that information. He knows about the queue.
score: 2

http://stackoverflow.com/comment/35123885
type: Comment
type: QuestionComment
has text: What Spring configuration are you using to include the properties file?
score: 0
comment on: http://stackoverflow.com/q/22996446

http://stackoverflow.com/a/23070100
has comment: http://stackoverflow.com/comment/35265019
has comment: http://stackoverflow.com/comment/35264979
has comment: http://stackoverflow.com/comment/35290462
has comment: http://stackoverflow.com/comment/35290407
answers question: http://stackoverflow.com/q/22980564
score: 0
type: Answer
has body: You can't download Google docs the same way you download an Office file. Even the Google docs inside of the Google Drive are actually just links. What you have to do instead is learn how to interface with the API. This will allow you to manipulate Google docs. https://developers.google.com/drive/

http://stackoverflow.com/q/23069397
has body: So I am creating a program that requires that I get the names of objects from a jList in a java GUI. I then create an object with the name as a property of that object. The code for the object class follows: OBJECT CLASS: class Team{ String name, status; int wins, losses; public Team(String n, int w, int l, String s){ this.setName(n); this.setWins(w); this.setLosses(l); this.setStatus(s); } public Team(){ } public void setName(String n){ this.name = n; } public void setWins(int w){ this.wins = w; } public void setLosses(int l){ this.losses = l; } public void setStatus(String s){ if(this.getWins() &gt;= 20){ this.status = "March Madness"; } else if(this.getWins() &lt;= 19 &amp;&amp; this.getWins() &gt;= 15){ this.status = "NIT"; } else{ this.status = "See You Next Year"; } } public String getName(){ return this.name; } public int getWins(){ return this.wins; } public int getLosses(){ return this.losses; } public String getStatus(){ return this.status; } } Here is where I initialize the list: private void initComponents() { ConfTeamPanel = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); listConf = new javax.swing.JList(); confLabel = new javax.swing.JLabel(); NonConfPanel = new javax.swing.JPanel(); jScrollPane2 = new javax.swing.JScrollPane(); listNonConf = new javax.swing.JList(); Now here is the code where the nullPointerException is getting thrown. It is within the for loop where I am trying to set the name of the objects in the array. listConf is the variable name of the jList. Team[] cTeams = new Team [listConf.getModel().getSize()]; Team[] nTeams = new Team [listNonConf.getModel().getSize()]; for(int t = 0; t &lt;= listConf.getModel().getSize(); t++){ cTeams[t] = new Team(); cTeams[t].name = listConf.getSelectedValue().toString(); }; And here is the stack trace. Line 615 is the line that is within the for loop where I am trying to set the name of the objects in the array. Line 738 is where I press the button that calls the method. Line 7…
downvote count: 1
linked to: http://stackoverflow.com/q/10171896
favorite count: 0
has answer: http://stackoverflow.com/a/23069597
accepted answer: http://stackoverflow.com/a/23069597
has answer: http://stackoverflow.com/a/23069471
has comment: http://stackoverflow.com/comment/35254676
has comment: http://stackoverflow.com/comment/35254704
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35255204
upvote count: 0
has comment: http://stackoverflow.com/comment/35254624
tagged with: java
possible better answer: http://stackoverflow.com/a/23069471
has comment: http://stackoverflow.com/comment/35254638
has comment: http://stackoverflow.com/comment/35254708
has title: NullPointerException - Not sure why is is throwing that error
type: Question
linked to: http://stackoverflow.com/q/8105184
tagged with: object
score: -1
has comment: http://stackoverflow.com/comment/35254661
tagged with: nullpointerexception
answer count: 2
has comment: http://stackoverflow.com/comment/35254978

http://stackoverflow.com/comment/35323333
type: AnswerComment
has text: @igniter um yeah, I got ahead of myself see update. You define class as transactional using an annotation - no need to open a transaction in code.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23108258

http://stackoverflow.com/a/23016386
answers question: http://stackoverflow.com/q/23015969
downvote count: 0
has body: So in your recursive call you will need to only pass an array half the length of the array. You could create a new array with only the first or second half of your array: http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#arraycopy%28java.lang.Object,%20int,%20java.lang.Object,%20int,%20int%29 The other option is to use max and min integers to mark what section of the array you are looking at. If your searchNum is less than the value your are looking at, set max to your start variable. If search Num less than the number you are looking at, set min to start. At the beginning your method, if your current start is &lt;=max or >= min return -1 because you would be searching where you had already looked before therefore the number you are looking for isn't in the array.
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/22978664
has comment: http://stackoverflow.com/comment/35097146
has comment: http://stackoverflow.com/comment/35132166
type: Question
tagged with: indexing
tagged with: java
has body: I am facing issue while binding my form with an ArrayList of objects which contains maximum 500 elements but I found out that Play does not support indices greater than 255. I found a solution in some post which recommends to use Hashmap instead of List. But for me now its very complicated to change my entire data structure from List to HashMap. Can anybody suggest me the solution?
has title: Play framework cannot handle list index greater than 255. How to handle it?
score: 0
type: UnansweredQuestion
tagged with: playframework-2.1
answer count: 0

http://stackoverflow.com/a/23021874
answers question: http://stackoverflow.com/q/23021768
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: You can't know for sure. The behavior is not specified or guaranteed. But you should not care too much about that. What you should care is that the memory is reclaimed. If security is your issue, well it shouldn't be. Security cases should be treated when encountered. Rewriting the entire memory with 0 or garbage would make exit really slow. What happens is the memory occupied by the string is freed on exit. If the object implements a finalize() method, it may be called. Also, you can invoke the Garbage collector manually using System.gc(); The following is an extract from the Sun specifications. The specification for the Java platform makes very few promises about how garbage collection actually works. Here is what the Java Virtual Machine Specification (JVMS) has to say about memory management. The heap is created on virtual machine start-up. Heap storage for objects is reclaimed by an automatic storage management system (known as a garbage collector); objects are never explicitly deallocated. The Java virtual machine assumes no particular type of automatic storage management system, and the storage management technique may be chosen according to the implementor's system requirements.1 While it can seem confusing, the fact that the garbage collection model is not rigidly defined is actually important and useful-a rigidly defined garbage collection model might be impossible to implement on all platforms. Similarly, it might preclude useful optimizations and hurt the performance of the platform in the long term. Although there is no one place that contains a full definition of required garbage collector behavior, much of the GC model is implicitly specified through a number of sections in the Java Language Specification and JVMS. While there are no guarantees about the exact process followed, all compliant virtual machines share the basic object lifecycle described in this chapter.

http://stackoverflow.com/q/22999220
accepted answer: http://stackoverflow.com/a/22999353
type: Question
has comment: http://stackoverflow.com/comment/35127238
has comment: http://stackoverflow.com/comment/35127373
tagged with: arrays
downvote count: 0
has title: Comparing Distance within an Array
answer count: 1
has answer: http://stackoverflow.com/a/22999353
favorite count: 0
upvote count: 1
has body: I have a question in comparing values within an Array and drawing a line to the points that have the largest distance. Point2D[] pts = new Point2D[N]; for (int i = 0; i &lt; pts.length; i++){ pts[i] = new Point2D(Math.random(), Math.random()); StdDraw.setPenColor(StdDraw.RED); StdDraw.setPenRadius(0.008); pts[i].draw(); if(SOMETHING){ StdDraw.setPenColor(StdDraw.BLACK); StdDraw.setPenRadius(0.002); pts[i].drawTo(SOMETHING); so far that's part of my code that generates the random points, but I have no clue how to approach measuring the distance and then drawing it. Would I have to create a nested loop? Any advice would be great!
has comment: http://stackoverflow.com/comment/35127301
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/35286095
comment on: http://stackoverflow.com/q/23087082
score: 4
type: Comment
has text: I dont see a step 4, I think you duplicated your links to the pics. Only a step 6, and part of what I assume is step 5.
type: QuestionComment

http://stackoverflow.com/comment/35311877
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23101347
has text: Can I do it dynamically? Not in POJO? Can I do it in my Controller class?

http://stackoverflow.com/q/23017206
accepted answer: http://stackoverflow.com/a/23017597
has comment: http://stackoverflow.com/comment/80681117
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35159711
tagged with: java
has answer: http://stackoverflow.com/a/23017319
has answer: http://stackoverflow.com/a/23017597
has answer: http://stackoverflow.com/a/46866514
has comment: http://stackoverflow.com/comment/35160565
type: Question
has comment: http://stackoverflow.com/comment/35160519
has comment: http://stackoverflow.com/comment/35159643
has comment: http://stackoverflow.com/comment/35159715
has answer: http://stackoverflow.com/a/23017295
has answer: http://stackoverflow.com/a/23017338
score: 0
has comment: http://stackoverflow.com/comment/35160199
has answer: http://stackoverflow.com/a/23017335
upvote count: 1
downvote count: 1
answer count: 7
favorite count: 0
has body: I am trying to make a program where it lists all the numbers between 100-1000 that are divisible by 5 or 6. This is the code I used: public class divisibleBy5and6 { public static void main (String[] args) { j = 1; int number = 100; while (number &lt; 1001) { if (number % 6 == 0 || number % 5 == 0) { System.out.print(number + ", "); number++; j++; } if (j % 10 == 0 &amp;&amp; j != 0) { System.out.println(); j++; } else { number++; } } I used int j to make it so there are 9 per row. This is my output: 100, 102, 105, 108, 110, 114, 120, 125, 130, 132, 135, 138, 140, 144, 150, 155, 160, 162, 165, 168, 170, 174, 180, 185, 190, 192, 195, 198, 200, 204, 210, 215, 220, 222, 225, 228, 230, 234, 240, 245, 250, 252, 255, 258, 260, 264, 270, 275, 280, 282, 285, 288, 290, 294, 295, 300, 305, 310, 312, 315, 318, 320, 324, 325, 330, 335, 340, 342, 345, 348, 350, 354, 355, 360, 365, 370, 372, 375, 378, 380, 384, 385, 390, 395, 400, 402, 405, 408, 410, 414, 415, 420, 425, 430, 432, 435, 438, 440, 444, 445, 450, 455, 460, 462, 465, 468, 470, 474, 475, 480, 485, 490, 492, 495, 498, 500, 504, 505, 510, 515, 520, 522, 525, 528, 530, 534, 535, 540, 545, 550, 552, 555, 558, 560, 564, 565, 570, 575, 580, 582, 585, 588, 590, 594, 595, 600, 605, 610, 612, 615, 618, 620, 624, 625, 630, 635, 640, 642, 645, 648, 650, 654, 655, 660, 665, 670, 672, 675, 678, 680, 684, 685, 690, 695, 700, 702, 705, 708, 710, 714, 715, 720, 725, 730, 732, 735, 738, 740, 744, 745, 750, 755, 760, 762, 765, 768, 770, 774, 775, 780, 785, 790, 792, 795, 798, 800, 804, 805, 810, 815, 820, 822, 825, 828, 830, 834, 835, 840, 845, 850, 852, 855, 858, 860, 864, 865, 870, 875, 880, 882, 885, 888, 890, 894, 895, 900, 905, 910, 912, 915, 918, 920, 924, 925, 930, 935, 940, 942, 945, 948, 950, 954, 955, 960, 965, 970, 972, 975, 978, 980, 984, 985, 990, 995, 1000, This obviously isn't right because I am missing numbers like 115. What am I doing wrong?
has answer: http://stackoverflow.com/a/23017348
possible better answer: http://stackoverflow.com/a/23017335
has title: Divisible by 5 or 6
has comment: http://stackoverflow.com/comment/35159641

http://stackoverflow.com/comment/35254155
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23069154
has text: You can't declare methods within methods/constructors.
type: Comment

http://stackoverflow.com/comment/35287362
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23074844
has text: after parse `orderDate`, I will cast it to `java.sql.Date`: `new java.sql.Date(orderDate.getTime())`. The output of `System.out.print(orderDate.getTime())` is `04/15/2014 00:00:00`

http://stackoverflow.com/comment/35095352
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22981571
has text: Are your host, port and SID right; matching how you were able to connect as `scott`?
type: AnswerComment

http://stackoverflow.com/q/23053341
tagged with: jsp
has body: I pointed to favicon.ico file, as shown below, which is present in my local project folder. But, on the browser tab it is not displaying rather displaying a blurred image. My favicon in present in a jar file. Hence, I used &lt;c:url/&gt; for path by adding &lt;mvc:resources/&gt; in my spring context file. &lt;link href="&lt;c:url value="/resources/img/favicon.ico" /&gt;" rel="shortcut icon" type="image/x-icon" /&gt; Can someone tell me where it is going wrong?
favorite count: 0
type: UnansweredQuestion
tagged with: spring-mvc
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23053491
has title: Unable to display favicon on any browser tab
tagged with: jstl
answer count: 1
downvote count: 0

http://stackoverflow.com/q/22995730
has title: Method can not be referenced from a static context
type: Question
has answer: http://stackoverflow.com/a/22995883
tagged with: bluej
answer count: 2
has answer: http://stackoverflow.com/a/22995882
upvote count: 1
has body: I'm getting this error: non-method setBounds(int,int,int,int) cannot be referenced from a static context My code is below: import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JCheckBox; import javax.swing.JRadioButton; import java.awt.*; import java.awt.event.*; import java.util.*; /** * Write a description of class GUI here. * * @author Ibrahim Y. Hmood * @version 04.02.14 */ public class GUI extends JFrame implements ActionListener { /** * Identify the components for the window */ JPanel contentPane; JLabel lblLastName; JLabel lblFirstName; JLabel lblStudentID; JTextField txtLastName; JTextField txtFirstName; JTextField txtStudentID; JButton btnSubmit; JLabel lblStoreFirstName; JLabel lblStoreLastName; JLabel lblStoreStudentID; JTextField txtStorestudentID; JTextArea txaAll; JCheckBox chkBox1; CheckBoxListener myListener = null; /** * Constructor for objects of class GUI */ public GUI() { /** * Create the panel, its components and add them to the panel */ contentPane = new JPanel (null); lblLastName = new JLabel ("Enter Last Name"); lblFirstName = new JLabel ("Enter First Name"); lblStudentID = new JLabel ("Enter Student ID"); txtLastName = new JTextField (); txtFirstName = new JTextField(); txtStudentID = new JTextField(); btnSubmit = new JButton ("Submit Info"); lblStoreFirstName = new JLabel (); lblStoreLastName = new JLabel (); lblStoreStudentID = new JLabel (); txaAll= new JTextArea (); chkBox1 = new JCheckBox ("Check box one"); chkBox1.setBounds(200,180,150,20); JRadioButton Label = new JRadioButton (); JRadioButton.setBounds (100,200, 150, 20); lblLastName.setBounds(25, 25, 590, 20); lblFirstName.setBounds (25, 65,590, 20); lblStudentID.setBounds (25, 105,590, 20); txtLastName.setBounds(140,25,150,20); txtFirstName.setBounds(140,65,150,20); txtStudentID.setBounds(140,105,150,20); txaAll.setBounds(140,345,250,250); btnSubmi…
favorite count: 0
has comment: http://stackoverflow.com/comment/35121076
downvote count: 5
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/290884
linked to: http://stackoverflow.com/q/290884
tagged with: java
score: -4

http://stackoverflow.com/a/22970918
score: 0
type: Answer
has body: Consider using java.util.Timer which will allow you to schedule a TimerTask on a specified interval. It's easy to subclass TimerTask to do whatever you want. You can then schedule many different tasks right off the bat on regular intervals, or you can schedule a single task, and then delegate to that Task scheduling the next one, and so on.
answers question: http://stackoverflow.com/q/22970804

http://stackoverflow.com/comment/35281730
type: AnswerComment
comment on: http://stackoverflow.com/a/23084527
has text: Would *you* actually do this for a list? You've written more code for zero noticeable benefit. More code is more bugs (or at least more code for bugs to hide in) and more do-nothing code to maintain and skip over while reading.
type: Comment
score: 1

http://stackoverflow.com/q/23062874
type: Question
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35243373
accepted answer: http://stackoverflow.com/a/23063591
has comment: http://stackoverflow.com/comment/35242751
answer count: 1
downvote count: 0
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/35242446
favorite count: 0
has body: I exported my plugin project as a Product and when I run the product (eclipse application), the main plugin (org.example.framework.core) cannot find a class defined in another plugin (org.example.abc) which implements an extension to an extension point provided by the main plugin. The class is one of the elements defined in the extension. However, when I run the project in Eclipse, everything runs fine! Here is the log (atvste.ppt.ptfwDescription.abc.decoderInfo is a package in org.example.abc plugin): 0 [Worker-2] ERROR org.example.framework.core.ptfw.codec.decode.MsgDecoderInfo org.example.framework.core.ptfw.codec.decode.MsgDecoderInfo.createInstance(MsgDecoderInfo.java:114) : can not create class for :atvste.ppt.ptfwDescription.abc.decoderInfo.MsgDecoderInfoABC atvste.ppt.ptfwDescription.abc.decoderInfo.MsgDecoderInfoABC cannot be found by org.example.framework.core_1.0.0.201404111439 java.lang.ClassNotFoundException: atvste.ppt.ptfwDescription.abc.decoderInfo.MsgDecoderInfoABC cannot be found by org.example.framework.core_1.0.0.201404111439 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.example.framework.core.ptfw.codec.decode.MsgDecoderInfo.createInstance(MsgDecoderInfo.java:104) at org.example.framework.core.ptfw.codec.decode.DecoderInfo.&lt;init&gt;(DecoderInfo.java:56) at org.example.framework.core.ptfw.codec.decode.DecoderInfo.createInstance(DecoderInfo.java:125) at org.example.framework.core.ptfw.codec.ptfwObjectsFactory.decoderInfoItf_createInstance(ptfwObjectsFactory.java:200) at org.example.framework.persistenc…
score: 2
has title: Class defined in another plugin cannot be found by the main plugin - Eclipse Product
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/23063591

http://stackoverflow.com/comment/35189848
comment on: http://stackoverflow.com/a/23028175
type: AnswerComment
score: 0
has text: Thanks it works now! How can i Update a Maven Project from the newest Source of the Github Project?
type: Comment

http://stackoverflow.com/comment/35361576
comment on: http://stackoverflow.com/q/23127392
score: 0
type: Comment
type: QuestionComment
has text: If you have trouble working out that in the constructor `Random(long seed)` the argument you give is the seed, you have to go back to basics of Java. http://docs.oracle.com/javase/7/docs/api/java/util/Random.html#Random(long)

http://stackoverflow.com/comment/35271464
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23077773
score: 0
has text: Yes i am using selectedItems="@bind(vm.adminListboxViewModel.selectedListItem)" and mutiple="true" checkbox="true"

http://stackoverflow.com/q/23120545
tagged with: java
has comment: http://stackoverflow.com/comment/76128086
has comment: http://stackoverflow.com/comment/35346393
type: Question
tagged with: rundeck
linked to: http://stackoverflow.com/q/10590497
has comment: http://stackoverflow.com/comment/35346516
duplicate of: http://stackoverflow.com/q/11663945
linked to: http://stackoverflow.com/q/30259452
score: 0
tagged with: api
linked to: http://stackoverflow.com/q/12237894
linked to: http://stackoverflow.com/q/11663945
accepted answer: http://stackoverflow.com/a/23121514
answer count: 1
has body: I need to call some Java API from Django, specifically Rundeck API. I looked around and django-jython is no longer supported. What other ways can I do it? I have looked at rundeckrun (a Python client library for Rundeck API but I need to only use the Rundeck native Java API). Assuming Rundeck supports REST API, would something like django-tastypie work? Edit: As per Consuming a RESTful API with Django, tastypie creates REST API and not consumes it. Apparently, the regular urllib, requests module, etc. does the trick.
has title: Calling Java API from Django
tagged with: rest
linked to: http://stackoverflow.com/q/12732375
has comment: http://stackoverflow.com/comment/41797124
has answer: http://stackoverflow.com/a/23121514
tagged with: django
type: AnsweredQuestion

http://stackoverflow.com/a/23111523
upvote count: 1
has body: Unfortunately HashMap won't distinguish between a null value and no entry when performing a HashMap.get(). Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. Have you checked whether the key is contained in the map using HashMap.containsKey() ? A return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.
has comment: http://stackoverflow.com/comment/35331054
accepted answer of: http://stackoverflow.com/q/23111471
has comment: http://stackoverflow.com/comment/35332773
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23111471
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35331456
type: Answer

http://stackoverflow.com/a/23123188
downvote count: 1
score: 0
has body: Still not too sure what the problem was there, probably something I overlooked but I got it working the by using the processing.core.PApplet loadStrings() function: Code:(basicPapplet extends processing.core.PApplet) public String[] loadTranslations(String trans){ String name = "data/translations/"+trans+".txt"; basicPapplet bp = new basicPapplet(); return bp.loadStrings(name); }
answers question: http://stackoverflow.com/q/23122863
type: Answer
has comment: http://stackoverflow.com/comment/81798262
upvote count: 1

http://stackoverflow.com/a/23069688
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23069581
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23069581
has body: I think something like the following should work: (?&lt;!")//(?!\*|span).* Example: http://rubular.com/r/vXQWctfC3t
type: Answer
score: 2

http://stackoverflow.com/comment/35105667
has text: You can likely use 'ant builders' to just have eclipse call your ant scripts to build the code.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22987790
score: 0

http://stackoverflow.com/comment/35281287
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23083654
has text: A callback for what, what do you want to know exactly

http://stackoverflow.com/comment/35729506
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23293352
has text: there are lots of other fields on the form, it is not a good practice.
type: AnswerComment

http://stackoverflow.com/q/23001661
score: 5
has body: It's not clear from the google-http-java-client* docs how you would go about posting a form that has a file field. For example I'm trying to print a document using the Google Cloud Print API: HttpRequestFactory httpRequestFactory = getHttpRequestFactory(); Map&lt;String, Object&gt; parameters = Maps.newHashMap(); parameters.put("printerId", printRequest.getPrinterId()); parameters.put("title", printRequest.getTitle()); parameters.put("contentType", printRequest.getContentType()); parameters.put("ticket", new Gson().toJson(printRequest.getOptions())); MultipartContent content = new MultipartContent(); content.addPart(new MultipartContent.Part(new UrlEncodedContent(parameters))); content.addPart(new MultipartContent.Part( new FileContent(printRequest.getContentType(), printRequest.getFile()))); try { HttpResponse response = httpRequestFactory.buildPostRequest( SubmitUrl, content).execute(); System.out.println(IOUtils.toString(response.getContent())); } catch (IOException e) { String message = String.format(); System.out.println("Error submitting print job: " + e.getMessage()); } Unfortunately this doesn't work. The API returns the error "Printer Id required for this request." which seems to me like the request isn't properly formed. What am I doing wrong? * I'm specifically using the google-http-java-client as it handles automatic refreshing of OAuth tokens etc for me. Please don't reply with solutions that involve using other HTTP clients.
upvote count: 5
accepted answer: http://stackoverflow.com/a/23002408
downvote count: 0
answer count: 1
favorite count: 0
tagged with: google-http-client
tagged with: google-api
has title: Post multipart form with google-http-java-client
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23002408
tagged with: java
type: Question

http://stackoverflow.com/comment/35158621
type: Comment
score: 0
has text: Either you can write to file directly in traversal methods or make your traversal method return a `List` of nodes , which you can write to file outside of traversal method.
type: AnswerComment
comment on: http://stackoverflow.com/a/23016060

http://stackoverflow.com/a/23122326
has comment: http://stackoverflow.com/comment/35386983
has body: The main problem is, the frame isn't actually visible. For example, after I cleaned up your code a little I get... r1 = java.awt.Rectangle[x=1280,y=820,width=0,height=0] r2 = java.awt.Rectangle[x=1280,y=820,width=0,height=0] d1 = java.awt.Dimension[width=0,height=0] d2 = java.awt.Dimension[width=0,height=0] (took out the call to setBounds and few other things). Based on the fact that the window hasn't been realised yet (not shown), it's not surprising to me that the sizes don't actually change, because until you show the window, it has no context of which GraphicsDevice it will be shown on, therefore no means by which it can determine what the maximum size actually would be... If you call setVisible(true) in the constructor, before calling setExtendedState(JFrame.MAXIMIZED_BOTH) I get... r1 = java.awt.Rectangle[x=1214,y=801,width=132,height=38] r2 = java.awt.Rectangle[x=-8,y=32,width=2576,height=1576] d1 = java.awt.Dimension[width=132,height=38] d2 = java.awt.Dimension[width=2576,height=1576] Side notes... Don't use null layouts. Pixel perfect layouts are an illusion in modern UI design, you have no control over fonts, DPI, rendering pipelines or other factors that will change the way that you components will be rendered on the screen. Swing was designed to work with layout managers to overcome these issues. If you insist on ignoring these features and work against the API design, be prepared for a lot of headaches and never ending hard work... Don't mix heavy and light weight components, AWT and Swing components don't play well together, instead of using java.awt.List try using javax.swing.JList instead
has comment: http://stackoverflow.com/comment/35382143
answers question: http://stackoverflow.com/q/23104247
accepted answer of: http://stackoverflow.com/q/23104247
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35359560
has comment: http://stackoverflow.com/comment/35361983
type: Answer

http://stackoverflow.com/comment/35191327
type: Comment
type: QuestionComment
has text: Historically, many Arabic PDF files were written in physical order instead of logical order. You need to detect the lines and manually reverse the characters to recover from this, it's a PITA.
score: 0
comment on: http://stackoverflow.com/q/23034668

http://stackoverflow.com/comment/35115728
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22979760
has text: I also needed a sessionFactory bean ` ... ` and a transaction manager bean `<tx:annotation-driven transaction-manager="transactionManager" /> <property name="sessionFactory" ref="sessionFactory" /> `

http://stackoverflow.com/a/23097769
has comment: http://stackoverflow.com/comment/35306135
has comment: http://stackoverflow.com/comment/35306057
has comment: http://stackoverflow.com/comment/35306213
has body: If you want to restart the for loop then do this: for (int j = 0; j &lt; numberOfFoods; j++) { System.out.println(gerbilId[index].substring(index) + " eats how many " + foodNames[j] + "s per day"); int amountOfFood = keyboard.nextInt(); if (amountOfFood &gt; foodMax[j]) { System.out.println("Error. Please input a valid amount of food"); j = -1; //instead of break } else { gerbilConsumption[index] = amountOfFood; } } The variable j will become 0 in the next iteration and the loop restarts. On the other hand, if you only want to continue the for loop then use continue in place of break. But this is pointless in this case as that will happen automatically. As it's unclear what is needed here, if you want to stay in the same iteration level, I'd advise you use a while loop inside. for (int j = 0; j &lt; numberOfFoods; j++) { System.out.println(gerbilId[index].substring(index) + " eats how many " + foodNames[j] + "s per day"); int amountOfFood = keyboard.nextInt(); while (amountOfFood &gt; foodMax[j]) { System.out.println("Error. Please input a valid amount of food"); amountOfFood = keyboard.nextInt(); } gerbilConsumption[index] = amountOfFood; }
answers question: http://stackoverflow.com/q/23097696
type: Answer
has comment: http://stackoverflow.com/comment/35306228
has comment: http://stackoverflow.com/comment/35306192
upvote count: 2
has comment: http://stackoverflow.com/comment/35305949
has comment: http://stackoverflow.com/comment/35305918
downvote count: 1
score: 1

http://stackoverflow.com/comment/35253723
type: AnswerComment
has text: If your explicitly indicated dependency was also a transitive `providedCompile` dependency, this would be expected. If not, I'd need a reproducible example to investigate.
score: 0
comment on: http://stackoverflow.com/a/23000333
type: Comment

http://stackoverflow.com/a/23009406
downvote count: 0
answers question: http://stackoverflow.com/q/23008936
score: 1
type: Answer
upvote count: 1
has body: If you have a view where you draw the squares then put a onClick() listener in that view and inside the onClick() do like this: (this is taken from a Sudoku game I made) @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: // keep where the user first touch the screen touchedX = (int) event.getX() / wid33; // the square width touchedY = (int) event.getY() / hei33; // the square height break; case MotionEvent.ACTION_UP: // see if the touched square is the same int X = (int) event.getX() / wid33; int Y = (int) event.getY() / hei33; if (X == touchedX &amp;&amp; Y == touchedY) { // the square is the same, do what you have to do } break; case MotionEvent.ACTION_CANCEL: touchedX = -1; touchedY = -1; break; default: return super.onTouchEvent(event); } return true; }

criteria
tags question: http://stackoverflow.com/q/23039965
tags question: http://stackoverflow.com/q/23111813
tag name: criteria
tags question: http://stackoverflow.com/q/23044565
tags question: http://stackoverflow.com/q/23082397
type: Tag
tags question: http://stackoverflow.com/q/23088411

http://stackoverflow.com/q/23022110
has comment: http://stackoverflow.com/comment/35169252
has comment: http://stackoverflow.com/comment/35170445
has comment: http://stackoverflow.com/comment/35169298
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35169177
has comment: http://stackoverflow.com/comment/35183015
type: Question
tagged with: java
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35170524
has answer: http://stackoverflow.com/a/23022717
has title: Java goes OutOfMemory even with enough RAM
has body: I have an app that uses the following jvm options: -Xmx512m -Xms256m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:MaxGCPauseMillis=2 -XX:MaxDirectMemorySize=1G I run it on Windows 7 x64 with 8gb RAM. And when the task manager says that there's 60% of RAM is in use, it becomes impossible to run my program, Java says "Out of memory". Even though in theory I still have almost 3gb of free RAM left. Below are screenshots of profiling my project in NetBeans (until it suddenly crashes on a random spot). What could cause these problems? Is my program really so expensive? (source: SSmaker.ru) (source: SSmaker.ru)
tagged with: windows

http://stackoverflow.com/comment/35180311
has text: Have you used a tool to get that number?
type: Comment
comment on: http://stackoverflow.com/a/23017736
score: 0
type: AnswerComment

http://stackoverflow.com/a/25949661
answers question: http://stackoverflow.com/q/23073439
type: AcceptedAnswer
score: 76
has comment: http://stackoverflow.com/comment/54367031
has body: Try this code: @Override public void failure(RetrofitError error) { String json = new String(((TypedByteArray)error.getResponse().getBody()).getBytes()); Log.v("failure", json.toString()); } with Retrofit 2.0 @Override public void onFailure(Call&lt;Example&gt; call, Throwable t) { String message = t.getMessage(); Log.d("failure", message); }
type: Answer
has comment: http://stackoverflow.com/comment/63914880
accepted answer of: http://stackoverflow.com/q/23073439
upvote count: 77
has comment: http://stackoverflow.com/comment/64777309
downvote count: 1

http://stackoverflow.com/a/23120606
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23120370
has body: I don't know much about the specifics of the Java implementation. However, based on my experience working with a compiler for a different language, I think that since a class can extend only one abstract class but can implement multiple interfaces, the process of searching for the right method may take slightly longer since there's some additional complexity in the data structures needed to support dynamic dispatch. So this result doesn't surprise me.
score: 1
downvote count: 0

http://stackoverflow.com/q/23109985
tagged with: spring
has body: After consulting 33-35 lines of code from: https://github.com/springinpractice/sip04/blob/04/src/main/webapp/WEB-INF/jsp/users/registrationForm.jsp. <form:errors path="username"> <form:errors path="username" htmlEscape="false" /> </form:errors> As soon as I save that file, I get an error on the second line under "username" in MyEclipse: Duplicate local variable messages. Why this error happens and how to solve it. But that jsp page can be rendered without any error. EDIT I am trying to do form validation, this is my code: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <spring:message code="user.registration.heading"/> <form:form action="" modelAttribute="user" method="POST"> <form:errors path="*"> <spring:message code="error.global"/> </form:errors> <spring:message code="user.registration.label.username" /> <form:input path="username" /> <form:errors path="username"> <form:errors path="username" htmlEscape="false" /> </form:errors> password: <form:input path="password" /> <form:errors path="password"/> confirm password: <form:input path="confirmPassword" /> <form:errors path="confirmPassword"/> name: <form:input path="name" /> <form:errors path="name"/> email: <form:input path="email" /> <form:errors path="email"/> department: <form:input path="department" /> <form:errors path="department"/>. </form:form> This is the screenshot of that error:
score: 2
downvote count: 0
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/23110231
has comment: http://stackoverflow.com/comment/35326010
tagged with: java
has answer: http://stackoverflow.com/a/23110252
has answer: http://stackoverflow.com/a/68382669
upvote count: 2
answer count: 3
tagged with: jsp
has comment: http://stackoverflow.com/comment/35326121
favorite count: 0
has title: Why "Duplicate local variable messages" here?
has comment: http://stackoverflow.com/comment/35326198

http://stackoverflow.com/comment/35101618
has text: I updated my question now to show which method is used for the query itself. If I understand you correctly, you're saying this method should go in another class?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22983503
score: 0

http://stackoverflow.com/comment/35163103
has text: @SKarthik i am doing this `if (filledForm.hasErrors()) { String loggedInUserEmail = session("email"); return badRequest(views.html.shop.create.render(filledForm, loggedInUserEmail)); }` which loads the form with all the fields filled
comment on: http://stackoverflow.com/q/22991222
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35127720
has text: @user3521306: see edit 2.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22999301

http://stackoverflow.com/q/23053098
upvote count: 1
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23053199
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23053465
type: UnansweredQuestion
tagged with: android
tagged with: checkbox
has title: How to change text size of a checkbox list within an alert dialog
tagged with: android-alertdialog
score: 1
has body: I'm working on an alert dialog that has multiple checkboxes. How do I change the text size of the elements of the checkbox list? (I can change the size of the title and the buttons just fine) boolean[] allBoolean = {true, true, true, true, true, true, true, true}; AlertDialog.Builder prompt = new AlertDialog.Builder(Class.this); prompt.setTitle("Title"); prompt.setMultiChoiceItems(all, allBoolean, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { allBoolean[which] = isChecked; } }); prompt.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //do nothing } }); prompt.setPositiveButton("Select", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //do something } });
has comment: http://stackoverflow.com/comment/35229675
tagged with: java

http://stackoverflow.com/q/22974468
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/35082703
possible better answer: http://stackoverflow.com/a/60107474
has comment: http://stackoverflow.com/comment/35082669
accepted answer: http://stackoverflow.com/a/22974548
tagged with: merge
tagged with: java-8
has title: Merge Two Streams
type: AnsweredQuestion
tagged with: java-stream
upvote count: 14
has comment: http://stackoverflow.com/comment/35082850
tagged with: java
has answer: http://stackoverflow.com/a/22974548
score: 13
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/60107474
has comment: http://stackoverflow.com/comment/35085220
has body: I am trying to implement a method to merge the values in two Streams based on a Comparator for the values. I had a way to do this, where I iterate over the streams and insert the values into a Stream.Builder, but I have not been able to figure out how to make a lazy-evaluated version (the way many stream operations are), so it can deal with infinite streams as well. All I want it to do is perform a single merging pass on the input data, not sort the streams (in fact, it is likely that the streams will be disordered; this disorder needs to be preserved). static Stream&lt;E&gt; merge(Stream&lt;E&gt; first, Stream&lt;E&gt; second, Comparator&lt;E&gt; c) How can I lazily merge two streams like this? If I were doing this with two Queues as input and some Consumer as output, it would be fairly simple: void merge(Queue&lt;E&gt; first, Queue&lt;E&gt; second, Consumer&lt;E&gt; out, Comparator&lt;E&gt; c){ while(!first.isEmpty() &amp;&amp; !second.isEmpty() if(c.compare(first.peek(), second.peek()) &lt;= 0) out.accept(first.remove()); else out.accept(second.remove()); for(E e:first) out.accept(e); for(E e:second) out.accept(e); } But I need to do this with lazy evaluation, and streams. To address the comments, here are some example inputs and the result: Example 1: merge( Stream.of(1, 2, 3, 1, 2, 3), Stream.of(2, 2, 3, 2, 2, 2), Comparator.naturalOrder() ); would return a stream that would produce this sequence: 1, 2, 2, 2, 3, 3, 1, 2, 2, 2, 2, 3 Example 2: merge( Stream.iterate(5, i-&gt;i-1), Stream.iterate(1, i-&gt;i+1), Comparator.naturalOrder() ); would return an infinite (well, an INT_MAX + 5 item) stream that would produce the sequence: 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0, -1 ... As you can see, this is not merely concat(first,second).sort(), since (a) you can't sort infinite streams, and (b) even when you can sort the streams, it does not give the desired result.

http://stackoverflow.com/q/23096394
type: AnsweredQuestion
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35306814
has comment: http://stackoverflow.com/comment/35306927
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35306453
has title: tomcat changes 404 status into 403 for http delete
has answer: http://stackoverflow.com/a/23177116
has comment: http://stackoverflow.com/comment/35306548
tagged with: tomcat
has comment: http://stackoverflow.com/comment/35306632
has comment: http://stackoverflow.com/comment/35306659
has comment: http://stackoverflow.com/comment/35446460
tagged with: servlets
has body: I'm having a weird issue where if my servlet sends a 200 ok http status, it works as intended, and the client gets a 200 status as expected. But, if my servlet returns a 404 status, tomcat seems to change it into a 403 status. This doesn't happen if I use the http get method. I haven't tested put or post. I want to make it very clear that my servlets doDelete method gets executed just fine. It's just that the status code returned to the browser gets changed. I'll provide a minimal testcase demonstrating the issue. import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/api/test403/*") public class Test403 extends HttpServlet { public void doDelete(HttpServletRequest request, HttpServletResponse response) { try { String p = request.getParameter("send404"); if (p != null &amp;&amp; "1".equals(p)) { response.sendError(HttpServletResponse.SC_NOT_FOUND, "not found."); } else { response.sendError(HttpServletResponse.SC_OK, "ok."); } } catch (Exception e) { e.printStackTrace(); } } private static final long serialVersionUID = 1L; } then i test via the following urls myproject/api/test403?send404=1 myproject/api/test403?send404=0 What could cause this behavior? I'm not overly familiar the whole servlet/container architecture. I'm only experiencing this issue on 1 server which uses tomcat 7.0.41. I tried another server, which didn't exhibit this behavior. edit - Per request, here's some output from the network panel in chrome. I used ajax to initiate this particular request: Request Headers DELETE /xxxxx HTTP/1.1 Host: xxxxx Connection: keep-alive Origin: xxx X-Requested-With: XMLHttpRequest User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36 Content-Type: application/x-www-form-urlencoded Accept: */* Referer: xxx Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;…
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35305683
favorite count: 0
accepted answer: http://stackoverflow.com/a/23177116
has comment: http://stackoverflow.com/comment/35304742
has comment: http://stackoverflow.com/comment/35306321
has comment: http://stackoverflow.com/comment/35306775
has comment: http://stackoverflow.com/comment/35305691

http://stackoverflow.com/q/23047475
tagged with: java
has title: Generic Dijkstra's
tagged with: dijkstra
type: Question
score: 2
downvote count: 0
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
has body: I'm currently working a Dijkstras Algorithm problem and hit a brick wall. My assignment is I'm in a one story building with X by Y amount of rooms. Each room has a cost to go to it. On the borders are several exits and I have to find the shortest path to one of those exits from a randomly placed starting point. Before I explain the problem I'm having, I'll explain some of my code. I created a class called room to store each cost and adjacency as such: static class room implements Comparable&lt;room&gt; { int value; int i; int k; PriorityQueue&lt;room&gt; adj = new PriorityQueue&lt;room&gt;(); double distance = Double.POSITIVE_INFINITY; room(int i, int k, int v) { this.k = k; this.i = i; this.value = v; } @Override public int compareTo(room o) { return this.value - o.value; } the adjacencies of everyone room consists of only rooms directly North, East, South and West. static void adjacent(room[][] field, int row, int column) { for (int i = 1; i &lt;= row; i++) { for (int k = 1; k &lt;= column; k++) { if (field[i][k + 1] != null) { field[i][k].adj.add(field[i][k + 1]); } if (field[i][k - 1] != null) { field[i][k].adj.add(field[i][k - 1]); } if (field[i + 1][k] != null) { field[i][k].adj.add(field[i + 1][k]); } if (field[i - 1][k] != null) { field[i][k].adj.add(field[i - 1][k]); } } } My variable start is the first room I begin in. And I created a method that will poll it's adjacencies one at a time and send it to this method. static void closestExit(room s) { while (s.adj.size() != 0) { LinkedList&lt;room&gt; q = new LinkedList&lt;&gt;(); q.add(s.adj.poll()); q.peek().distance = q.peek().value; while (q.size() != 0) { if (q.peekLast().adj.size() == 0)//if adj list is empty then remove it from the list or if last in queue is an X remove it { backtrack(q); } else if (q.peekLast().value == 'X') { q.removeLast(); } else if (q.peekLast().adj.peek().value == 'X' || q.peekLast().adj.peek().value == 'S')//if head of adj list is S or X then it removes it { q.peekLast().adj.rem…
has comment: http://stackoverflow.com/comment/35272735

http://stackoverflow.com/comment/35293690
type: Comment
has text: Hi thank you for replying! I don't know python so I ask to see if I understood. You basically implemented what I called the approach 1, in which each object see its relationship implemented as a list-property inside itself, right? But what about the problems that Andrei Volgin underlined ? And what exactly do you mean with "store relationships but it is the worse scenario since it is more complex" ?
type: AnswerComment
comment on: http://stackoverflow.com/a/23091081
score: 0

http://stackoverflow.com/comment/35204581
has text: Thank you for the explanation and yes I couldn't think of the correct word, thanks.
type: Comment
comment on: http://stackoverflow.com/a/23041446
type: AnswerComment
score: 0

http://stackoverflow.com/q/23008264
has answer: http://stackoverflow.com/a/23008731
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35143454
has comment: http://stackoverflow.com/comment/35142858
score: -2
has answer: http://stackoverflow.com/a/23008684
has comment: http://stackoverflow.com/comment/35142923
accepted answer: http://stackoverflow.com/a/23008731
favorite count: 0
has body: Please explain why in this function System.out.println(msg + ": " + count++); will be called after while end. Example: printWithDelay(2, "Hello"); Result: Only after count reach 9 (~20 sec), all stack of System.out.println() will be displayed. static void printWithDelay(int sec, String msg){ int count = 0; long eventTime = System.nanoTime() + ((long)Math.pow(10, 10)*sec); while(count &lt; 10){ if(System.nanoTime() &gt; eventTime){ System.out.println(msg + ": " + count++); } } } Wanted result: the message displays after exactly when if statement is true.
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/23008684
has answer: http://stackoverflow.com/a/23008848
tagged with: java
has answer: http://stackoverflow.com/a/23008698
answer count: 4
downvote count: 4
has title: Why in this loop messages that are in if statement are caller only after loop ends?

http://stackoverflow.com/comment/35334831
type: Comment
has text: Please use capitalization, it makes text look much better
comment on: http://stackoverflow.com/a/23114599
type: AnswerComment
score: 0

icepush
type: Tag
tag name: icepush
tags question: http://stackoverflow.com/q/23107241

http://stackoverflow.com/comment/35185307
has text: Are you using Spring the spring dialect with Thymeleaf?
type: Comment
comment on: http://stackoverflow.com/q/23023010
type: QuestionComment
score: 1

http://stackoverflow.com/comment/35436811
comment on: http://stackoverflow.com/a/23044606
score: 0
type: AnswerComment
has text: I have all jars in Youtube Data Api (http://i59.tinypic.com/mrs421.jpg) but i didn't do any xml
type: Comment

http://stackoverflow.com/comment/35318958
score: 0
type: AnswerComment
has text: +1 Didn't know about `moveAbove(null)`, that of course makes it easier :)
type: Comment
comment on: http://stackoverflow.com/a/23097093

http://stackoverflow.com/q/23012352
accepted answer: http://stackoverflow.com/a/23012471
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/35150406
downvote count: 0
has comment: http://stackoverflow.com/comment/35150491
has body: I try to round a double value to 2 decimal places but I always get 0.0. I tried three approaches. First: System.out.println(Math.round(reward*100.0)/100.0); Second: System.out.println(String.valueOf(round(reward, 2))); private double round(double value, int places) if (places &lt; 0) throw new IllegalArgumentException(); BigDecimal bd = new BigDecimal(value); bd = bd.setScale(places, RoundingMode.HALF_UP); return bd.doubleValue(); } Third: DecimalFormat df = new DecimalFormat("###.##"); System.out.println(df.format(reward)); Everytime I only get 0.0. Example values: 5.957818181818184E-16 0.0 3.927272727272729E-18 0.0 3.1250000000000005E-16 0.0 1.6000000000000006E-19 0.0 What am I missing here? Thanks!
favorite count: 0
has answer: http://stackoverflow.com/a/23012477
has answer: http://stackoverflow.com/a/23012471
has title: Rounding double to 2 decimal places returns always 0.0
score: 2
possible better answer: http://stackoverflow.com/a/23012477
type: AnsweredQuestion
upvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/35150498

java
tags question: http://stackoverflow.com/q/23009682
tags question: http://stackoverflow.com/q/23033940
tags question: http://stackoverflow.com/q/22974985
tags question: http://stackoverflow.com/q/22976087
tags question: http://stackoverflow.com/q/23004035
tags question: http://stackoverflow.com/q/23006685
tags question: http://stackoverflow.com/q/23071170
tags question: http://stackoverflow.com/q/22978664
tags question: http://stackoverflow.com/q/23067368
tags question: http://stackoverflow.com/q/22985771
tags question: http://stackoverflow.com/q/23116465
tags question: http://stackoverflow.com/q/23005344
tags question: http://stackoverflow.com/q/23084114
tags question: http://stackoverflow.com/q/23063324
tags question: http://stackoverflow.com/q/23034704
tags question: http://stackoverflow.com/q/22986533
tags question: http://stackoverflow.com/q/23080295
tags question: http://stackoverflow.com/q/23071246
tags question: http://stackoverflow.com/q/23107050
tags question: http://stackoverflow.com/q/22972321
tags question: http://stackoverflow.com/q/22987392
tags question: http://stackoverflow.com/q/23063046
tags question: http://stackoverflow.com/q/22968950
tags question: http://stackoverflow.com/q/23083657
tags question: http://stackoverflow.com/q/23126246
tags question: http://stackoverflow.com/q/22987790
tags question: http://stackoverflow.com/q/23121614
tags question: http://stackoverflow.com/q/23074245
tags question: http://stackoverflow.com/q/23129387
tags question: http://stackoverflow.com/q/23057561
tags question: http://stackoverflow.com/q/22974828
tags question: http://stackoverflow.com/q/22982739
tags question: http://stackoverflow.com/q/23092530
tags question: http://stackoverflow.com/q/23082392
tags question: http://stackoverflow.com/q/23044522
tags question: http://stackoverflow.com/q/23044907
tags question: http://stackoverflow.com/q/23050044
tags question: http://stackoverflow.com/q/23092349
tags question: http://stackoverflow.com/q/22971805
tags question: http://stackoverflow.com/q/23034798
tags question: http://stackoverflow.com/q/23102350
tags question: http://stackoverflow.com/q/23101811
tags question: http://stackoverflow.com/q/22996446
tags question: http://stackoverflow.com/q/23089495
tags question: http://stackoverflow.com/q/23041708
tags question: http://stackoverflow.com/q/23058309
tags question: http://stackoverflow.com/q/23024629
tags question: http://stackoverflow.com/q/23110270
tags question: http://stackoverflow.com/q/23068033
tags question: http://stackoverflow.com/q/23031508
tags question: http://stackoverflow.com/q/23088320
tags question: http://stackoverflow.com/q/23102747
tags question: http://stackoverflow.com/q/23041306
tags question: http://stackoverflow.com/q/23116081
tags question: http://stackoverflow.com/q/23093381
tags question: http://stackoverflow.com/q/23014569
tags question: http://stackoverflow.com/q/22971855
tags question: http://stackoverflow.com/q/23074388
tags question: http://stackoverflow.com/q/23046220
tags question: http://stackoverflow.com/q/22970073
tags question: http://stackoverflow.com/q/22995527
tags question: http://stackoverflow.com/q/23004600
tags question: http://stackoverflow.com/q/23028626
tags question: http://stackoverflow.com/q/23105724
tags question: http://stackoverflow.com/q/22985261
tags question: http://stackoverflow.com/q/23102454
tags question: http://stackoverflow.com/q/23019070
tags question: http://stackoverflow.com/q/23098238
tags question: http://stackoverflow.com/q/22994142
tags question: http://stackoverflow.com/q/23038875
tags question: http://stackoverflow.com/q/23049088
tags question: http://stackoverflow.com/q/23056418
tags question: http://stackoverflow.com/q/23089868
tags question: http://stackoverflow.com/q/22982362
tags question: http://stackoverflow.com/q/23080540
tags question: http://stackoverflow.com/q/23032375
tags question: http://stackoverflow.com/q/23020604
tags question: http://stackoverflow.com/q/23111378
tags question: http://stackoverflow.com/q/23036271
tags question: http://stackoverflow.com/q/23049545

http://stackoverflow.com/comment/35128686
has text: I've spent some time playing with cscript //.. options as well as wscript. Neither are working with Java though. Can you recommend any options maybe, or different script.exe type programs that can run the job.vbs? (This seems like a promising lead!)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22970688
score: 0

http://stackoverflow.com/q/22973797
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/35081868
has comment: http://stackoverflow.com/comment/35081828
has answer: http://stackoverflow.com/a/22973967
tagged with: c++
score: 0
has title: Data gets corrupted when transferring bytes from C++ to Java
has answer: http://stackoverflow.com/a/22973882
has body: My C++ server uses the following code to send to my Java client the number 11 boost::system::error_code ignored_error; tcp::socket* server_socket; ... size_t check = boost::asio::write(*server_socket, boost::asio::buffer("11", 2), ignored_error); check is equal to 2, so there's no problem on the server side. My Java client receives the data using the following code Socket tcpSocket; BufferedInputStream inFromServer; ... String temp = ""; for(int i=0; i&lt;2; i++) temp += (char) inFromServer.read(); int num_of_filters = Integer.parseInt(temp); //Here the following error is thrown java.lang.NumberFormatException: For input string: "0 What am I doing wrong? Any help would be highly appreciated.
type: Question
has comment: http://stackoverflow.com/comment/35097345
tagged with: java
has comment: http://stackoverflow.com/comment/35086675
answer count: 2
tagged with: boost-asio

http://stackoverflow.com/comment/35181198
has text: Do you understand the difference between `>>` and `>>>`?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23028977

http://stackoverflow.com/q/23002754
has answer: http://stackoverflow.com/a/23002767
accepted answer: http://stackoverflow.com/a/23002767
answer count: 1
tagged with: polymorphism
favorite count: 0
has body: How does inheritance and polymorphism work with static methods? Could someone explain what the proper output is supposed to be here and how it was derived? class A { public static int get() { return 17; } } class B extends A { public static int get() { return 42; } } Main A x = new B(); x.get(); The error message, The static method get() from the type A should be accessed in a static way I think I know how to access to it in a static way but this is a question from class and its sort of implied that one or the other values would be returned In our program, we have the class definitions: class A { public static int get() { return 17; } } class B extends A { public static int get() { return 42; } } and somewhere else we declare A x = new B(); What number will the call x.get() return?
has comment: http://stackoverflow.com/comment/35133483
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35133339
type: Question
has title: Static methods inheritance and polymorphism
tagged with: inheritance
tagged with: static-methods
upvote count: 2

http://stackoverflow.com/q/23057096
upvote count: 1
has comment: http://stackoverflow.com/comment/35233524
has comment: http://stackoverflow.com/comment/35233230
possible better answer: http://stackoverflow.com/a/23057382
type: Question
has title: Exception starting filter Struts 2
tagged with: struts2
accepted answer: http://stackoverflow.com/a/23058385
answer count: 2
downvote count: 0
tagged with: tomcat
favorite count: 0
has body: I am trying to set my first struts 2 application using annotations and maven. I'm follwing this example struts2 annotations example when i try to run the application on tomcat server 7 i'm getting this exception Grave: Exception startin filter struts2 java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter. StrutsPrepareAndExecuteFilter at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:529) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:511) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:139) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258) at org.apache.catalina.core.ApplicationFilterConfig.&lt;init&gt;(ApplicationFilterConfig.java:105) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 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) avr. 14, 2014 10:40:05 AM org.apache.catalina.core.StandardContext startInternal Grave: Error filterStart avr. 14, 2014 10:40:05 AM org.apache.catalina.core.StandardContext startInternal Grave: Erreur de démarrage du contexte [/StrutsAnnotationsExample] suite aux erreurs précédentes avr. 14, 2014 10:4…
tagged with: web.xml
has comment: http://stackoverflow.com/comment/35232045
tagged with: maven
has comment: http://stackoverflow.com/comment/35233024
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23057382
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23058385

http://stackoverflow.com/a/22983535
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22983408
has body: An object can be anything. It can be an array, it can be an single variable. Object O = new Object[]{"S","A"}; When you define object you can type cast it to your desired data type. You can not assign an array of a data type to a single variable of that 'same' datatype.
type: Answer

http://stackoverflow.com/comment/35254423
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23068932
score: 0
has text: do you have another default constructor in your class ?

http://stackoverflow.com/comment/35380195
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23117856
has text: I have been trying to fix the window so that the whole play area could be displayed but I couldn't seem to find out a solution. Any help with that? @user3507600

http://stackoverflow.com/a/23125339
answers question: http://stackoverflow.com/q/23125289
score: 7
has comment: http://stackoverflow.com/comment/35354388
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23125289
has body: System.out.print accepts a String as a parameter, in fact, anything that you send it will be converted to a String in order for it to be displayed. Using the following code, you could then put the result of the postalCodeIndex method call into a variable called myString. String myString = postalCodeIndex.findClosestBruteForce(latitude, longitude).toString(); It might be worth your while remembering that the process in the System.out.print() code sample works as follows: postalCodeIndex is called FIRST, creating a temporary String in-place because the .toString() method is called on your behalf. The System.out.print method is only called AFTER the postalCodeIndex method has returned, because System.out.print requires this returned String to enable it to print something to the console.
type: Answer
has comment: http://stackoverflow.com/comment/35464962
has comment: http://stackoverflow.com/comment/35354351
upvote count: 7

http://stackoverflow.com/comment/35086077
score: 0
comment on: http://stackoverflow.com/a/22975428
has text: Because it's a spring controller,I gonna use mockmvc.perfome(get("/doc/xxx.json")...to test the controller.then check whether the response is the same as the mock file. how to use your suggestion in my case? since the controller gonna invoke InputStream inStream = ControllerClass.getClass().getResourceAsStream("/doc/xxx.json"); inside the controller and won't find the file at /doc/xxx.json
type: AnswerComment
type: Comment

serialization
tags question: http://stackoverflow.com/q/22971805
tags question: http://stackoverflow.com/q/23049545
tags question: http://stackoverflow.com/q/23127163
tags question: http://stackoverflow.com/q/23030315
tags question: http://stackoverflow.com/q/23093757
tags question: http://stackoverflow.com/q/23066779
tags question: http://stackoverflow.com/q/23103235
tags question: http://stackoverflow.com/q/23082079
tags question: http://stackoverflow.com/q/23034185
tag name: serialization
tags question: http://stackoverflow.com/q/23025622
tags question: http://stackoverflow.com/q/22978729
tags question: http://stackoverflow.com/q/23044691
tags question: http://stackoverflow.com/q/22992032
tags question: http://stackoverflow.com/q/23122395
tags question: http://stackoverflow.com/q/23050067
type: Tag
tags question: http://stackoverflow.com/q/22983179
tags question: http://stackoverflow.com/q/22982684
tags question: http://stackoverflow.com/q/23047246
tags question: http://stackoverflow.com/q/23044159
tags question: http://stackoverflow.com/q/23078110
tags question: http://stackoverflow.com/q/23021936
tags question: http://stackoverflow.com/q/23085396
tags question: http://stackoverflow.com/q/23008962
tags question: http://stackoverflow.com/q/23123536
tags question: http://stackoverflow.com/q/23107652
tags question: http://stackoverflow.com/q/23112846
tags question: http://stackoverflow.com/q/23095793
tags question: http://stackoverflow.com/q/23050079

http://stackoverflow.com/q/23071872
has title: Using titan DB from python
upvote count: 1
tagged with: python
tagged with: java
has comment: http://stackoverflow.com/comment/35483017
answer count: 0
downvote count: 0
tagged with: database
type: UnansweredQuestion
type: Question
has body: I am attempting to model a network topology using Titan Graph DB. I want to specify the topology from a python application. I have a java interface file that uses tinkertop frames annotation. An example structure is given below. public interface IDeviceObject extends IBaseObject { @JsonProperty("mac") @Property("dl_addr") public String getMACAddress(); @Property("dl_addr") public void setMACAddress(String macaddr); @JsonProperty("ipv4") @Property("nw_addr") public String getIPAddress(); @Property("nw_addr") public void setIPAddress(String ipaddr); @JsonIgnore @Adjacency(label="host",direction = Direction.IN) public Iterable&lt;IPortObject&gt; getAttachedPorts(); @JsonIgnore @Adjacency(label="host",direction=Direction.IN) public void setHostPort(final IPortObject port); @JsonIgnore @Adjacency(label="host",direction=Direction.IN) public void removeHostPort(final IPortObject port); @JsonIgnore @GremlinGroovy("it.in('host').in('on')") public Iterable&lt;ISwitchObject&gt; getSwitch(); } As I understand it tinkertop/frames is an ORM for Titan DB. (am I right assuming this?) Is there something similar i.e Object Relational Mapper for Python for Titan DB ? I am looking at the easiest way to map my topology from Python
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35273696
tagged with: titan

http://stackoverflow.com/comment/35155603
type: Comment
comment on: http://stackoverflow.com/a/23015150
has text: You shouldn't assume the string is negative. If you just replace the left paren with a hyphen, it is safer.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35344197
score: 0
comment on: http://stackoverflow.com/q/23119539
type: Comment
type: QuestionComment
has text: [Don't use `setPreferredSize()` when you really mean to override `getPreferredSize()`](http://stackoverflow.com/q/7229226/230513).

http://stackoverflow.com/q/22984368
upvote count: 3
has comment: http://stackoverflow.com/comment/35111955
tagged with: java
has comment: http://stackoverflow.com/comment/35100328
type: Question
accepted answer: http://stackoverflow.com/a/23070087
has title: Transitive Maven dependency shows up in dependency:tree but not in lib directory
possible better answer: http://stackoverflow.com/a/42826795
tagged with: maven-3
has comment: http://stackoverflow.com/comment/35103376
has answer: http://stackoverflow.com/a/42826795
answer count: 2
downvote count: 0
tagged with: pom.xml
tagged with: dependencies
linked to: http://stackoverflow.com/q/10022225
favorite count: 0
has comment: http://stackoverflow.com/comment/35102687
has body: I am using Maven 3.0.3 to build a large java project. My pom.xml has a parent which depends on spring-context (compile scope) which in turn depends on spring-expression (also in the compile scope). When I create a dependency tree with mvn:dependencyTree everything looks fine, the spring-expression library turns up as a transitive dependency in compile scope. However if I build an effective pom with mvn help:effective-pom the entry for spring-expression is missing. Also if I build the project the lib for spring-expression is not included in the lib directory while the one for spring-context is. Until recently the library was included in the build, now something seems to have changed in one of the dependencies. However spring-context is still in the compile scope and shows up in the dependency tree, so I don't see why this should have changed the behavior. Also, updating Maven (which seems to have solved a possibly related problem here) is sadly not an option. I have temporarily fixed the problem by adding spring-expression as a direct rather than transitive dependency to my project but I'd rather not clog up the pom with stuff that should already be there. Any ideas? Update: Weirder and weirder... While trying to come up with a minimal example I found one - sort of. This is what I came up with: 4.0.0 org.test.project test-project war 0.1-SNAPSHOT Test Project <spring.version>3.2.4.RELEASE</spring.version> org.springframework spring-context ${spring.version} runtime It works in that the transitive dependency spring-expression is shown in the output of mvn:dependencyTree: [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Test Project 0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ test-project --- [INFO] org.test.project:test-project:war:0.1-SNAPSHOT [INFO] \- org.springframe…
has answer: http://stackoverflow.com/a/23070087
tagged with: maven
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/35102651
has comment: http://stackoverflow.com/comment/35103273

http://stackoverflow.com/comment/42055389
comment on: http://stackoverflow.com/a/23136358
type: AnswerComment
has text: @FranciscoBouza Without spending a lot of time on it, the only thing I can suggest is to look through the xml source of the docx file and see if you can figure out what is setting the font and line spacing and look for Poi functions to specifically address those properties. I believe a colleague of mine ran into that issue. I'll check to see if he ever got it solved.
score: 0
type: Comment

http://stackoverflow.com/q/23040835
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/23041105
type: Question
tagged with: continuations
has body: I'm playing around with the Play Framework (v2.2.2), and I'm trying to figure out how to suspend an HTTP request. I'm trying to create a handshake between users, meaning, I want user A to be able to fire off a request and wait until user B "connects". Once the user B has connected, user A's request should return with some information (the info is irrelevant; let's just say some JSON for now). In another app I've worked on, I use continuations to essentially suspend and replay an HTTP request, so I have something like this... @Override public JsonResponse doGet(HttpServletRequest request, HttpServletResponse response) { Continuation reqContinuation = ContinuationSupport.getContinuation(request); if (reqContinuation.isInitial()) { ... reqContinuation.addContinuationListener(new ContinuationListener() { public void onTimeout(Continuation c) {...} public void onComplete(Continuation c) {...} }); ... reqContinuation.suspend(); return null; } else { // check results and return JsonResponse with data } } ... and at some point, user B will connect and the continuation will be resumed/completed in a different servlet. Now, I'm trying to figure out how to do this in Play. I've set up my route... GET /test controllers.TestApp.test() ... and I have my Action... public static Promise&lt;Result&gt; test() { Promise&lt;JsonResponse&gt; promise = Promise.promise(new Function0&lt;JsonResponse&gt;() { public JsonResponse apply() { // what do I do now...? // I need to wait for user B to connect } }); return promise.map(new Function&lt;JsonResponse, Result&gt;() { public Result apply(JsonResponse json) { return ok(json); } }); } I'm having a hard time understanding how to construct my Promise. Essentially, I need to tell user A "hey, you're waiting on user B, so here's a promise that user B will eventually connect to you, or else I'll let you know when you don't have to wait anymore". How do I suspend the request such that I can return a promise of user B connecting? How do I wait for …
linked to: http://stackoverflow.com/q/9436074
answer count: 1
downvote count: 0
has title: how do I suspend a request in Play Framework?
tagged with: asynchronous
favorite count: 0
has answer: http://stackoverflow.com/a/23041105
tagged with: playframework-2.2
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/35152854
comment on: http://stackoverflow.com/q/23013617
type: Comment
score: 0
type: QuestionComment
has text: What do you mean, 'the spaceship does not have to be perfect'?

recursion
type: Tag
tags question: http://stackoverflow.com/q/23025347
tags question: http://stackoverflow.com/q/22986975
tags question: http://stackoverflow.com/q/23110270
tags question: http://stackoverflow.com/q/22992217
tags question: http://stackoverflow.com/q/23069432
tags question: http://stackoverflow.com/q/23106077
tag name: recursion
tags question: http://stackoverflow.com/q/23038993
tags question: http://stackoverflow.com/q/23107976
tags question: http://stackoverflow.com/q/23075689
tags question: http://stackoverflow.com/q/23043259
tags question: http://stackoverflow.com/q/22993730
tags question: http://stackoverflow.com/q/23072597
tags question: http://stackoverflow.com/q/23052293
tags question: http://stackoverflow.com/q/23000365
tags question: http://stackoverflow.com/q/23054758
tags question: http://stackoverflow.com/q/22978193
tags question: http://stackoverflow.com/q/23035787
tags question: http://stackoverflow.com/q/23049239
tags question: http://stackoverflow.com/q/22971653
tags question: http://stackoverflow.com/q/23002078
tags question: http://stackoverflow.com/q/22985076
tags question: http://stackoverflow.com/q/23073286
tags question: http://stackoverflow.com/q/23059127
tags question: http://stackoverflow.com/q/23068380
tags question: http://stackoverflow.com/q/23064247
tags question: http://stackoverflow.com/q/22999931
tags question: http://stackoverflow.com/q/22987084

http://stackoverflow.com/a/23003419
answers question: http://stackoverflow.com/q/23003381
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23003381
has body: If you use entity.setProperty("propertyName", "value"), it will be indexed. If you use entity.setUnindexedProperty("propertyName", "value"), it will not be indexed.
type: Answer

http://stackoverflow.com/q/23048196
favorite count: 0
accepted answer: http://stackoverflow.com/a/23048275
tagged with: nullpointerexception
linked to: http://stackoverflow.com/q/271526
score: 1
has comment: http://stackoverflow.com/comment/35216020
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23048275
has body: Checking if reference is null every time it is used wouldn't be efficient enough... I suppose real implementation uses memory protection mechanisms to detect it. Can anyone explain in detail how does it actually work?
tagged with: java
has comment: http://stackoverflow.com/comment/35215964
has title: How is NullPointerException implemented?
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/a/23105960
has body: maybe this? public int getPrime() { List&lt;Integer&gt; primes = getPrimes(); int idx = System.currentTimeMillis() % primes.size(); return primes.get(idx); } private List&lt;Integer&gt; getPrimes() { List&lt;Integer&gt; primes = new ArrayList&lt;&gt;(); for(int a = 0; a &lt; 256; a++){ boolean checkIt = checkPrime(a, 5); //check whether the number is prime or not if(checkIt){ primes.add(a); } } } } It's not very robust, however might be enough depending on your use case.
type: Answer
answers question: http://stackoverflow.com/q/23105604
score: 0

http://stackoverflow.com/comment/35312522
has text: @Rembo question is updated
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23098478

http://stackoverflow.com/q/22970073
score: 3
tagged with: spring
tagged with: cxf
upvote count: 3
has title: NoSuchMethodError: org.apache.cxf.jaxrs.JAXRSServiceFactoryBean.sendEvent
answer count: 1
has body: I'm running into a problem with a combination of Spring 3.1.1 and Apache CXF 2.7.10. I'm guessing I'm just missing a dependency but can't for the life of me figure out what. When starting my service I get the following exception: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'serviceBeans' threw exception; nested exception is java.lang.NoSuchMethodError: org.apache.cxf.jaxrs.JAXRSServiceFactoryBean.sendEvent(Lorg/apache/cxf/service/factory/FactoryBeanListener$Event;[Ljava/lang/Object;)V at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationCon…
has answer: http://stackoverflow.com/a/22972596
tagged with: java
has comment: http://stackoverflow.com/comment/35074235
type: AnsweredQuestion
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22972596
type: Question

http://stackoverflow.com/comment/35187116
type: Comment
comment on: http://stackoverflow.com/q/23032173
has text: all vars to 1 ArrayList
score: 0
type: QuestionComment

http://stackoverflow.com/q/23042163
tagged with: android
favorite count: 0
tagged with: universal-image-loader
downvote count: 0
has answer: http://stackoverflow.com/a/23042880
accepted answer: http://stackoverflow.com/a/23042880
has title: how to load image with Universal ImageLoader without displaying
has answer: http://stackoverflow.com/a/23042491
type: AnsweredQuestion
score: 3
tagged with: java
linked to: http://stackoverflow.com/q/14811579
type: Question
has body: I'm trying to do something like this: Android Map api v2 Custom marker with ImageView But I'm stuck on using image loader. Trying: Bitmap bmImg = imageLoader.loadImageSync(url); LogCat gives me 04-13 14:11:44.953: E/ImageLoader(18542): android.os.NetworkOnMainThreadException Here's is my code. I have an ArrayList camera with all information needed (titrle, position, url, etc). public void drawPicsOnMap() { String title = null; String place = null; for (int i = 0; i&lt;camera.size(); i++) { Bitmap.Config conf = Bitmap.Config.ARGB_8888; Bitmap bmp = Bitmap.createBitmap(80, 80, conf); Canvas canvas = new Canvas(bmp); // paint defines the text color, // stroke width, size Paint color = new Paint(); color.setTextSize(35); color.setColor(Color.BLACK); Camera cam = camera.get(i); LatLng coord = new LatLng(cam.lat, cam.lon); title = Integer.toString(cam.id); place = cam.place; String url = cam.img; Bitmap bmImg = imageLoader.loadImageSync(url); //modify canvas canvas.drawBitmap(bmImg, 0,0, color); canvas.drawText(title, 30, 40, color); Marker mark = map.addMarker(new MarkerOptions() .position(coord) .title(title) .snippet(place) .icon(BitmapDescriptorFactory .fromBitmap(bmp))); markers.put(mark.getId(), url); } }
answer count: 2
possible better answer: http://stackoverflow.com/a/23042491
upvote count: 3
tagged with: google-maps-api-2

http://stackoverflow.com/q/23000589
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23243885
has body: My java is a bit rusty, haven't used it for quite a while. What i'm trying to do is have the user define a date (3 ints containing year, month and day) and convert this to a date object. I have a method as follows, which is what i've ended up with after a google search private double getTotalPaymentAmount(int sDay, int sMonth, int sYear, int eDay, int eMonth, int eYear) { double total = 0.0; Iterator it = payments.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry)it.next(); Payment p = (Payment) pairs.getValue(); Date d = p.getDate(); Calendar myCalendar = Calendar.getInstance(); myCalendar.set(sYear, sMonth, sDay, 0, 0, 1); Date startDate = myCalendar.getTime(); myCalendar.set(eYear, eMonth, eDay, 0, 0, 1); Date endDate = myCalendar.getTime(); boolean b = startDate.compareTo(d) * d.compareTo(endDate) > 0; System.out.println("Start: " + startDate + " -> End: " + endDate); total = total + p.getAmount() ; } return total; } and its being called by the following, which at the moment is just being printed out return " " + getTotalPaymentAmount(2014,1,1,2014,12,31); The problem is the dates are completely wrong. I want the start date as 2014-01-01 and the end date as 2014-12-31 but its printing out as Start: Sat Aug 07 00:00:01 GMT 6 -> End: Sat Jul 06 00:00:01 GMT 37 Start: Sat Aug 07 00:00:01 GMT 6 -> End: Sat Jul 06 00:00:01 GMT 37 Start: Sat Aug 07 00:00:01 GMT 6 -> End: Sat Jul 06 00:00:01 GMT 37
has comment: http://stackoverflow.com/comment/35129505
tagged with: date
type: Question
has comment: http://stackoverflow.com/comment/35129576
has title: trying to create date returns wrong values
answer count: 1
has comment: http://stackoverflow.com/comment/35129558
accepted answer: http://stackoverflow.com/a/23243885
has comment: http://stackoverflow.com/comment/35129526
has comment: http://stackoverflow.com/comment/35129568

http://stackoverflow.com/comment/35207335
type: QuestionComment
comment on: http://stackoverflow.com/q/23043670
has text: @RC okay, I see what you mean now.
type: Comment
score: 0

http://stackoverflow.com/comment/35344911
comment on: http://stackoverflow.com/q/23119905
score: 5
has text: i don't understand. these result seem correct to me. What would you expect?
type: Comment
type: QuestionComment

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

http://stackoverflow.com/comment/35272892
has text: @Thomas IMHO there are different possibilities: not to pass `this` to threads in the constructor, or do not use inner classes for threads or instantiate them after after initializing (using synchronization of course).
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23078827

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

http://stackoverflow.com/comment/35290709
type: Comment
comment on: http://stackoverflow.com/q/23089648
score: 0
has text: can you please state what is the difficulty?
type: QuestionComment

http://stackoverflow.com/comment/35219161
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23049746
has text: @merlin2011, I put in a piece of text I'm trying to input.
type: Comment

http://stackoverflow.com/comment/35156573
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23015664
has text: thanks for the answer, I have made an UPDATE 2: "If nowadays almost everyone knows HTML and JS with its frameworks - why then to use JSP or JSF?"

http://stackoverflow.com/comment/35271107
has text: jQuery uses different date-time pattern then Struts2.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23077771

sockets
tags question: http://stackoverflow.com/q/22986543
tags question: http://stackoverflow.com/q/22984364
tags question: http://stackoverflow.com/q/23081739
tags question: http://stackoverflow.com/q/23000708
tags question: http://stackoverflow.com/q/23066640
tags question: http://stackoverflow.com/q/23109056
tags question: http://stackoverflow.com/q/23058541
tags question: http://stackoverflow.com/q/22970236
tags question: http://stackoverflow.com/q/22993877
tags question: http://stackoverflow.com/q/23125890
tags question: http://stackoverflow.com/q/23045483
tags question: http://stackoverflow.com/q/22993938
tags question: http://stackoverflow.com/q/23118540
tags question: http://stackoverflow.com/q/23095314
tags question: http://stackoverflow.com/q/23065490
tags question: http://stackoverflow.com/q/23061938
tags question: http://stackoverflow.com/q/23060994
tags question: http://stackoverflow.com/q/23129224
tags question: http://stackoverflow.com/q/23070062
tags question: http://stackoverflow.com/q/22989091
tags question: http://stackoverflow.com/q/23096052
type: Tag
tags question: http://stackoverflow.com/q/23120156
tags question: http://stackoverflow.com/q/23049023
tags question: http://stackoverflow.com/q/23067911
tags question: http://stackoverflow.com/q/23047711
tags question: http://stackoverflow.com/q/23018461
tags question: http://stackoverflow.com/q/23129011
tags question: http://stackoverflow.com/q/23078119
tags question: http://stackoverflow.com/q/22974514
tags question: http://stackoverflow.com/q/23097246
tags question: http://stackoverflow.com/q/23089850
tags question: http://stackoverflow.com/q/23021936
tags question: http://stackoverflow.com/q/23104848
tags question: http://stackoverflow.com/q/23005332
tags question: http://stackoverflow.com/q/23117861
tags question: http://stackoverflow.com/q/23000609
tags question: http://stackoverflow.com/q/23094309
tags question: http://stackoverflow.com/q/23019189
tag name: sockets
tags question: http://stackoverflow.com/q/23051028
tags question: http://stackoverflow.com/q/23118716
tags question: http://stackoverflow.com/q/23071170
tags question: http://stackoverflow.com/q/23089495
tags question: http://stackoverflow.com/q/23049729
tags question: http://stackoverflow.com/q/23044965
tags question: http://stackoverflow.com/q/22973797
tags question: http://stackoverflow.com/q/23047454
tags question: http://stackoverflow.com/q/23018474
tags question: http://stackoverflow.com/q/23123395
tags question: http://stackoverflow.com/q/23006515
tags question: http://stackoverflow.com/q/23116369
tags question: http://stackoverflow.com/q/23065675

http://stackoverflow.com/comment/35146008
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23008096
has text: But if you say me that with `ApplicationScope` map return object no?

http://stackoverflow.com/comment/35202383
comment on: http://stackoverflow.com/q/23040890
type: Comment
has text: What's "iD" and where's the processCommand methods?
type: QuestionComment
score: 1

http://stackoverflow.com/comment/35121635
comment on: http://stackoverflow.com/q/22996325
has text: Come on, these are just generalized Fibonacci numbers. There is plenty of code for that; just take any regular Fibonacci calculation program and change the base.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22997850
type: Answer
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/22997381
downvote count: 0
has body: When you declare private List&lt;? extends P&gt; data; You require a specific type that extends p for the content of your list, which is not necessary. You can simply use: private List&lt;P&gt; data; As any class that extends P (B and A alike) will be accepted. (That prevent you from assigning data = listA, though)

http://stackoverflow.com/a/23110891
downvote count: 0
score: 6
answers question: http://stackoverflow.com/q/23110853
upvote count: 6
type: Answer
has body: Try: int sum = lst.stream().filter(o -&gt; o.field &gt; 10).mapToInt(o -&gt; o.field).sum();

http://stackoverflow.com/q/23007567
has comment: http://stackoverflow.com/comment/35141757
has title: Java Json pretty print javax.json
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/42569181
accepted answer: http://stackoverflow.com/a/24538798
has comment: http://stackoverflow.com/comment/35142019
downvote count: 0
possible better answer: http://stackoverflow.com/a/32500882
has answer: http://stackoverflow.com/a/32500882
answer count: 3
has answer: http://stackoverflow.com/a/25206426
has comment: http://stackoverflow.com/comment/35142097
favorite count: 0
has answer: http://stackoverflow.com/a/24538798
has body: I'm trying to pretty print json with the javax.json API The code I'm currently using is as follows: private String prettyPrint(String json) { StringWriter sw = new StringWriter(); try { JsonReader jr = Json.createReader(new StringReader(json)); JsonObject jobj = jr.readObject(); Map&lt;String, Object&gt; properties = new HashMap&lt;&gt;(1); properties.put(JsonGenerator.PRETTY_PRINTING, true); JsonGeneratorFactory jf = Json.createGeneratorFactory(properties); JsonGenerator jg = jf.createGenerator(sw); jg.write(jobj).close(); } catch (Exception e) { } String prettyPrinted = sw.toString(); return prettyPrinted; } I'm getting the following exception: 11:47:08,830 ERROR [stderr] (EJB default - 1) javax.json.stream.JsonGenerationException: write(JsonValue) can only be called in array context 11:47:08,835 ERROR [stderr] (EJB default - 1) at org.glassfish.json.JsonGeneratorImpl.write(JsonGeneratorImpl.java:301) 11:47:08,838 ERROR [stderr] (EJB default - 1) at org.glassfish.json.JsonPrettyGeneratorImpl.write(JsonPrettyGeneratorImpl.java:55) 11:47:08,841 ERROR [stderr] (EJB default - 1) at org.proactive.rest.VideoFeedService.prettyPrint(VideoFeedService.java:247) 11:47:08,843 ERROR [stderr] (EJB default - 1) at org.proactive.rest.VideoFeedService.requestVideoFeedData(VideoFeedService.java:124) 11:47:08,845 ERROR [stderr] (EJB default - 1) at org.proactive.rest.VideoFeedService.run(VideoFeedService.java:86) 11:47:08,848 ERROR [stderr] (EJB default - 1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 11:47:08,850 ERROR [stderr] (EJB default - 1) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 11:47:08,852 ERROR [stderr] (EJB default - 1) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 11:47:08,854 ERROR [stderr] (EJB default - 1) at java.lang.reflect.Method.invoke(Method.java:483)
score: 19
type: AnsweredQuestion
upvote count: 19

http://stackoverflow.com/q/23128524
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23128873
possible better answer: http://stackoverflow.com/a/23128645
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23128645
upvote count: 1
has title: java convert letter to number then put all values into array
type: Question
has body: I'm trying to figure out the way to convert letter into number and split it according to n-digits. For example, I have words: TOMORROW BEGIN Then, I convert it to number like in ASCII. So, the converting number must be: 8479777982827987326669717378 After that, all number will be converted to n-digits and put it in one dimensional array. Let's say the number split to 3 digits each block. Result must be: 847 977 798 282 798 732 666 971 737 8 They're all in array: arr[0] = 847, arr[1] = 977, arr[2] = 798,....arr[n] I already tried to solve it in java. But so far, I can just converting the string to number. Here is part of code I've tried: String words = "TOMORROW BEGIN"; int sa; char c; for(int i = 0; i &lt; words.length(); i++){ c = words.charAt(i); sa = (int) c; String kt = Integer.toString(sa); System.out.print(kt); } Well, it successfully converted to number: 8479777982827987326669717378 But, I confuse how to split the number into blocks of n-digits (let's say 3 digits per block) then put the value of all blocks into array. What must I do to solve this?
tagged with: arrays
has answer: http://stackoverflow.com/a/23129282
answer count: 6
has answer: http://stackoverflow.com/a/23128933
accepted answer: http://stackoverflow.com/a/23129282
has answer: http://stackoverflow.com/a/23128709
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23128841

http://stackoverflow.com/comment/35253092
has text: Line 43 goes back to the .toString().getText()
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23068041
score: 0

http://stackoverflow.com/a/23117920
has body: It seems like you are doing some variation of DFS - you are exploring a 'branch' (a single path) on the maze, and hope to find a solution. However, DFS is not complete. It does not guarantee to find a path if one exists, and might get stuck in infinite loops. This is exacrtly the behavior you are observing. In addition - it is not optimal - even the path it found, is not guaranteed to be the best (shortest) one. An optimal and complete algorithm that solves this problem is BFS. In BFS you explore all possible moves up to depth 1. Then up to depth 2, and so on and so on. There are more advanced algorithms such as A* search algorithm (possibly with the manhattan distance heuristic), and bi-directional search, but you should stick to the simpler BFS for the time being.
answers question: http://stackoverflow.com/q/23117265
type: Answer
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/35300614
type: QuestionComment
has text: Well of course you do :P. Switch around the check for nulls in your if statement to first check if they are null.
score: 0
comment on: http://stackoverflow.com/q/23094602
type: Comment

http://stackoverflow.com/q/23083363
downvote count: 0
has body: I'm currently developing a study tool which groups several portable system management tools (mainly sysinternal tools). I have a simple frame with a JButton. What am I trying to do? - Along with my java file i have an exe file (for example purposes let's use config.exe) which needs elevated rights to run. After the user clicks on the button how can i do this execute this file? EDIT: I just found one other way to do it. I made a exe from my jar file and went to the compatibility tab and checked "Always Run as admin" Thank you for all of your help.
has answer: http://stackoverflow.com/a/23084032
duplicate of: http://stackoverflow.com/q/1385866
favorite count: 0
possible better answer: http://stackoverflow.com/a/23083934
tagged with: admin-rights
type: AnsweredQuestion
score: 2
upvote count: 2
accepted answer: http://stackoverflow.com/a/23084032
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/1385866
answer count: 2
has answer: http://stackoverflow.com/a/23083934
has title: Java - Executing exe with Admin Rights

http://stackoverflow.com/q/23106063
downvote count: 0
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/23106547
has title: Update online database using a php session in android
score: 1
tagged with: mysql
upvote count: 1
has body: I need for one of my apps to update a database on my server (likes, comments, etc...) and I thought that the only way to disabilitate bots to update it constantly is through making the user create an account and via java ask for a php script on the server side to update the records, but I don't know how to get the app to understand if a user is logged in or not... Do you have any ideas that could help me? Thank you
type: AnsweredQuestion
tagged with: session
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23106547
answer count: 1

http://stackoverflow.com/comment/35342690
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23118422
has text: I see, I guess I just try to avoid situations that errors keep being thrown but since that is what should work I will take your approach. How do i accept the comment as an answer?
type: QuestionComment

http://stackoverflow.com/comment/35233060
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23057712
score: 0
has text: The `O(1)` notation is used for *time* ***and*** space complexity as well.

http://stackoverflow.com/a/23019201
has comment: http://stackoverflow.com/comment/35163401
accepted answer of: http://stackoverflow.com/q/23019070
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35163498
has body: The best you can do here is to split your Adress string, by commas, and grab the first value from the resulting array. Take a look at this question for more details on splitting a string in Java. I suggest the following in your code: String[] AddressParts = Address.split(","); String City = AddressParts[0]; System.out.println("Allspam Insurance Company! Drivers from "+City+" saved an average "); Cheers!
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23019070

http://stackoverflow.com/comment/35154800
type: Comment
has text: In a AsyncTask. I checked if the method is called with the debugger and some breakpoints.
type: QuestionComment
comment on: http://stackoverflow.com/q/23014721
score: 0

http://stackoverflow.com/a/23057712
has comment: http://stackoverflow.com/comment/35233240
has comment: http://stackoverflow.com/comment/35233027
has comment: http://stackoverflow.com/comment/35233558
has comment: http://stackoverflow.com/comment/35234112
has comment: http://stackoverflow.com/comment/35233036
answers question: http://stackoverflow.com/q/23057620
has body: Both has the same memory consumption (O(1)) but the latter gives more work to the garbage collector since after each method run MySecondClass becomes eligible for garbage collection. The first option makes sense if your methods are functional and you can't mess up the state of var1 (MySecondClass). So basically without more information it is hard to tell which one to choose.
has comment: http://stackoverflow.com/comment/35233902
has comment: http://stackoverflow.com/comment/35233144
has comment: http://stackoverflow.com/comment/35233374
has comment: http://stackoverflow.com/comment/35232931
has comment: http://stackoverflow.com/comment/35233117
has comment: http://stackoverflow.com/comment/35233583
has comment: http://stackoverflow.com/comment/35273621
has comment: http://stackoverflow.com/comment/35233708
has comment: http://stackoverflow.com/comment/35233974
has comment: http://stackoverflow.com/comment/35264099
has comment: http://stackoverflow.com/comment/35232972
score: 0
has comment: http://stackoverflow.com/comment/35235842
has comment: http://stackoverflow.com/comment/35234249
has comment: http://stackoverflow.com/comment/35233237
type: Answer
has comment: http://stackoverflow.com/comment/35233060
has comment: http://stackoverflow.com/comment/35233477
has comment: http://stackoverflow.com/comment/35233118

http://stackoverflow.com/comment/35083771
type: AnswerComment
type: Comment
has text: @JohnSetter no worries. From your profile it looks like you are teaching yourself Java. Kudos to you (I <3 Java!), it will be very rewarding in the end. The `try/catch` block is not unique to Java, many languages have it, or something similar. You use `try/catch` blocks anytime you are about to attempt some "risky" code. :)
comment on: http://stackoverflow.com/a/22975093
score: 0

http://stackoverflow.com/comment/35229911
score: 0
type: Comment
type: AnswerComment
has text: Thanks! HibernateJpaVendorAdapter would only be used if there where no persistence.xml present in the project
comment on: http://stackoverflow.com/a/23055536

http://stackoverflow.com/comment/35129688
comment on: http://stackoverflow.com/a/23000529
type: AnswerComment
has text: I sorry but Im very new with Java and I do not know how to do that. Please help.
type: Comment
score: 0

http://stackoverflow.com/a/23117028
upvote count: 4
score: 4
has body: From the JavaDocs: The number that is passed in represents the distance, measured in values, between each major tick A major tick mark would be the larger of the tick marks. With the minor obviously being the smaller ones. Tick marks on a slider correspond to values. Here is an example of a slider that contains 20 values: The major ticks correspond to the values 0, 5, 10, 15, and 20.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23117000
type: Answer
has comment: http://stackoverflow.com/comment/35339438
answers question: http://stackoverflow.com/q/23117000

http://stackoverflow.com/a/23044731
has body: If you really have to use split you can use something like String[] array = string.split("(?&lt;=\\G[^,]{1,100},[^,]{1,100},[^,]{1,100},[^,]{1,100}),"); Explanation if idea in my previous answer on similar but simpler topic Demo: String string = "NNP,PERSON,true,?,IN,O,false,pobj,NNP,ORGANIZATION,true,?,p"; String[] array = string.split("(?&lt;=\\G[^,]{1,100},[^,]{1,100},[^,]{1,100},[^,]{1,100}),"); for (String s : array) System.out.println(s); output: NNP,PERSON,true,? IN,O,false,pobj NNP,ORGANIZATION,true,? p But if there is any chance that you don't have to use split but you still want to use regex then I encourage you to use Pattern and Matcher classes to create simple regex which can find parts you are interested in, not complicated regex to find parts you want to get rid of. I mean something like any xx,xxx,xxx,xxx part where x is not , any xx or xx,xx or xxx,xxx,xxx parts if they are placed at the end of string (to catch rest of data unmatched by regex from point 1.) So Pattern p = Pattern.compile("[^,]+(,[^,]+){3}|[^,]+(,[^,]+){0,2}$"); should do the trick. Another solution and probably the fastest (and quite easy to write) would be creating your own parser which will iterate over all characters from your string, store them in some buffer, calculate how many , already occurred and if number is multiplication of 4 clear buffer and write its contend to array (or better dynamic collection like list). Such parser can look like public static List&lt;String&gt; parse(String s){ List&lt;String&gt; tokens = new ArrayList&lt;&gt;(); StringBuilder sb = new StringBuilder(); int commaCounter = 0; for (char ch: s.toCharArray()){ if (ch==',' &amp;&amp; ++commaCounter == 4){ tokens.add(sb.toString()); sb.delete(0, sb.length()); commaCounter = 0; }else{ sb.append(ch); } } if (sb.length()&gt;0) tokens.add(sb.toString()); return tokens; } You can later convert List to array if you need but I would stay with List.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23044557
accepted answer of: http://stackoverflow.com/q/23044557
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/35318301
has text: A map of maps? Sounds fishy; what are you trying to do exactly?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23105048

http://stackoverflow.com/a/23101818
accepted answer of: http://stackoverflow.com/q/23101548
answers question: http://stackoverflow.com/q/23101548
type: Answer
has body: You can create a new process using ProcessBuilder class and that process automatically adds as new task in Task Manager. for ex: ProcessBuilder child =new ProcessBuilder("notepad.exe",""); child.start(); Using ProcessBuilder I open a notepad, as soon as it opens you can view notepad.exe task in your Task Manager.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/35103273
score: 0
has text: @carlspring I can't post the pom (as this is a closed source project) but I'll try to come up with a minimal example that demonstrates the problem.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22984368

http://stackoverflow.com/a/23116779
accepted answer of: http://stackoverflow.com/q/23115132
answers question: http://stackoverflow.com/q/23115132
type: AcceptedAnswer
downvote count: 0
has body: Relying on replaceAll is probably the biggest performance killer as it compiles the regex again and again. The use of regexes for everything is probably the second most significant problem. Assuming all usernames start with @, I'd replace // Delete all usernames mentioned (may run multiple times) text = text.replaceAll("@AshStewart09", ""); by a loop copying everything until it founds a @, then checking if the following chars match any of the listed usernames and possibly skipping them. For this lookup you could use a trie. A simpler method would be a replaceAll-like loop for the regex #\w+ together with a HashMap lookup. // Delete all RT (retweets flags) text = text.replaceAll("RT", ""); Here, private static final Pattern RT_PATTERN = Pattern.compile("RT"); is a sure win. All the following parts could be handled similarly. Instead of // Delete all special characters except spaces text = text.replaceAll("[^a-zA-Z0-9 ]+", "").trim(); you could use Guava's CharMatcher. The method removeFrom does exactly what you did, but collapseFrom or trimAndCollapseFrom might be better.
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/a/23114088
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23107099
type: Answer
has comment: http://stackoverflow.com/comment/35334894
has body: You can certainly add fields to the index, just not Fields. It's fairly simple for StringField and TextField, since there is a nice convenience method for you to use. For a StringField, something like: index.addField("thestring", text, new KeywordAnalyzer()); For a TextField: index.addField("sometext", text, new StandardAnalyzer(Version.LUCENE_47)); For an IntField and other numerics, you'll need to produce the tokenstream yourself. NumericTokenStream is the class of interest here: NumericTokenStream stream = new NumericTokenStream(); stream.setIntValue(myInt); index.addField("aninteger", stream);
has comment: http://stackoverflow.com/comment/35334733
accepted answer of: http://stackoverflow.com/q/23107099
score: 0

http://stackoverflow.com/q/22996276
tagged with: illegalstateexception
answer count: 1
has comment: http://stackoverflow.com/comment/35121941
tagged with: timer
has body: I made a game that counts how many times you can hold a ball (rectangle) in the air. The problem is that I want to let the ball move faster every time. The initial speed is 10 and I want it to count down every time the ball goes up again (the lower the "speed"-variable the faster te real speed). But when the ball needs to go faster i get an IllegalStateException on the line where i do this: "spelTimer.schedule(panel.spelTask, 0, speed);" how can i solve the problem? import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Spel extends JPanel implements KeyListener { public Rectangle screen, ball, block; public Rectangle bounds; public JFrame frame; public SpelTimerTask spelTask; public boolean down, right, starten = false; public JButton start; public int counter = 0; public JLabel score; public static int speed = 10; public static java.util.Timer spelTimer; public static Spel panel; public Spel(){ super(); screen = new Rectangle(0, 0, 600, 400); ball = new Rectangle(0, 0, 20, 20); bounds = new Rectangle(0, 0, 600, 400); block = new Rectangle(bounds.width/2, bounds.height-50, 40, 10); frame = new JFrame("Super tof spel van Stan \u00a9"); spelTask = new SpelTimerTask(); score = new JLabel("0"); score.hide(); add(score); addKeyListener(this); setFocusable(true); start = new JButton("Start"); start.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { starten = true; ball = new Rectangle(0, 0, 20, 20); start.setFocusable(false); start.hide(); score.show(); } }); add(start); } class SpelTimerTask extends TimerTask{ public void run(){ repaint(); if(starten){ moveBall(); frame.repaint(); } } } public void paintComponent(Graphics g){ bounds = g.getClipBounds(); g.clearRect(screen.x, screen.y, screen.width, screen.height); g.fillRect(ball.x, ball.y, ball.width, ball.height); g.fillRect(block.x, block.y, block.width, block.height); } public void moveBall(){ if (right) ball.x+=1; else ball.x-=…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35122159
tagged with: swing
has comment: http://stackoverflow.com/comment/35121585
has answer: http://stackoverflow.com/a/22997332
tagged with: graphics
tagged with: java
has title: How can i change the speed on my Timer() during my game?
type: Question
has comment: http://stackoverflow.com/comment/35121807
score: 0

http://stackoverflow.com/q/23092361
has comment: http://stackoverflow.com/comment/35296316
tagged with: if-statement
has body: I know that the error may be in the if statement, but how am I suppose to write it so that it can work? This program is suppose to know that if you have a "i" room, you have to pay for the nurse service but if you have a "d" room, you have to pay for the telephone and TV service. // PROCESSING if (room == "I") { // Begin if (room == "I") if (nurse == "X") { // begin if (nurse == "X") roomCost = (double)days * I_COST; TVCost = X_COST; phoneCost = X_COST; nurseCost = (double)days * X_COST; } // end if (nurse == "X") else if (nurse == "S"){ // begin else if (nurse == "S") roomCost = (double)days * I_COST; TVCost = X_COST; phoneCost = X_COST; nurseCost = (double)days * S_COST; } // end else if (nurse == "S") else if (nurse == "N") { // begin else if (nurse == "N") roomCost = (double)days * I_COST; TVCost = X_COST; phoneCost = X_COST; nurseCost = (double)days * N_COST; } // end else if (nurse == "N") } // end if (room == "I") if (room == "D") { // Begin if (room == "D") if (TV == "V" &amp;&amp; phone == "T") { // begin if (TV == "V" &amp;&amp; phone == "T") roomCost = (double)days * D_COST; nurseCost = X_COST; TVCost = (double)days * V_COST; phoneCost = (double)days * T_COST; } // end if (TV == "V" &amp;&amp; phone == "T") else if (TV == "V" &amp;&amp; phone == "X") { // begin else if (TV == "V" &amp;&amp; phone == "X") roomCost = (double)days * D_COST; nurseCost = X_COST; TVCost = (double)days * V_COST; phoneCost = X_COST; } // end else if (TV == "V" &amp;&amp; phone == "X") else if (TV == "X" &amp;&amp; phone == "T") { // begin else if (TV == "X" &amp;&amp; phone == "T") roomCost = (double)days * D_COST; nurseCost = X_COST; TVCost = X_COST; phoneCost = (double)days * T_COST; } // end else if (TV == "V" &amp;&amp; phone == "X") else if (TV == "X" &amp;&amp; phone == "X") { // begin else if (TV == "X" &amp;&amp; phone == "X") roomCost = (double)days * D_COST; nurseCost = X_COST; TVCost = X_COST; phoneCost = X_COST; } // end else if (TV == "X" &amp;&amp; phone == "X") } /…
has comment: http://stackoverflow.com/comment/35296491
answer count: 2
has comment: http://stackoverflow.com/comment/35296245
has title: Nested if statement - variable might not have been initialized
accepted answer: http://stackoverflow.com/a/23092514
has comment: http://stackoverflow.com/comment/35296163
has comment: http://stackoverflow.com/comment/35296067
has answer: http://stackoverflow.com/a/23092648
has comment: http://stackoverflow.com/comment/35296107
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23092648
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35296217
has answer: http://stackoverflow.com/a/23092514
type: Question

http://stackoverflow.com/comment/35195268
has text: I guess you're right, there should be better ways of doing it.
comment on: http://stackoverflow.com/a/23036775
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23064982
has comment: http://stackoverflow.com/comment/35249058
type: Question
has title: Java applet dispose window after closing applet
has comment: http://stackoverflow.com/comment/35274602
has comment: http://stackoverflow.com/comment/48546889
has body: Just a quick question. I am creating an applet in Eclipse with Java. I run the program, the applet appears on the screen and everything is good. But when I hit close (cross on the applet window) it closes the window, and the clean grey window stays on the screen with words "applet disposed". Sometimes after half a minute it closes by itself. How can I get rid of this window? I am on osx. /* * File: Add3Inegers.java * --------------------------- * This program adds 3 integers. */ /* Library Package imports */ import acm.program.*; //import java.awt.*; /* Creates Add3Integers class */ public class Add3Integers extends ConsoleProgram { /* Set Applet window dimensions */ public void init() { setSize(500, 500); } /* Creates run() method */ public void run() { println("This program adds three integers."); int n1 = readInt("Enter first number:"); int n2 = readInt("Enter second number:"); int n3 = readInt("Enter third number:"); int total = n1 + n2 + n3; println("The total is: " + total + "."); } }
downvote count: 0
linked to: http://stackoverflow.com/q/17872245
tagged with: applet
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35246560
has comment: http://stackoverflow.com/comment/35257516
has comment: http://stackoverflow.com/comment/35249102
answer count: 0
tagged with: acm-java-libraries
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/35240385
type: QuestionComment
comment on: http://stackoverflow.com/q/23060994
has text: I would try `flush()`ing output after every write
score: 0
type: Comment

http://stackoverflow.com/a/23089714
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23089648
score: 1
upvote count: 1
has body: Simple Phrase Print stack trace tells you two things: Where you are (in the code) How you got there Example If main() calls foo(), foo() calls bar(), and bar() calls printStackTrace(), you will get a structure that looks like main() => foo() => bar().
has comment: http://stackoverflow.com/comment/35292069

http://stackoverflow.com/q/22980858
tagged with: gradle
type: Question
tagged with: spring-boot
score: 0
accepted answer: http://stackoverflow.com/a/22980951
answer count: 1
has answer: http://stackoverflow.com/a/22980951
tagged with: spring
tagged with: spring-mvc
has title: The absolute uri: http://www.springframework.org/tags cannot be resolved in either web.xml or the jar files deployed with this application
type: AnsweredQuestion
has body: I know that this question had been asked before. But none of the previous answers apply to my case. I am using gradle and spring boot. When I use gradlew bootRun everything is OK. But when I use gradlew clean build &amp;&amp; java -jar build\libs\myjar.jar I get the following error when I open my jsp files The absolute uri: http://www.springframework.org/tags cannot be resolved in either web.xml or the jar files deployed with this application What is the difference between bootRun and clean build &amp;&amp; java -jar? If there is a problem in my build.gradle then how come bootRun runs successfully? Thanks for your answers.
tagged with: java

http://stackoverflow.com/comment/35094499
comment on: http://stackoverflow.com/a/22970618
score: 0
type: AnswerComment
has text: I tried out my intends and it was **successful with my last solution!** `Type hashMapType = new TypeToken<HashMap<String, User>>(){}.getType();`
type: Comment

http://stackoverflow.com/comment/35300372
comment on: http://stackoverflow.com/q/23094532
score: 0
type: Comment
type: QuestionComment
has text: Ideally I need to exclude ":NULL" with case insensitive , but thought that might complicate the regular expression.

http://stackoverflow.com/q/23086424
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35299190
has answer: http://stackoverflow.com/a/23094152
tagged with: security
has body: I'm guiding myself with this answer over here, which explains how to use both AES and RSA. I managed to successfully implement the AES part with an util class in which I use a passphrase to generate keys. This passphrase will not change, the purpose of this is to encrypt a password before encoding it and saving it to a database. Then whenever I need to decrypt this password I can do it with the same passphrase, which should generate the same key. I've got this working. Now my question begins with RSA. I have to send via JSON through a Java JAX-RS web service the info to register an user. HTTPS/SSL is out of the question for... "tech" reasons. So instead I'm trying to at the very least, send the password encrypted with a public key. and decrypt it with the private key on the server. I then encrypt it with AES and store it in the database. How would my client (android) know the public key before any of this even happens if I have to generate different keys every time?
type: AnsweredQuestion
tagged with: android
tagged with: cryptography
tagged with: jax-rs
type: Question
accepted answer: http://stackoverflow.com/a/23094152
answer count: 1
has title: RSA keys keys static generation

http://stackoverflow.com/comment/35207282
score: 0
has text: I am not able reach that web page,
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23035446

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/22970148
tags question: http://stackoverflow.com/q/23119830
tags question: http://stackoverflow.com/q/23097030
tags question: http://stackoverflow.com/q/23112537
tags question: http://stackoverflow.com/q/23031087
type: Tag
tags question: http://stackoverflow.com/q/23094016
tags question: http://stackoverflow.com/q/22996276
tags question: http://stackoverflow.com/q/23100725
tags question: http://stackoverflow.com/q/23112985
tags question: http://stackoverflow.com/q/23121339
tags question: http://stackoverflow.com/q/23096870
tags question: http://stackoverflow.com/q/22972179
tags question: http://stackoverflow.com/q/23065061
tags question: http://stackoverflow.com/q/23097281
tags question: http://stackoverflow.com/q/23020722
tags question: http://stackoverflow.com/q/23014682
tags question: http://stackoverflow.com/q/22973871
tags question: http://stackoverflow.com/q/23080757
tags question: http://stackoverflow.com/q/23089866
tags question: http://stackoverflow.com/q/23122492
tags question: http://stackoverflow.com/q/23061863
tags question: http://stackoverflow.com/q/23092029
tags question: http://stackoverflow.com/q/23035266
tags question: http://stackoverflow.com/q/23039389
tags question: http://stackoverflow.com/q/23073543
tags question: http://stackoverflow.com/q/23095631
tags question: http://stackoverflow.com/q/23083057
tags question: http://stackoverflow.com/q/22999977

http://stackoverflow.com/q/23118074
tagged with: pdfbox
answer count: 3
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
has body: Is there a way to add additional font styles into Apache Pdfbox? We're currently trying to work around printing PDFs in our system (currently being done with PDF-Renderer.) I have been looking at various alternatives (pdfbox, jpedal, jPDFPrint) Our hope is for a free GPL compatible library to use, and as such we're leaning towards pdfbox. I have been able to write some sample code to print out the pdf which 'works'. See below: PDDocument doc; try { doc = PDDocument.load("test.pdf"); doc.print(); } catch (Exception e) { // Come up with better thing to do on fail. e.printStackTrace(); } As I mentioned, this works but the problem I'm running into is that PdfBox doesn't seem to be recognizing the fonts used in the pdf, and as such changes the font being used. As a result the document looks very odd (spacing and character size are different and look bizarre). I routinely see the following log message, or things like it: Apr 16, 2014 2:56:21 PM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString WARNING: Changing font on &lt; > from &lt; NimbusMono > to the default font Does anyone know of a way (or a reference) on how to approach adding a new fonttype into pdfbox? Or barring that, how to change the default font type? From what I can tell, pdfbox supports 14 standard fonts. Unfortunately NimbusMono is not one of them. Any guidance would be appreciated.
has answer: http://stackoverflow.com/a/29284242
favorite count: 0
has comment: http://stackoverflow.com/comment/124463770
possible better answer: http://stackoverflow.com/a/43740562
score: 11
upvote count: 11
has title: Adding fonts to Apache Pdfbox?
tagged with: fonts
tagged with: java
has answer: http://stackoverflow.com/a/43740562
type: Question
has answer: http://stackoverflow.com/a/23140479
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23140479
linked to: http://stackoverflow.com/q/41313554

http://stackoverflow.com/comment/35081632
score: 3
comment on: http://stackoverflow.com/q/22973918
has text: Please post the exception stacktrace
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23020088
has answer: http://stackoverflow.com/a/23028175
score: 1
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/12585380
has comment: http://stackoverflow.com/comment/35165174
has title: Unable to locate the Javac Compiler in MAVEN EXPORT
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has body: i want to Export a Java Project with maven. But i became this Error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project craftbukkit: Compilation failure [ERROR] Unable to locate the Javac Compiler in: [ERROR] C:\Program Files\Java\jre8\..\lib\tools.jar [ERROR] Please ensure you are using JDK 1.4 or above and [ERROR] not a JRE (the com.sun.tools.javac.Main class is required). [ERROR] In most cases you can change the location of your Java [ERROR] installation by setting the JAVA_HOME environment variable. [ERROR] -&gt; [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException I have alredy set my JAVA home to this Directory: C:\Program Files\Java\jdk1.8.0 What must i do, that it work? Thanks!

http://stackoverflow.com/q/22975225
type: Question
upvote count: 2
answer count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/35084135
has title: Android SQLite query day of month
possible better answer: http://stackoverflow.com/a/49503022
has answer: http://stackoverflow.com/a/49503022
has body: I'm trying to recover some data from SQLite db that have a date less than today. I got the day from the calendar, it does not give the desired result: Calendar cal = Calendar.getInstance(); int dayofmonth = cal.get(Calendar.DAY_OF_MONTH); String sql = "SELECT SUM(filed1) FROM Table1 WHERE "+Table1.DATE+"&lt;= '%"+dayofmonth+"'";
tagged with: java
tagged with: calendar
has answer: http://stackoverflow.com/a/22981342
downvote count: 1
linked to: http://stackoverflow.com/q/38922754
tagged with: date
type: AnsweredQuestion
tagged with: sqlite
accepted answer: http://stackoverflow.com/a/22981342
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35084198

http://stackoverflow.com/q/22969000
linked to: http://stackoverflow.com/q/65035
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/22981486
upvote count: 3
tagged with: java
has body: Consider below code, public class Test { public void abc() { try { throw new OutOfMemoryError(); } finally { System.out.println("finally"); } } public static void main(String[] args) { new Test().abc(); } } Output : Exception in thread "main" finally java.lang.OutOfMemoryError at Test.abc(Test.java:5) at Test.main(Test.java:12) So, finally block is getting executed in the case, however above output is not fixed each time. So the question is, Here we are throwing OutOfMemoryError and finally block is getting executed. Is this true for every case ? If yes then finally block will be executed when OutOfMemoryError will be thrown in reality, means memory area expansion will be performed while execution and enough memory not available ?
type: Question
possible better answer: http://stackoverflow.com/a/22969148
has answer: http://stackoverflow.com/a/22969148
linked to: http://stackoverflow.com/q/7606953
has comment: http://stackoverflow.com/comment/35072033
has comment: http://stackoverflow.com/comment/35073028
tagged with: runtime-error
answer count: 2
has answer: http://stackoverflow.com/a/22981486
has title: Finally block will be executed in case of OutOfMemoryError?
downvote count: 0
has comment: http://stackoverflow.com/comment/35072238
favorite count: 0
tagged with: finally
tagged with: out-of-memory
tagged with: exception
has comment: http://stackoverflow.com/comment/35073080
has comment: http://stackoverflow.com/comment/35073516

http://stackoverflow.com/q/23125004
type: Question
downvote count: 2
has answer: http://stackoverflow.com/a/23125026
score: -1
has title: Java If else statement
possible better answer: http://stackoverflow.com/a/23125026
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/35353826
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23125061
accepted answer: http://stackoverflow.com/a/23125061
tagged with: java
has body: Hi I have 3 variables u v w and it will either equal zero or perform a simple division depending on the statement and i want to take those 3 values and apply it towards another if statement down below to do a compare equals but I am assuming that it can't read whatever u v w is from the above statements. How can i make this work? Thanks if(t3 != 0){ double u = t/t3; } else if(t4 != 0){ double v = t1/t4; } else if(t5 != 0){ double w = t2/t5; } else if(t3 == 0){ double u = 0; } else if(t4 == 0){ double v = 0; } else if(t5 == 0){ double w = 0; } if((u == v) &amp;&amp; (v == w)) { blah blah } else blah blah
has answer: http://stackoverflow.com/a/23125049
has comment: http://stackoverflow.com/comment/35354776

http://stackoverflow.com/a/23018372
has comment: http://stackoverflow.com/comment/35163316
has body: Try $HADOOP_PREFIX/bin/hadoop namenode -format instead of $HADOOP_PREFIX/bin/hdfs namenode -format
answers question: http://stackoverflow.com/q/23017937
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37674722

http://stackoverflow.com/q/22988844
has body: can I access cookies added in Javascript in my java servlet?? in my javascript I've done, var mydata = ace.edit("editor").getValue(); document.cookie="data="+mydata; how can I access this in my java servlet?
has title: Using Javascript cookies in Java
tagged with: javascript
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22988890
answer count: 1
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/22988890

http://stackoverflow.com/a/23021736
score: 4
type: Answer
answers question: http://stackoverflow.com/q/23021712
upvote count: 4
has body: Try s1.equals(s2); s1 == s2 compares the object references, not the string contents.
downvote count: 0

http://stackoverflow.com/q/23012829
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35152189
answer count: 0
type: UnansweredQuestion
tagged with: android-imageview
type: Question
has title: Align imageview vertically center in tablerow
tagged with: row
tagged with: java
tagged with: android-tablelayout
has comment: http://stackoverflow.com/comment/35151335
has comment: http://stackoverflow.com/comment/35151508
has comment: http://stackoverflow.com/comment/35151718
has body: I have created a dynamic table. The table is supposed to have a row in which there will be an imageview in the extreme left, a textview in the middle and a checkbox in the extreme right. All the controls are showing up. The textview and the checkbox is also vertically centered, but the inageview could not be centered, thus, the row looks bad. I want to put the imageview in a line with the textview and the checkbox. The above image shows the output which I am getting right now. I want the blue arrow to come in line with the textview and the checkbox. The source code of the activity: public class CalendarActivity extends Activity { TableLayout first_calendar_table; TableRow first_calendar_tr_data; int tableRowCount = 0; boolean showingFirst = true; String chkChecked = "false"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_calendar); first_calendar_table = (TableLayout) findViewById(R.id.first_calendar_table); tableHeads(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.calendar, menu); return true; } // method to generate table heads public void tableHeads() { // ---------------Calendar Table // Header----------------------------------------------- TableRow supplier_details_tr_head = new TableRow(this); supplier_details_tr_head.setId(10); supplier_details_tr_head.setBackgroundResource(R.drawable.list_header); supplier_details_tr_head.setLayoutParams(new LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); // ImageView Setup final ImageView imageView = new ImageView(this); // setting image resource imageView.setImageResource(R.drawable.closed_icon); imageView.setId(20); //imageView.setGravity(Gravity.CENTER); // adding view to layout supplier_details_tr_head.addView(imageView); TextView select_head = new TextView(this); select_head.setId(20); select_he…

http://stackoverflow.com/q/23010810
has body: I have the following code Vehicle v= new Vehicle(); Car car = v.getCar(); v.clear(); The clear() in vehicle is clear() { car=null; } I am trying to ensure that after I call clear() , no one else gets access to the car object. I can set it to null like I do above, but it doesn't stop anyone else from holding the reference to it, and can still access the memory location to get the data in there. I dont want to call System.gc() The use case is , after logout, i need to clear everything stored in the memory. also the storage mechanism is a singleton. Even if I avoid using singleton, this problem persists
possible better answer: http://stackoverflow.com/a/23010919
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/35149359
has answer: http://stackoverflow.com/a/23010985
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23010919
type: Question
has comment: http://stackoverflow.com/comment/35147642
has answer: http://stackoverflow.com/a/23010902
accepted answer: http://stackoverflow.com/a/23010902
linked to: http://stackoverflow.com/q/10951820
has title: How to clear memory properly?
score: 0
answer count: 3

http://stackoverflow.com/comment/35176782
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23026058
has text: i dont think the servlet-api.jar file supports different encoded file (like doc,docx) data to be uploaded, you need to upload file using some external jar only. Similarly if you read file using java then java can only read .txt file not others like : doc,docx,pdf. we need to use external jars to read these files.

http://stackoverflow.com/a/23082389
has comment: http://stackoverflow.com/comment/35282251
has comment: http://stackoverflow.com/comment/35282213
has body: Please DON'T use profiles for this. The problem with profiles is that the resulting artifact contains no information about the profiles used to build it. Basic rule: A profile must not change the result of the build. Or the other way around: If you build the same source code revision, the result must be identical, regardless of profiles or arguments. (see How to really use Maven profiles (without endangering your karma) for more information) So, a better way to do it would be to create two war modules, say my-project and my-project-dev.war. If my-project-dev.war has a war-dependency on my-project.war, it will use your production war as overlay, resulting in a combined war files using your production and your development time resources. Added bonus feature: in your development war, you can override entries of your production war (say, logging-config).
has comment: http://stackoverflow.com/comment/35280480
downvote count: 5
has comment: http://stackoverflow.com/comment/35278613
answers question: http://stackoverflow.com/q/23082104
score: -4
has comment: http://stackoverflow.com/comment/35282008
has comment: http://stackoverflow.com/comment/35277632
has comment: http://stackoverflow.com/comment/35280511
type: Answer
has comment: http://stackoverflow.com/comment/35281262
has comment: http://stackoverflow.com/comment/35282457
has comment: http://stackoverflow.com/comment/35280667
has comment: http://stackoverflow.com/comment/35282217
upvote count: 1

http://stackoverflow.com/q/23037732
has body: I'm trying to make a chat bot using Program AB and AIML. I am trying to get the AIML files off the internet so the bot can read them and use them. I wrote some code saying to get a text file of a URL, but that gives me an unhandled exception, and yes, I added the internet permission in the Manifest. btw I am new to Java. Here is the MainActivity.java package com.NautGames.xecta.app; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.EditText; import org.alicebot.ab.Chat; import org.alicebot.ab.Bot; import android.view.View; import android.widget.Button; import java.io.BufferedReader; import java.net.MalformedURLException; import java.io.InputStreamReader; import java.net.URL; import java.io.IOException; public class MainActivity extends ActionBarActivity { //private EditText botIn = (EditText) findViewById(R.id.botInput);; //private Button botSubmit = (Button) findViewById(R.id.tellBot);; //String botString = botIn.getText().toString(); EditText mEdit; public String botIn; private String readData() { try { // Create a URL for the desired page URL url = new URL("https://www.dropbox.com/sh/9cyfz0b45mj6szr/7pBuupNz3N"); // Read all the text returned by the server BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String str; while ((str = in.readLine()) != null) { // str is one line of text; readLine() strips the newline character(s) } in.close(); } catch (MalformedURLException e) { //do nothing } catch (IOException e) { //do nothing } return "URL"; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void buttonOnClick(View v) { Button button=(Button) v; mEdit = (EditText)findViewById(R.id.editText1); //Creating bot String botname="xecta"; String path= readData(); Bot xecta = new Bot(botname, path); Chat chatSession = new Chat(xecta); String r…
tagged with: java
type: Question
score: 0
tagged with: chatbot
has title: How to get a folder off the internet using Java in Android Studio?
answer count: 1
tagged with: android-studio
tagged with: android
has answer: http://stackoverflow.com/a/23037771
accepted answer: http://stackoverflow.com/a/23037771
type: AnsweredQuestion

http://stackoverflow.com/q/23078525
has answer: http://stackoverflow.com/a/23078849
has comment: http://stackoverflow.com/comment/35271003
accepted answer: http://stackoverflow.com/a/23078849
has comment: http://stackoverflow.com/comment/35271103
has comment: http://stackoverflow.com/comment/35270939
has comment: http://stackoverflow.com/comment/35270984
tagged with: string
score: -6
favorite count: 0
has title: String object creation in loop
possible better answer: http://stackoverflow.com/a/23079210
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35271388
tagged with: java
upvote count: 1
downvote count: 7
has comment: http://stackoverflow.com/comment/35270920
type: Question
tagged with: object
answer count: 2
has answer: http://stackoverflow.com/a/23079210
has body: How many objects will be created by the following code? for(int i = 0; i&lt; = 1000 ; i++) { String s = new String("Hello"); } And will throw an OutOfMemory exception or not?

http://stackoverflow.com/comment/35187260
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23014852
has text: What do you mean you don't have a container?

http://stackoverflow.com/comment/35142157
score: 0
has text: So you want empty log files on the days that nothing happens?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23007799

http://stackoverflow.com/q/23034404
has answer: http://stackoverflow.com/a/23034665
has comment: http://stackoverflow.com/comment/35190944
answer count: 3
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/14204905
has body: Hey guys i am building a java calculator and everything works fine except the fact that i am doing calculations with double numbers. The problem is that when i want to do 0.3 + 0.5 = 0.8 works fine, but when i do 6 + 6 = 12.0 How can i fix this so when the result is .0 at the end it displays an integer? My code is: public void actionPerformed(ActionEvent e) { int j = 0; r2 = Double.parseDouble(textField.getText()); if (option.equals("+")) { result = r1 + r2; } if (option.equals("-")) { result = r1 - r2; } if (option.equals("*")) { result = r1 * r2; } if (option.equals("/")) { result = r1 / r2; } textField.setText(result + " "); }
has answer: http://stackoverflow.com/a/23034489
accepted answer: http://stackoverflow.com/a/23034665
upvote count: 1
tagged with: swing
has title: Calculator in java displays double instead if int
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23034484
has answer: http://stackoverflow.com/a/23034484

http://stackoverflow.com/comment/35209071
type: AnswerComment
has text: Humm... the code has all the suggestion you wrote, but doesn't work.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23043385

http://stackoverflow.com/a/23096829
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23096807
upvote count: 5
answers question: http://stackoverflow.com/q/23096807
score: 5
has body: The list items are removed one-by-one and when items are removed from the list, the indexes of everything that comes after it are shifted back. This is why the indexes end up referring to different items than in the initial position. If you can't see this easily, step through the code in a debugger or even "run" the list manipulations manually on paper, step by step.

http://stackoverflow.com/a/23031900
answers question: http://stackoverflow.com/q/23024957
has body: Thanks for the help everyone, I figured out how to make my program do what I wanted with help from Jeff Ward and Phillip. The new WORKING code is below! :) //Beginning of ModifyBooks Class Books[] Library = new Books[10]; Library[0] = new Books(); Library[1] = new Books("Lovely Bones", 12345, 20); Library[2] = new Books("Birds in a Fence", 123456, 13); Library[3] = new Books("Hunger Games", 1234567, 14); Library[4] = new Books("Titanic", 12345678, 12); Library[5] = new Books("Heroes", 123456789, 21); Library[6] = new Books(Library[0]); Library[7] = new Books(Library[0]); Library[8] = new Books(Library[2]); Library[9] = new Books(Library[3]); //Changing all prices of books for (int i = 0 ; i &lt; Library.length ; i++){ Library[i].price = i + 5; } //Keyboard configuration Scanner kb = new Scanner(System.in); //Getting user information System.out.println("Please enter a book's title:"); String UserTitle = kb.nextLine(); System.out.println("Please enter a book's ISBN Number:"); int UserISBN = kb.nextInt(); System.out.println("Your entered book's title is " + UserTitle + " and the ISBN is " + UserISBN); int[] sameBook = new int[10]; //new array that will carry the index of each match int counter = 0; //tracks number of matches int globalMin = 200; //lowest price for the matches books, initialized at 200 so the program functions properly //Finding the matches in main array, and casting their indexes in another array for (int i = 0 ; i &lt; Library.length ; i++ ){ if (UserTitle.equalsIgnoreCase(Library[i].title) &amp;&amp; UserISBN == Library[i].ISBN){ sameBook[i] = i; counter++; if (Library[i].price &lt; globalMin){ globalMin = Library[i].price; } } else { sameBook[i] = 0; } } //Creating a new array that only contains the amount of matches there are, containing their indexes int[] smallerLibrary = new int[counter]; int j = 0; for (int i = 0 ; i &lt; sameBook.length ; i++){ if (sameBook[i] != 0){ smallerLibrary[j++] = sameBook[i]; } } //Text notifying user of matches and t…
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35196545

http://stackoverflow.com/q/22999482
possible better answer: http://stackoverflow.com/a/22999519
tagged with: foreach
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
has title: Java for each - Searching through ArrayList
accepted answer: http://stackoverflow.com/a/22999508
answer count: 6
tagged with: arraylist
has answer: http://stackoverflow.com/a/22999564
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/35127547
has answer: http://stackoverflow.com/a/22999667
has answer: http://stackoverflow.com/a/22999559
has comment: http://stackoverflow.com/comment/35127541
has answer: http://stackoverflow.com/a/22999519
has answer: http://stackoverflow.com/a/22999508
has answer: http://stackoverflow.com/a/22999537
has body: I am trying to search through an arraylist and return an object. I have a Vehicle class in which I have a method named search and as parameter the registration number and arraylist are passed as parameters. However the problem is that when going through the for each the system is never trying to compare the 2 Strings (reg numbers) and therefore the method is always returning an empty object. Method: public Vehicle search(String id, List&lt;Vehicle&gt; myList) { Vehicle currenctVeh = new Vehicle(); for(Vehicle v: myList) { if(v.regNo == id) { currenctVeh = v; } } return currenctVeh; } Being Called: Vehicle searchVeh = new Vehicle(); String regNum = JOptionPane.showInputDialog(null, "Enter Vehicle Registration Number"); searchVeh.search(regNum, allVehicles); System.out.println(searchVeh.toString());

http://stackoverflow.com/comment/35083603
has text: Java != JavaScript. I wouldn't try to write Java that way. Those would just be methods in your class. I see no need for inner classes here.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22975007
type: Comment

http://stackoverflow.com/comment/35474529
comment on: http://stackoverflow.com/a/23132355
type: Comment
has text: try to run the command cat * > newMergedFile in the folder you want to merge.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35260329
type: Comment
has text: @PML The perils of not using an IDE to answer StackOverflow questions.
comment on: http://stackoverflow.com/a/23072168
score: 0
type: AnswerComment

http://stackoverflow.com/a/23083969
answers question: http://stackoverflow.com/q/23075398
has body: PropertyPlaceholderConfigurer As of Spring 3.1, PropertySourcesPlaceholderConfigurer should be used preferentially over this implementation; it is more flexible through taking advantage of the Environment and PropertySource mechanisms also made available in Spring 3.1. Using a PropertySourcesPlaceholderConfigurer you can load properties from any path on the filesystem with: PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setLocations(new Resource[] { new FileSystemResource(fileName), });
score: 0
type: Answer

http://stackoverflow.com/comment/35363579
type: AnswerComment
score: 0
type: Comment
has text: The function has no zeros. Also, fitness is negative for everything to the left of the singularity at around `x = 1`.
comment on: http://stackoverflow.com/a/23130244

http://stackoverflow.com/comment/35313911
has text: @SanjayRajjadi MySQL is on the same machine, connecting to localhost.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23102747
score: 0

http://stackoverflow.com/q/23049088
has comment: http://stackoverflow.com/comment/35217487
has comment: http://stackoverflow.com/comment/35218231
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23049345
has comment: http://stackoverflow.com/comment/35217895
tagged with: java
has comment: http://stackoverflow.com/comment/35217780
has comment: http://stackoverflow.com/comment/35217626
type: Question
has body: import java.util.*; public class Pooo { public static void main(String[] args) { int card1; int card2; int card3; int card4; int card5; int numSuit1; int numSuit2; int numSuit3; int numSuit4; int numSuit5; int temp; int winner = 0; int counter = 0; int idcounter = 0; int frcounter = 0; String YN = "EMP"; String Finish = ""; String Selection = "EMP"; String Selection1 = "EMP"; String Selection2 = "EMP"; String Selection3 = "EMP"; String Selection4 = "EMP"; String Selection5 = "EMP"; String Selection6 = "EMP"; String Selection7 = "EMP"; String Selection8 = "EMP"; String Selection9 = "EMP"; String RES = ""; String Suit1 = ""; String Suit2 = ""; String Suit3 = ""; String Suit4 = ""; String Suit5 = ""; String card1s = ""; String card2s = ""; String card3s = ""; String card4s = ""; String card5s = ""; Scanner scn = new Scanner(System.in); while ((!YN.equalsIgnoreCase("Exit")) &amp; (winner == 0)) { counter = counter + 1; idcounter = 0; // counter for identification // pick 5 random numbers for cards card1 = (int) (Math.random() * 13) + 1; card2 = (int) (Math.random() * 13) + 1; card3 = (int) (Math.random() * 13) + 1; card4 = (int) (Math.random() * 13) + 1; card5 = (int) (Math.random() * 13) + 1; // Order from smallest to largest int cards[] = { card1, card2, card3, card4, card5 }; boolean fixed = false; while (fixed == false) { fixed = true; for (int i = 0; i &lt; cards.length - 1; i++) { if (cards[i] &gt; cards[i + 1]) { temp = cards[i + 1]; cards[i + 1] = cards[i]; cards[i] = temp; fixed = false; } } } // Generating suits for the 5 cards numSuit1 = (int) (Math.random() * 4) + 1; numSuit2 = (int) (Math.random() * 4) + 1; numSuit3 = (int) (Math.random() * 4) + 1; numSuit4 = (int) (Math.random() * 4) + 1; numSuit5 = (int) (Math.random() * 4) + 1; // testing for repeat cards. If repeat, regenerate both cards' suits boolean regened = false; while (regened == false) { regened = true; while ((cards[0] == cards[1]) &amp; (numSuit1 == numSuit2)) { numSuit1 = (int) (Math.random()…
has comment: http://stackoverflow.com/comment/35217602
has title: Java Card game program stop in midway
has comment: http://stackoverflow.com/comment/35217799
score: 0
has comment: http://stackoverflow.com/comment/35217578
has comment: http://stackoverflow.com/comment/35217827
answer count: 1
has comment: http://stackoverflow.com/comment/35217496
has comment: http://stackoverflow.com/comment/35217704
accepted answer: http://stackoverflow.com/a/23049345
has comment: http://stackoverflow.com/comment/35217849
has comment: http://stackoverflow.com/comment/35217661
has comment: http://stackoverflow.com/comment/35217938
has comment: http://stackoverflow.com/comment/35217604

http://stackoverflow.com/q/23075030
has comment: http://stackoverflow.com/comment/35265293
score: -1
has comment: http://stackoverflow.com/comment/35265153
has comment: http://stackoverflow.com/comment/35265203
answer count: 1
has comment: http://stackoverflow.com/comment/35265220
favorite count: 0
has comment: http://stackoverflow.com/comment/35265392
has comment: http://stackoverflow.com/comment/35265283
type: UnansweredQuestion
has body: I have a requirement to read a stream of bytes from a remote system. The remote system has its own client API to read the bytes. But at my end, I have to convert the byte array to a POJO. While doing so, I am getting error java.io.StreamCorruptedException: invalid stream header:. To test the functionality, I wrote following program to convert a String to a byte array and then convert the byte array to an Object. public class ByteToObject { public static void main(String[] args) { try { final String str = "Tiger"; System.out.println("\nByte array for string '" + str + "' --> \n" + Arrays.toString(getByteArray(str))); System.out.println("Object read --> " + getObject(getByteArray(str))); } catch (Exception e) { e.printStackTrace(); } } private static byte[] getByteArray(final String str) throws Exception { return str.getBytes(CharEncoding.UTF_8); } private static Object getObject(final byte[] byteArray) throws Exception { InputStream byteArrayStream = null; ObjectInputStream inputStream = null; try { byteArrayStream = new ByteArrayInputStream(byteArray); inputStream = new ObjectInputStream(byteArrayStream); return inputStream.readObject(); } finally { if(null != byteArrayStream) { byteArrayStream.close(); } if(null != inputStream) { inputStream.close(); } } } } The output is: Byte array for string 'Tiger' --> [84, 105, 103, 101, 114] java.io.StreamCorruptedException: invalid stream header: 54696765 Object read --> null at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:804) at java.io.ObjectInputStream.(ObjectInputStream.java:299) at com.demo.serialize.ByteToObject.getObject(ByteToObject.java:41) at com.demo.serialize.ByteToObject.main(ByteToObject.java:24) Appreciate if someone can help what is wrong here?
has answer: http://stackoverflow.com/a/23075115
has comment: http://stackoverflow.com/comment/35265249
tagged with: java
has comment: http://stackoverflow.com/comment/35265084
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35265174
has comment: http://stackoverflow.com/comment/35265334
upvote count: 0
has title: Why reading byte array to an Object throws java.io.StreamCorruptedException?

http://stackoverflow.com/comment/35097754
comment on: http://stackoverflow.com/q/22983399
type: QuestionComment
type: Comment
has text: is this a json string?? If it is JSON then use JSON parser
score: 0

http://stackoverflow.com/comment/35104524
type: QuestionComment
type: Comment
has text: i need website like default scrolling when there is more content available ...
comment on: http://stackoverflow.com/q/22987016
score: 0

http://stackoverflow.com/q/23038917
score: 5
tagged with: layout
upvote count: 5
has title: Calendar GridLayout
has body: I'm having difficulties getting my header to be on it's own line. The header runs into the days of the week instead of showing the header and then at the bottom the number of days in the calendar. Is this missing a panel? I've tried multiple changes but I can't really tell package Exercise15_5; import java.awt.*; import javax.swing.*; import java.util.*; public class Exercise15_5 extends JFrame { public Exercise15_5(){ //Create panel with gridlayout JPanel calendar = new JPanel(new BorderLayout()); calendar.setLayout(new GridLayout(5,7)); //Add headers String[] headers = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}; for(int i = 0; i &lt;7; i++){ calendar.add(new JLabel("" + headers[i])); } //Add days to calendar for(int i = 1; i &lt;31; i++){ calendar.add(new JLabel("" + i)); } JPanel monthHeader = new JPanel(new BorderLayout()); monthHeader.add(new JTextField("\t\t\t04/2014"), BorderLayout.NORTH); monthHeader.add(calendar, BorderLayout.CENTER); add(monthHeader); } public static void main(String[] args) { Exercise15_5 frame = new Exercise15_5(); frame.setTitle("Exercise 15_5"); frame.setSize(600,300); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }
answer count: 2
has answer: http://stackoverflow.com/a/23038966
has answer: http://stackoverflow.com/a/23038934
tagged with: user-interface
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/17232038
type: UnansweredQuestion
tagged with: java
tagged with: swing
tagged with: calendar
type: Question

http://stackoverflow.com/comment/35353215
score: 1
comment on: http://stackoverflow.com/q/23124704
has text: When a Java program crashes, it typically leaves a trail...
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23048451
has comment: http://stackoverflow.com/comment/35217069
upvote count: 2
has comment: http://stackoverflow.com/comment/35216397
has title: Moving a sprite to the left or down is faster than moving it to the right or up
answer count: 1
has comment: http://stackoverflow.com/comment/35216575
has answer: http://stackoverflow.com/a/23048973
tagged with: java
tagged with: slick2d
tagged with: lwjgl
accepted answer: http://stackoverflow.com/a/23048973
downvote count: 0
has comment: http://stackoverflow.com/comment/35216516
has body: I am making a basic game with Slick2D and LWGJL but I am having a wierd issue that when i'm moving my player(an image) to the left/down it is slower than moving to the right/up. Input input = gc.getInput(); if(input.isKeyDown(Input.KEY_W)){ PlayerY += delta * .1f; } if(input.isKeyDown(Input.KEY_S)){ PlayerY -= delta * .1f; } if(input.isKeyDown(Input.KEY_A)){ PlayerX -= delta * .1f; } if(input.isKeyDown(Input.KEY_D)){ PlayerX += delta * .1f; } All of this code is in the method update() Edit: All of my code can be viewed in here https://www.dropbox.com/sh/p13sbxucmni36vd/K5XTaNOulm Any help will be appreciated
type: Question
score: 2
type: AnsweredQuestion
favorite count: 0

http://stackoverflow.com/comment/35111743
type: Comment
has text: Yes, start a new question. Provide all necessary information to avoid down votes.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22991000

http://stackoverflow.com/comment/35091555
type: Comment
has text: I think you are calling async task before declaration of textview.so its getting null pointer exception.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22979622

json-rpc
tag name: json-rpc
type: Tag
tags question: http://stackoverflow.com/q/22992702

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

http://stackoverflow.com/a/23116436
type: Answer
has body: first of all you can try catch blok to detect what is the error using this: try { //do parsing } catch (JSONException e) { //some exception handler code. } you can parse it like this: JSONArray jArray = new JSONArray(result); for(int i=0; i &lt; jArray.length(); i++) { JSONObject jObject = jArray.getJSONObject(i); String state_= jObject.getString("state")); //you can do to the others ............ }
score: 0
accepted answer of: http://stackoverflow.com/q/23116385
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23116385

http://stackoverflow.com/comment/139552076
comment on: http://stackoverflow.com/a/23014754
type: Comment
score: 0
has text: One can use `FormatFormat#toFormat()` to see what format it uses for positive and negative numbers. And one can use for instance `NumberFormat.getInstance().format(-4711.42)` to see how it formats numbers. Notice that `-` and `−` isn't the same character. So `NumberFormat.getInstance().parse("-12")` didn't work for me, but `NumberFormat.getInstance().parse("−12")` worked.
type: AnswerComment

http://stackoverflow.com/a/23078889
has comment: http://stackoverflow.com/comment/35274981
has body: What is your JVM heap settings now ? How much data do you load from the DB? Try -Xms 512m -Xmx 1028m -XX:PermSize=128m -XX:MaxPermSize=512m
has comment: http://stackoverflow.com/comment/35271853
has comment: http://stackoverflow.com/comment/35272177
accepted answer of: http://stackoverflow.com/q/23078838
answers question: http://stackoverflow.com/q/23078838
has comment: http://stackoverflow.com/comment/35271983
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35273508
has comment: http://stackoverflow.com/comment/35273397
type: Answer
has comment: http://stackoverflow.com/comment/35271821

http://stackoverflow.com/q/23098132
tagged with: java
accepted answer: http://stackoverflow.com/a/23103159
has comment: http://stackoverflow.com/comment/35306492
downvote count: 0
answer count: 1
favorite count: 0
tagged with: spring
has answer: http://stackoverflow.com/a/23103159
type: AnsweredQuestion
has title: Load a property file when context is loading giving the file path as a property of another property file
upvote count: 1
has body: I have a situation where I need to use two property files in my system. System.properties key.supportiveFile=C:\keypath\supportive.properties This key path which can be outside the classpath. I want to maintain path for the Supportive.properties as a key in System.properties. The supportive.properties file has supportive.properties. Supportive.properties has keys key1 , key2. properties in the supportive.properties file must load with the context. Ideally my property files will be appear as below. supportive.properties key1=value1 key2=value2 In spring.xml I tried to load the supportive.properties and inject key1 and key2 value defined in spring.xml like below. i. Loading the property files &lt;context:property-placeholder location="classpath:System.properties,file:${key.supportiveFile}"/&gt; ii. This is a sample bean how I want to inject my keys to a bean. &lt;bean id="helloWorldBean" class="com.sample.snippets.enterprise.services.HelloWorld"&gt; &lt;property name="prefixProp" value="${key1}" /&gt; &lt;property name="suffixProp" value="${key2}" /&gt; &lt;/bean&gt; Server log says Could not resolve placeholder 'key.supportiveFile' in [file:${key.supportiveFile}] but it fails and not loading the supportive.property file. Please advise how to fix this technically.
type: Question
linked to: http://stackoverflow.com/q/10627856
score: 1

http://stackoverflow.com/comment/35302954
score: 0
type: QuestionComment
has text: This what I can see on that line `The argument of type null should explicitly be cast to Object[] for the invocation of the varargs method invoke(Object, String, Object...) from type Deencapsulation. It could alternatively be cast to Object for a varargs invocation` and it is indeed failing.
type: Comment
comment on: http://stackoverflow.com/q/23096026

http://stackoverflow.com/comment/35275904
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23081395
has text: Yes it is exists. I have checked it.
score: 0

http://stackoverflow.com/comment/35375897
type: AnswerComment
comment on: http://stackoverflow.com/a/23124234
score: 0
type: Comment
has text: ok cool, I tried it and it worked...i have another question about the other average method I had defined as, the output is fine, but when I input like 2 or more gerbils for the amount of gerbils, it only outputs data for the first one entered

http://stackoverflow.com/a/23008348
upvote count: 2
has body: You can use @link. Something similar like below: /** * Links another class {@link com.package.ClassName}. */
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23008336
accepted answer of: http://stackoverflow.com/q/23008336
type: Answer
score: 2

http://stackoverflow.com/q/23014717
type: AnsweredQuestion
tagged with: autowired
has body: As well as I know, it is not possible to use @Autowired annotation for static fields using Spring. When I run my JBoss server, everything works well but I can see few warnings: Autowired annotation is not supported on static fields: private static ... I do not use this annotation really often (in this project I have not used it yet) but maybe some of my colleagues found it more useful. So, I took one of this warnings: Autowired annotation is not supported on static fields: private static java.lang.String com.my.package.MyClass.myVariable I opened this class and inside is: @Value("${params.myvariable}") private static String myVariable; // getter // setter I opened config.xml: &lt;bean id="myid" class="com.my.package.MyClass"&gt; &lt;property name="myVariable" value="${params.myvariable}" /&gt; &lt;/bean&gt; As a last thing, I searched in Eclipse of Autowired strings in my project. Size of the result set was 0. So my question is, what is a reason of warning: Autowired annotation is not supported on static fields in this case? Thank you in advance
type: Question
tagged with: java
score: 10
upvote count: 10
has title: What is a reason of warning: Autowired annotation is not supported on static fields
has answer: http://stackoverflow.com/a/23014765
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring
accepted answer: http://stackoverflow.com/a/23014765

http://stackoverflow.com/q/22977938
answer count: 3
possible better answer: http://stackoverflow.com/a/22978163
has answer: http://stackoverflow.com/a/22978493
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22978378
accepted answer: http://stackoverflow.com/a/22978378
tagged with: java
has answer: http://stackoverflow.com/a/22978163
type: Question
tagged with: algorithm
tagged with: arrays
linked to: http://stackoverflow.com/q/5283047
has title: How to construct a new array given an old array and a set of index locations which need to skipped?
has body: Basically what I want is to I skip elements on those index values which are there in the set otherwise I should just push the old array elements into the new array. So if my set contains [2, 4, 9, 10] I should skip the values at index 2,4,9,10 in the old Array and put the values at othe other index locations in my new Array. I am writing code like this int[] newArr = new int[oldArray.length - set.size()]; for(int i = 0, j = 0; j &lt; newArr.length &amp;&amp; i &lt; oldArray.length; j++,i++){ if(set.contains(i) ) i++; else newArray[j] = oldArray[i]; } I am creating and filling my set like this Set&lt;Integer&gt; commonSet = new HashSet&lt;&gt;(); for(int i = 0; i &lt; array1; i++ ){ for(int j= 0; j &lt; array2; j++) { if(arrayOne[i] == arrayTwo[j]){ commonSet.add(i);// Here I am saving the indices. } } } Not Sure if this is the best way. Is there any other way which would be more efficient? Or I must have to resort to Collection classes like ArrayLists.
has comment: http://stackoverflow.com/comment/35088562
score: 0

http://stackoverflow.com/comment/35307145
score: 0
type: AnswerComment
has text: Since thus far we haven't spoke of "shadowing" I'll accept that the book is wrong. I'll check with my teacher though.
type: Comment
comment on: http://stackoverflow.com/a/23098445

http://stackoverflow.com/q/22990819
upvote count: 3
downvote count: 0
tagged with: spring-security
favorite count: 0
has title: What is the best practice for isolating code outside of a project?
type: UnansweredQuestion
has body: I am currently building a base application for my development shop. All projects turn around the same core business, and the security may vary from a requirement to another. We have determined four types of security strategy. What I am looking for is to develop a SecurityUtils JAR file in which all my logic would be implemented, and then, all my projects would use it as a dependency/reference. Question is: What are the best practices for that kind of work? My security strategy requires the following things: Current user id (request.getRemoteUser() provided by the container through JCIFS) Http Session User entity bean User session bean / service Role entity bean Role session bean / service Utility methods for querying LDAP using spring-ldap (find user in AD, gather user groups from AD, detect user location, etc.) Admin users can manage roles and users from the Web application. They can check or uncheck features for each roles defined in the database. Each role is linked on a Active Directory group so the matching is done during the login sequence, and then permissions are set in the user's session for later use. I am not too sure about the session bean and EJB part of the strategy. Should I let the it within the project or isolate it into the SecurityUtils JAR? My specs: Spring MVC 4.0.3 (Spring Security &amp; Spring LDAP) Thymeleaf for templates/views EJB3 for persistence jBoss 4.2.3GA application server PostgreSQL 9.0.3 database Thank you for help Charles
tagged with: spring
tagged with: spring-mvc
answer count: 0
tagged with: java
type: Question
score: 3

http://stackoverflow.com/q/23041448
has answer: http://stackoverflow.com/a/23041470
tagged with: jar
accepted answer: http://stackoverflow.com/a/23041470
favorite count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/35203241
possible better answer: http://stackoverflow.com/a/23041471
tagged with: exe
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23041471
has title: When to use .jar, versus .exe?
type: Question
answer count: 2
has body: In Java we can compile soure code into two types of executables: a .jar file, which is basically bytecode, and a .exe file, which is basically machine code. Under what circumstances would it be better to compile to an .exe versus a .jar, and vice-versa? Which one is faster to run? Thanks.

http://stackoverflow.com/a/23098196
answers question: http://stackoverflow.com/q/23098139
has comment: http://stackoverflow.com/comment/49359340
type: Answer
score: 3
downvote count: 1
upvote count: 4
type: AcceptedAnswer
has body: Yes , The constructor of an abstract class can be called. why not? Use super() from subclass to call the super class argument constructor(s). If you dont use super(), then by default the no-arg constructor of super class will be called. If you call Dog dog = new Dog(); By default the super class default constructor[no-arg constructor] will be called. If you call Dog dog = new Dog("doggie1"); Unless you explicitly call super() inside the one argument constructor of Dog, the default super class constructor will not be called. Try it.. Edit: If you don't call super() inside the one argument constructor of Dog, then also the default super class constructor will be called. If you want to explicitly call the argument constructor , say one argument constructor of the super class, you have to explicitly make the call super("value"); Animal() { System.out.println("Animal superconstructor"); } Edit 02: Sample program and output (1) public class SubClass extends SuperClass { SubClass(String str) { super(str); } SubClass() { } public static void main(String[] args) { new SubClass("hello"); } } abstract class SuperClass { SuperClass() { System.out.println("I am SuperClass()"); } SuperClass(String str) { System.out.println("I am SuperClass(String str)"); } } //output: I am SuperClass(String str) (2) public class SubClass extends SuperClass { SubClass(String str) { } SubClass() { } public static void main(String[] args) { new SubClass("hello"); } } abstract class SuperClass { SuperClass() { System.out.println("I am SuperClass()"); } SuperClass(String str) { System.out.println("I am SuperClass(String str)"); } } //output: I am SuperClass() (3) public class SubClass extends SuperClass { SubClass(String str) { } SubClass() { } public static void main(String[] args) { new SubClass(); } } abstract class SuperClass { SuperClass() { System.out.println("I am SuperClass()"); } SuperClass(String str) { System.out.println("I am SuperClass(String str)"); } } // output: I am SuperClass()
accepted answer of: http://stackoverflow.com/q/23098139

http://stackoverflow.com/a/23039761
type: AcceptedAnswer
has body: public void addElementsToPane() { GetTabByName get = new GetTabByName(); That's local to that method. get does not have anything to do with passMap (the one on which you invoked getMap(tabsMap)). You probably want to pass passMap to addElementsToPane() method. public class AddEditElements { public void addElementsToPane(GetTabByName passMap) { // add parameter //GetTabByName get = new GetTabByName(); //don't create a new object JPanel addPatDocTab = passMap.getTabByName("addPatDocTab"); // &lt;------- That changes the signature of the method. And then, AddEditElements subTab1 = new AddEditElements(); subTab1.addElementsToPane(passMap); // pass the object with the populated map
has comment: http://stackoverflow.com/comment/35200902
has comment: http://stackoverflow.com/comment/35213722
type: Answer
has comment: http://stackoverflow.com/comment/35200837
downvote count: 0
has comment: http://stackoverflow.com/comment/35200816
accepted answer of: http://stackoverflow.com/q/23039643
answers question: http://stackoverflow.com/q/23039643
score: 1
has comment: http://stackoverflow.com/comment/35200966
has comment: http://stackoverflow.com/comment/35220433
upvote count: 1

http://stackoverflow.com/a/23111444
answers question: http://stackoverflow.com/q/23108910
has comment: http://stackoverflow.com/comment/35405503
has comment: http://stackoverflow.com/comment/35335436
has body: You could always do it the simple way : declare a List and cache the value as you iterate through the first time. You could consequently iterate through your List and write out your output. You should have something similar to this : public static class ReduceA extends MapReduceBase implements Reducer&lt;Text, Text, Text, Text&gt; { public void reduce(Text key, Iterator&lt;Text&gt; values, OutputCollector&lt;Text, Text&gt; output, Reporter reporter) throws IOException { Text t; int count = 0; String[] attr = key.toString().split(","); List&lt;Text&gt; cache = new ArrayList&lt;Text&gt;(); while (values.hasNext()) { cache.add(values.next()); count++; } // Maybe i need to reset my iterator here and start from the beginning // but how do i do it? String v = Integer.toString(count); for (Text text : cache) { output.collect(text, new Text(v)); } } }
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35336925
has comment: http://stackoverflow.com/comment/35351260
has comment: http://stackoverflow.com/comment/35358602
has comment: http://stackoverflow.com/comment/35363810
has comment: http://stackoverflow.com/comment/35356009
has comment: http://stackoverflow.com/comment/35354335
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35190289
has text: What is the exception? Post the logcat here
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23034083
type: Comment

http://stackoverflow.com/comment/35179051
type: QuestionComment
has text: Thanks Raju Sir & vschafer.I will try it.
score: 0
comment on: http://stackoverflow.com/q/23027149
type: Comment

http://stackoverflow.com/q/23043069
has answer: http://stackoverflow.com/a/23074934
upvote count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/23172693
accepted answer: http://stackoverflow.com/a/23172693
has body: I don't manage to have a repeated field with selected value according to the data I have in my model. Currently I have in my User model : @Required public String username; @ManyToMany public List&lt;Stay&gt; places; And my Stay model : @Required @ManyToOne public Place place; @Required @Formats.DateTime(pattern="yyyy-MM-dd") public Date startDate; @Required @Formats.DateTime(pattern="yyyy-MM-dd") public Date endDate; My Scala view form : @(formUser: Form[User]) ... @repeat(formUser("places"), min = 1) { stayField =&gt; &lt;div id="groupLocationField"&gt; // Don't manage to reach User-&gt;Places-&gt;Place @select(formUser("stayField.places"), options(Place.optionsTitle)) @inputDate(formUser("stayField.startDate")) @inputDate(formUser("stayField.endDate")) &lt;/div&gt; } stayField is a Form.Field type which contains Field(null,places[1],ArrayBuffer(),None,ArrayBuffer(),Some(Paris Mon Oct 29 00:00:00 CET 2018 Wed Jun 11 00:00:00 CEST 2014 null)) But seems to have convert my Place and Dates into a string. @stayField contains the value of my Stay model toString method. @stayField.value = Paris Mon Oct 29 00:00:00 CET 2018 Wed Jun 11 00:00:00 CEST 2014 @stayField.value.productArity = 1
tagged with: scala
score: 6
type: AnsweredQuestion
tagged with: playframework-2.0
tagged with: bootstrap-form-helper
downvote count: 0
tagged with: java
tagged with: forms
type: Question
has title: @Repeat Form Helper with complex object - Play Framework
answer count: 2
possible better answer: http://stackoverflow.com/a/23074934

http://stackoverflow.com/q/23013889
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35154906
has comment: http://stackoverflow.com/comment/35153839
answer count: 1
has comment: http://stackoverflow.com/comment/35153449
has comment: http://stackoverflow.com/comment/35154265
has answer: http://stackoverflow.com/a/23014118
has comment: http://stackoverflow.com/comment/35154806
has title: Run non static method on current activity from another class
accepted answer: http://stackoverflow.com/a/23014118
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35154095
type: Question
tagged with: android
has body: I am struggling to figure out how to simply call and run a method from a class (that is not an activity) on my current activity. my current code: CustomListViewAdapter.java (other class) public void onClick(View v) { int position = Photos.listView.getPositionForView(v); Log.v("value ", "tada" + position); Photos photos = new Photos(); photos.deletePhoto(position); } }); Photos.java (my current activity class) public void deletePhoto(int pos){ Toast.makeText(thisActivity, "delete index:"+pos , Toast.LENGTH_SHORT).show(); mylist.remove(pos); setupListView(); } Problem is, this way of doing it makes a new instance of mylist which gives me a outofbounds error. How can I do this correctly so I get the current activity and update it accordingly?
has comment: http://stackoverflow.com/comment/35153502

http://stackoverflow.com/q/23061172
has body: I use Spring + JSF, with the View Scope being managed by Spring. I've noticed that on every request, the view is destroyed and created again, and so any @PostConstruct method are called on every request. In most pages this is ok, since in that method are just some object initializations (mainly new calls). But in others pages this is a problem because I have to make heavy queries to initialize some lists, and the view behavior calls the initialization method on every request... so any request in the page is veeeeeery slow. I know that the view scope stores the bean and it's objects in the session and later recover them; so I want to know if there's a way to check if these objects are already stored so I don't need to initialize those heavy objects at every request; just get them from the session. UPDATE The view scope used is the one implemented here: http://comdynamics.net/blog/109/spring3-jsf2-view-scope/
has comment: http://stackoverflow.com/comment/35240514
tagged with: view
has comment: http://stackoverflow.com/comment/35239586
has answer: http://stackoverflow.com/a/23063647
tagged with: spring
has comment: http://stackoverflow.com/comment/35240693
accepted answer: http://stackoverflow.com/a/23063647
has comment: http://stackoverflow.com/comment/35243341
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35242068
tagged with: jsf
tagged with: java
has comment: http://stackoverflow.com/comment/35243872
type: Question
tagged with: jsf-2
answer count: 2
has comment: http://stackoverflow.com/comment/35239813
possible better answer: http://stackoverflow.com/a/23062770
has title: JSF View Scope: How to Check if an object is in the view tree
has answer: http://stackoverflow.com/a/23062770
has comment: http://stackoverflow.com/comment/35240871
score: 0

http://stackoverflow.com/a/40306146
downvote count: 0
score: 69
type: Answer
answers question: http://stackoverflow.com/q/23079003
has body: If you want to get an array of ints, with values from 1 to 10, from a Stream&lt;Integer&gt;, there is IntStream at your disposal. Here we create a Stream with a Stream.of method and convert a Stream&lt;Integer&gt; to an IntStream using a mapToInt. Then we can call IntStream's toArray method. Stream&lt;Integer&gt; stream = Stream.of(1,2,3,4,5,6,7,8,9,10); //or use this to create our stream //Stream&lt;Integer&gt; stream = IntStream.rangeClosed(1, 10).boxed(); int[] array = stream.mapToInt(x -&gt; x).toArray(); Here is the same thing, without the Stream&lt;Integer&gt;, using only the IntStream: int[]array2 = IntStream.rangeClosed(1, 10).toArray();
upvote count: 69

http://stackoverflow.com/comment/35296070
comment on: http://stackoverflow.com/a/23090231
score: 0
type: AnswerComment
type: Comment
has text: Ok thanks again. In the second case when I need to list all the objects owned by an user is it efficient this approach? The answer should be yes on the basis of the first comments. Ps. To run the keys-only query you mean that I generate the key on the basis of fields owner and object? ps2. I can use ascensors because I may need loops.

http://stackoverflow.com/q/23085750
has comment: http://stackoverflow.com/comment/35284217
downvote count: 0
has title: Use variables between two activities with different processes
possible better answer: http://stackoverflow.com/a/23085833
tagged with: android
has answer: http://stackoverflow.com/a/23085833
accepted answer: http://stackoverflow.com/a/23085907
favorite count: 0
linked to: http://stackoverflow.com/q/4233873
tagged with: process
has comment: http://stackoverflow.com/comment/35284312
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35283941
score: 1
tagged with: java
type: Question
has body: I created my Base activity in separated process by adding to it's &lt;activity&gt; fragment in manifest: android:process=":login_exception_process" In Base activity I initiate my connection objects, and start next Activitty. But from another Activity when I try to get this instances of connection objects they are NULL. Objects initiated by Base activity are saved in separated classes in static variables. How can I access this variable?
answer count: 2
has answer: http://stackoverflow.com/a/23085907

http://stackoverflow.com/comment/35348726
score: 0
comment on: http://stackoverflow.com/q/23120454
type: Comment
type: QuestionComment
has text: Hint: you can change the value of the attribute `layout_alignBottom` to `@id/` instead of '@+id/' to use a predefined id instead of creating new one, and make sure that the id you will use is defined before calling it. this will prevent making a relative relation to a non existing id.

http://stackoverflow.com/comment/35097654
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22982514
has text: The word in variable `'item'` a full text or part of text from the field `word`? If it is part of the field, then you have to use `where word like '%" + item + "%' ";`

http://stackoverflow.com/comment/35173208
type: Comment
has text: The stack trace doesn't lie.
comment on: http://stackoverflow.com/a/23022595
type: AnswerComment
score: 0

http://stackoverflow.com/q/22969132
has answer: http://stackoverflow.com/a/22969582
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has title: Override java generic method in interface
type: Question
upvote count: 2
answer count: 3
has body: public &lt;A extends Interface1,I extends Interface2&gt; I Method(A a); This is a method in an interface. When I get to override this interface method, I can replace I with any class which implements Interface2 but the parameter A is rejected if it is a subclass of Interface1. It can only be Interface1 type. So when I try: public SubTypeofInterface2 Method(Interface1 a); //fine public SubTypeofInterface2 Method(SubTypeofInterface1 a); // not accepted Why does this happen?
has comment: http://stackoverflow.com/comment/35072687
tagged with: generics
favorite count: 0
accepted answer: http://stackoverflow.com/a/22969341
has answer: http://stackoverflow.com/a/22969295
tagged with: interface
possible better answer: http://stackoverflow.com/a/22969295
has answer: http://stackoverflow.com/a/22969341

http://stackoverflow.com/comment/35137463
comment on: http://stackoverflow.com/a/23004417
type: Comment
has text: I guess, dispose is not required. You can try without dispose also.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35268424
score: 1
comment on: http://stackoverflow.com/q/23076867
type: QuestionComment
has text: What types did you put into Set? If two objects are equals (`e1.equals(e2)`) then set will treat them as duplicates and won't add it into the collection
type: Comment

http://stackoverflow.com/comment/35292339
has text: I have a feeling you're using a >= (or <=) when you should be using a > or <.
type: QuestionComment
comment on: http://stackoverflow.com/q/23090470
score: 0
type: Comment

http://stackoverflow.com/q/23082358
linked to: http://stackoverflow.com/q/2367398
has body: I recently came across a java snippet .The function definitions have a different format than what i know till now . Following are the codes- protected Void doInBackground(String... params) { Log.i(TAG, "doInBackground"); //Invoke web method 'PopulateCountries' with dummy value invokeJSONWS("dummy","PopulateCountries"); return null; } and a similar function with ... in the parameter protected void onProgressUpdate(Void... values) { Log.i(TAG, "onProgressUpdate"); } What does ... mean in the following context?
has answer: http://stackoverflow.com/a/23082616
tagged with: android
score: 13
has answer: http://stackoverflow.com/a/23082471
upvote count: 13
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23082552
tagged with: java
has title: void... params meaning in java function declaration
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35277674
tagged with: adt
answer count: 6
has answer: http://stackoverflow.com/a/23082552
has answer: http://stackoverflow.com/a/23082459
accepted answer: http://stackoverflow.com/a/23082616
downvote count: 0
has answer: http://stackoverflow.com/a/23082436
has answer: http://stackoverflow.com/a/23082478
favorite count: 0

http://stackoverflow.com/comment/35200202
has text: But you change everything from file concept as I am using file here. But in general what does ReadTime means while looking up from HashMap? Just a single string lookup and then benchmark that?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23039492

http://stackoverflow.com/a/23002049
type: Answer
downvote count: 0
score: 1
has body: in the while loop you are using nextInt(), obviously it will expect an integer as input. So when you are giving input x which is an string then it will fail. So in the loop take string as input and if it is not X and is a number then convert it to int values and calculate
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23002031
answers question: http://stackoverflow.com/q/23002031

http://stackoverflow.com/comment/35295288
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23091814
has text: Other solution would be two use Action in Intent. You can set different action for the different task that you want to perform with the same activity. And do stuff. So if u are starting activity to do 1 operation then while starting activity set an action in Intent with string like "Action1". When your activity starts you can check what action you have set and do the operation 1 Similarly when you are starting activity to do operation 2 then set action "Action2" in Intent, and when your activity has started you can check for the action and perform operation 2

http://stackoverflow.com/a/23098660
has comment: http://stackoverflow.com/comment/35307565
score: 0
has comment: http://stackoverflow.com/comment/35307460
type: Answer
answers question: http://stackoverflow.com/q/23098634
has body: You're accessing methods wrong. isHidden.letter should be letter.isHidden() Also don't both putter = true. Firstly, boolean expressions will be evaluated anyway so you don't need to compare it to anything. Secondly, you should be using == or .equals() to compare two values, = is strictly for assignments

filezilla
tags question: http://stackoverflow.com/q/23010385
tag name: filezilla
type: Tag

http://stackoverflow.com/comment/35106507
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22987962
has text: @gizmo see: http://www.infoq.com/cn/articles/lp-java-remoting-1/
type: Comment

http://stackoverflow.com/comment/35092275
score: 2
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22980116
has text: @ChandraMohan: I suspect because it would make the language more complicated for very little benefit.

http://stackoverflow.com/q/23100995
duplicate of: http://stackoverflow.com/q/13749001
tagged with: java
has body: How to display positive value or absolute value of a number in jstl? &lt;fmt:formatNumber value="${-85}" format="%" /&gt; &lt;!-- should convert -85 to 85 --&gt;
has answer: http://stackoverflow.com/a/23101114
accepted answer: http://stackoverflow.com/a/23101473
type: Question
tagged with: jstl
has title: how to format number for positive value or absolute value in jstl?
downvote count: 0
tagged with: jsp
answer count: 3
has answer: http://stackoverflow.com/a/23101473
favorite count: 0
possible better answer: http://stackoverflow.com/a/23101074
upvote count: 2
has answer: http://stackoverflow.com/a/23101074
linked to: http://stackoverflow.com/q/13749001
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/23050885
has comment: http://stackoverflow.com/comment/35220756
type: UnansweredQuestion
tagged with: css
has body: I have an image in my code. When I click on it, I want its style to be changed. The field looks like this : &lt;a class="myField" href="#" style="left: 0%;"&gt;&lt;/a&gt; I can get the element by class and click on it. But I don't know how to change the style. WebElement webelement = driver.findElement(By.className("myField")); webelement.click(); //Change the style to 'left:40%;' I am new to selenium. Any help appreciated.
tagged with: selenium-webdriver
has title: How to change the style of an element using selenium
score: 0
linked to: http://stackoverflow.com/q/12974488
tagged with: selenium
type: Question
has comment: http://stackoverflow.com/comment/35221003
tagged with: java
has comment: http://stackoverflow.com/comment/35220706
has comment: http://stackoverflow.com/comment/35220676
has comment: http://stackoverflow.com/comment/35220692
has comment: http://stackoverflow.com/comment/35220768
answer count: 1
has comment: http://stackoverflow.com/comment/35220965
has answer: http://stackoverflow.com/a/23050946

http://stackoverflow.com/comment/35301278
score: 0
type: AnswerComment
has text: Why not just use String.replaceAll?
type: Comment
comment on: http://stackoverflow.com/a/23095093

http://stackoverflow.com/q/23056329
favorite count: 0
has title: Indexing an Enum type field with hibernate-search
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35230566
type: Question
tagged with: hibernate-search
score: 3
accepted answer: http://stackoverflow.com/a/23057594
tagged with: lucene
upvote count: 3
has body: I am having problems searching using Hibernate search when the index I want to use is of an Enum type. Here is an example of what my application looks like: @Entity @Indexed public class MyEntity{ @Id @Field public Long id; @Field(bridge=@FieldBridge(impl=EnumBridge.class)) public Flavour flavour; } with public enum Flavour { vanilla, chocolate, strawberry, pistacchio; } Then I try to find all instances using this type of query. QueryBuilder qb = [~] ; Query q = qb.keyword().onField("flavour").matching(Flavour.vanilla).createQuery(); When I test this the results always comes empty. I even tried to see the content of the indexes using Luke and I do not seem to find "flavour". I do re-index everything after committing changes. Everyother type of indexing works and querying works perfectly on anything but enum fields. I have tried almost any combination of the norms, analyze, index, store, ... of the @Field annotation (I am using Hibernate-search 4.5.x with hibernate 4.3.1). What am I doing wrong? Any settings I should be looking at? Any help is welcome.
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23057594

http://stackoverflow.com/comment/35192076
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23035080
has text: "2014-12-12" is a String (well, now w/o " " is just an error) you should create a new Date from the string using SimpleDataFormat

http://stackoverflow.com/q/23057726
has comment: http://stackoverflow.com/comment/35234811
tagged with: unmarshalling
has title: JAXB unmarshalling with @XmlMixed Annotation
has comment: http://stackoverflow.com/comment/35233314
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35271190
answer count: 0
type: UnansweredQuestion
tagged with: annotations
tagged with: jaxb
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35233016
has body: I have a problem while unmarshalling an XML document. I found good hints here ("JAXB- @XmlMixed usage for reading @XmlValue and @XmlElement") but I wasn't able to adopt this on my code. First.. here is an example of the xml: This is a content text value1 value2 value3 Within the content block there could be either a text or several attribute groups with attributes (never both!). Sadly this is a given xml structure and I can't change it. I tried it with the following class structures but there must be an error within my XmlMixed annotation. I even don't know if I must use the @XmlMixed here or if there is another better solution!? public static class Content { @XmlMixed private List<String> text; @XmlElementRef(name = "attributeGroup", type = AttributeGroup.class) private List attributeGroups; // getter+setter... } public static class AttributeGroup { @XmlAttribute(name="name") private String name; @XmlElement(name="attribute", type=Attribute.class) private List attributes; // getter+setter... } public static class Attribute { @XmlAttribute(name="name") private String name; @XmlValue private String value; // getter+setter... }
linked to: http://stackoverflow.com/q/10940267
score: 0

http://stackoverflow.com/comment/35277031
has text: So even Wireshark doesn't show your packets? Then there's most likely something between the two systems that drops your packets. If one system is on a corporate network, it's not uncommon for them to not allow anything beyond web-browsing.
comment on: http://stackoverflow.com/q/23081739
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23062868
has comment: http://stackoverflow.com/comment/35244918
upvote count: 2
has comment: http://stackoverflow.com/comment/35254130
type: Answer
answers question: http://stackoverflow.com/q/23062568
score: 2
downvote count: 0
has body: Probably not the answer you are looking for but may be the answer to someone coming across this question another day. If you are planning to query a fairly static set of ranges often then you may wish to consider an Interval Tree. public class IntervalTree&lt;T extends IntervalTree.Interval&gt; { // My intervals. private final List&lt;T&gt; intervals; // My center value. All my intervals contain this center. private final long center; // My interval range. private final long lBound; private final long uBound; // My left tree. All intervals that end below my center. private final IntervalTree&lt;T&gt; left; // My right tree. All intervals that start above my center. private final IntervalTree&lt;T&gt; right; public IntervalTree(List&lt;T&gt; intervals) { if (intervals == null) { throw new NullPointerException(); } // Initially, my root contains all intervals. this.intervals = intervals; // Find my center. center = findCenter(); /* * Builds lefts out of all intervals that end below my center. * Builds rights out of all intervals that start above my center. * What remains contains all the intervals that contain my center. */ // Lefts contains all intervals that end below my center point. final List&lt;T&gt; lefts = new ArrayList&lt;T&gt;(); // Rights contains all intervals that start above my center point. final List&lt;T&gt; rights = new ArrayList&lt;T&gt;(); long uB = Long.MIN_VALUE; long lB = Long.MAX_VALUE; for (T i : intervals) { long start = i.getStart(); long end = i.getEnd(); if (end &lt; center) { lefts.add(i); } else if (start &gt; center) { rights.add(i); } else { // One of mine. lB = Math.min(lB, start); uB = Math.max(uB, end); } } // Remove all those not mine. intervals.removeAll(lefts); intervals.removeAll(rights); uBound = uB; lBound = lB; // Build the subtrees. left = lefts.size() &gt; 0 ? new IntervalTree&lt;T&gt;(lefts) : null; right = rights.size() &gt; 0 ? new IntervalTree&lt;T&gt;(rights) : null; // Build my ascending and descending arrays. /** * @…
has comment: http://stackoverflow.com/comment/35244465

http://stackoverflow.com/q/23019516
type: Question
accepted answer: http://stackoverflow.com/a/23020221
possible better answer: http://stackoverflow.com/a/23020193
has answer: http://stackoverflow.com/a/23020193
answer count: 3
tagged with: functional-programming
downvote count: 0
has answer: http://stackoverflow.com/a/23023769
favorite count: 0
has title: Translate Java to Clojure - append to list and return list
has answer: http://stackoverflow.com/a/23020221
tagged with: clojure
has body: I want to translate the following java to idiomatic clojure: List&lt;SimpleRecord&gt; recs = new ArrayList&lt;SimpleRecord&gt;(); ParquetReader&lt;SimpleRecord&gt; reader = null; try { PrintWriter writer = new PrintWriter(Main.out, true); reader = new ParquetReader&lt;SimpleRecord&gt;(new Path(input), new SimpleReadSupport()); for (SimpleRecord value = reader.read(); value != null; value = reader.read()) { //value.prettyPrint(writer); //writer.println(); recs.add(value); } return value; } finally { if (reader != null) { try { reader.close(); } catch (Exception ex) { } } } But I'm having trouble pushing an element to the list at each step. This is what I have right now: (let [rows (vector) reader (new parquet.hadoop.ParquetReader (new org.apache.hadoop.fs.Path "file.pq") (new SimpleReadSupport))] ;reader (try (for [value (.read reader) :while (not (nil? value))] (conj value rows)) ;y u no recur? rows (finally (.close reader))) ) But I don't know whats the idiomatic way of doing this within a for. I'm guessing I have to use reduce no? Thanks
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/35141760
score: 0
type: Comment
has text: @JensSchauder sure, it might. But I'd question the Eclipse Compiler first.
comment on: http://stackoverflow.com/a/23007443
type: AnswerComment

http://stackoverflow.com/q/23001891
score: 1
tagged with: java
has title: bitbucket bddc1783b136 [bddc1783b136] errors
type: Question
tagged with: bitbucket
upvote count: 1
favorite count: 0
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: git
has body: I upload my project files by smartgit/hg to bitbucket. But when I clone the repository in another computer. I got many empty folders that expected to contain many .java files. So I open bitbucket.org in my browser, and find the repository--click "source". It shows "back → bddc1783b136 [bddc1783b136]" the pic is on : http://img3.picbed.org/uploads/2014/04/abc.jpg "back" is one of the folders that uploaded and expected to be contains many .java files. I wonder if someone tell me what happens. I tried to google the error message but got nothing. I did see success message of finishing pull in smartgit/hg. PS: The project folder is really big--567 MB. It works well when I doing with a small project. I am not a native English speaker, So if I didn't describe the problem well, please forgive me. :) UPDATE: Now I use hg instead of git and use TortoiseHg instead of smartgit/hg. This fixes the problem.

http://stackoverflow.com/comment/35195148
has text: Please provide some testable and complete code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23036670
score: 1

http://stackoverflow.com/comment/35280913
score: 1
has text: try putting a space between * and from. If that doesn't work, then try unquoting your table name
comment on: http://stackoverflow.com/q/23084372
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35149461
has text: why &#x in out.println("&#x"+outt[i]+";");?
type: Comment
comment on: http://stackoverflow.com/a/23009782
score: 0
type: AnswerComment

http://stackoverflow.com/a/23075237
score: 2
has comment: http://stackoverflow.com/comment/35270039
upvote count: 2
answers question: http://stackoverflow.com/q/23071624
has body: You can generate Eclipse metadata using eclipse plugin distribute with Gradle - http://www.gradle.org/docs/current/userguide/eclipse_plugin.html - this will set up the project with its classpath. Or install Gradle plugin for Eclipse developed by Pivotal folks.
accepted answer of: http://stackoverflow.com/q/23071624
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/23023389
has title: How can I get the name of the current thread?
has body: The title says it all. In a Java app, how can I reliably get the name of the thread that is currently running? Also, if I start the app in the EDT (using SwingUtilities.invokeLater()), and never explicitly start another thread - the entire program will stay in the EDT - right?
has comment: http://stackoverflow.com/comment/35171574
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35171590
has answer: http://stackoverflow.com/a/23023391
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35172466
tagged with: java
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/23023391
answer count: 1

http://stackoverflow.com/comment/35106044
type: Comment
comment on: http://stackoverflow.com/a/22987794
has text: Can you share what you see in the alert that shows 'myDivText1'?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35220120
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23050556
has text: You're executing a long-lasting task on the main UI thread. You have to do these things in the background so the UI keeps functioning in the meanwhile.
score: 0

http://stackoverflow.com/comment/35222093
has text: like am I supposed to put the text file in place of where the System.out.println is? That's what I tried doing, but to avail. I tried making a different class, but then in the seperate class, it doesn't know the variable I am talking about because the variable is in my main class
score: 0
comment on: http://stackoverflow.com/q/23051262
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23019691
has answer: http://stackoverflow.com/a/30936383
upvote count: 2
possible better answer: http://stackoverflow.com/a/23019721
tagged with: java
has answer: http://stackoverflow.com/a/23019721
type: Question
has body: I've implemented Tab Layout and my app is not starting. I get NullPointerException on this line: actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); I think that everything is done properly. I can't find my mistake. MainActivity: import android.app.ActionBar; import android.app.ActionBar.Tab; import android.app.FragmentTransaction; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import com.msh.numeral_system_converter_adapter.TabsPagerAdapter; public class MainActivity extends FragmentActivity implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; // Tab titles private String[] tabs = { "Converter", "Calculator"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Initilization viewPager = (ViewPager) findViewById(R.id.pager); actionBar = getActionBar(); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); //actionBar.setHomeButtonEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Adding Tabs for (String tab_name : tabs) { actionBar.addTab(actionBar.newTab().setText(tab_name) .setTabListener(this)); } /** * on swiping the viewpager make respective tab selected * */ viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { // on changing the page // make respected tab selected actionBar.setSelectedNavigationItem(position); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); } @Override public void onTabReselected(Tab tab, FragmentTransaction ft) { } @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { // on tab selected // show respected fragment view viewPager.setCurrentItem(tab.getPosition…
linked to: http://stackoverflow.com/q/10031180
tagged with: layout
has comment: http://stackoverflow.com/comment/35164493
accepted answer: http://stackoverflow.com/a/23019925
downvote count: 0
has answer: http://stackoverflow.com/a/34471267
favorite count: 0
linked to: http://stackoverflow.com/q/6867076
tagged with: nullpointerexception
tagged with: android
answer count: 4
type: AnsweredQuestion
score: 2
tagged with: tabs
has answer: http://stackoverflow.com/a/23019925
has title: NullPointerException on implementation of Tab Layout

http://stackoverflow.com/a/23137295
upvote count: 1
answers question: http://stackoverflow.com/q/23128516
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23128516
type: Answer
score: 1
has body: well you can do one thing I've created an another class Home.java import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; public class Home extends Activity{ static int n = 0; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.home); Button go = (Button)findViewById(R.id.button1); go.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub EditText sec = (EditText)findViewById(R.id.editText1); n = Integer.parseInt(sec.getText().toString()); Intent go = new Intent("com.nerdwin15.demo.alarmdemo.AlarmMainActivity"); startActivity(go); } }); } } AlarmMainActivity.java public class AlarmMainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); //Create an offset from the current time in which the alarm will go off. Calendar cal = Calendar.getInstance(); cal.add(Calendar.SECOND, Home.n); //Create a new PendingIntent and add it to the AlarmManager Intent intent = new Intent(this, AlarmReceiverActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 12345, intent, PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager am = (AlarmManager)getSystemService(Activity.ALARM_SERVICE); am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent); } } Now you enter your time in home class and it go to another one . make sure to change your LAUNCHER in manifest it should be Home.java

http://stackoverflow.com/q/22978369
type: Question
tagged with: outlook
has body: I want to use {mailR} package to send email notifications with authentication. This package is backended by {rJava} and uses Java facilities. I registered an Outlook.com account. Here's the code: library(mailR) email &lt;- send.mail( from="(account-name)@outlook.com", to="(my-account)@outlook.com", subject="Test message from server", body="Hello, this is a test message.", smtp=list(host.name="smtp-mail.outlook.com",port=25, user.name="(account-name)@outlook.com",passwd="(account-password)", ssl = TRUE), authenticate=TRUE, send=TRUE ) I read http://windows.microsoft.com/en-us/windows/outlook/send-receive-from-app and tried all possible host names (smtp.live.com, smtp.outlook.com, smtp-mail.outlook.com) and ports (25, 587), but it all results in the following error: Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, : org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp-mail.outlook.com:465 What is the problem? Is there a working solution to send email with authentication in R?
tagged with: http://stackoverflow.com/tag/r
answer count: 1
tagged with: email
has answer: http://stackoverflow.com/a/25774370
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: Fail to send email via Outlook.com using mailR package
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/35313318
type: QuestionComment
has text: And what problem do you have with that?
score: 0
comment on: http://stackoverflow.com/q/23099931
type: Comment

http://stackoverflow.com/comment/35123597
has text: OK have coppied. now FileNotFoundException: resources\clip.wav (syetm cannot find path...)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22988731
type: Comment

http://stackoverflow.com/comment/35215109
score: 0
type: Comment
type: QuestionComment
has text: @Monica you have intent and you can pass data between Activities. You need to change the code written by someone
comment on: http://stackoverflow.com/q/23047716

http://stackoverflow.com/a/23084627
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35281526
answers question: http://stackoverflow.com/q/23084363
type: Answer
has comment: http://stackoverflow.com/comment/35281935
accepted answer of: http://stackoverflow.com/q/23084363
has body: Premature optimisation is the root of all evil. - D. Knuth. This seems like the kind of "performance issue" which actually never has any effect on performance. For one thing, how sure are you that these empty lists are actually initialised? I suspect that most modern compilers delay initialisation of objects until they know for sure that there will be a call on them. So if you pass the no arg constructor it will most likely never be used unless something is added to the list. On the other hand, if you use the 0 argument constructor, it guarantees that it has to resize every one that it uses. These are the three laws of performance optimisation Never assume that you know what the compiled code is actually doing, or that you can sport small optimisations better than the compiler can. Never optimise without using a profiler to work out where the bottleneck is. If you think that you know, refer to rule number (1). Don't bother unless your application has a performance issue. Then refer to rule (2). On the off chance that you somehow still believe that you understand compilers, check out this question: Why is it faster to process a sorted array than an unsorted array?

http://stackoverflow.com/a/22990742
answers question: http://stackoverflow.com/q/22989412
score: 0
type: Answer
has body: Try setting minGramSize=2 in attributes of EdgeNGramFilterFactory, remove asterisk from the query: solrParams.add("q","category:te");, restart Solr and reindex records.

http://stackoverflow.com/a/23121398
upvote count: 1
has comment: http://stackoverflow.com/comment/35347505
type: Answer
has comment: http://stackoverflow.com/comment/35347542
downvote count: 0
has comment: http://stackoverflow.com/comment/35347486
has comment: http://stackoverflow.com/comment/35347485
has body: You could do it with string.split: list[k-1].printComputer().split("\\s+")[2] whitespace split regex from: How do I split a string with any whitespace chars as delimiters?
score: 1
answers question: http://stackoverflow.com/q/23121321
has comment: http://stackoverflow.com/comment/35347553

http://stackoverflow.com/comment/35243549
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23063423
has text: What have you tried? Is something not working? You should ask more specific questions about what you don't manage to do. "Do-my-work" questions often result in downvotes on SO.
score: 0

http://stackoverflow.com/comment/35183410
has text: If you understand the offside rule, then why are you calculating the distance to the goal itself, instead of the goal line? The distance to the goal itself is completely irrelevant. You could just look at the X co-ordinate of the player, and all of the opponents, and save yourself a whole lot of calculation. The only thing you need to calculate is - of all 11 of my opponents, how many have an X coordinate greater than mine, and how many have an X coordinate less than mine. It also makes no difference whether a player is the goalkeeper, so there's no point in calling `isGoalKeeper` at all.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23028801
type: Comment

http://stackoverflow.com/comment/35085152
has text: You've just edited your post making my answer null and void. Why did you do that??
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22975893
score: 0

http://stackoverflow.com/comment/35275889
comment on: http://stackoverflow.com/q/23081408
has text: You can save it into Bundled extras in Intent that fire service. Try to look on http://stackoverflow.com/a/21565858/1370062
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35149834
has text: Every `Tile` could store its neighbors as a reference. So every `Tile` would have 4 or 8 neighbors (diagonal neighbors?). Then you only need to check 4/8 walls for each wall/tile.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23011980
score: 0

http://stackoverflow.com/a/23079974
answers question: http://stackoverflow.com/q/23068927
type: Answer
accepted answer of: http://stackoverflow.com/q/23068927
score: 1
upvote count: 1
has body: It's not working because you are not deleting the database file on the file system. What your code does is copy the file from assets into the private storage area for your app in /data/data/com.example.fishselector/databases/. Then the next time you run it you check if it already exists there, and if it does, do nothing: boolean dbExist = checkDataBase(); if (dbExist) { //do nothing - database already exist } else { So simply deleting it or replacing it in assets won't mean a thing because hey ho, there it still is, in /data/data/ as if nothing happened. To fix: in your emulator, go into "Settings/Apps/YourApp/" and click "Clear Data". This will delete any data in the private storage area for your app. Then you can try and run your app again and it will not find the file and will copy your new database over from assets.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35089780
has text: @user3515725 And you've been asked what you mean by all that, and you haven't answered. Instead you're just repeating yourself, both here and in your additional question. Don't do that.
score: 0
comment on: http://stackoverflow.com/a/22978444
type: Comment
type: AnswerComment

http://stackoverflow.com/q/23110614
type: Question
has answer: http://stackoverflow.com/a/23112090
tagged with: keylistener
has title: how to minimize and maximize JFrame in java using mouse and key Listener?
score: 0
answer count: 1
tagged with: jframe
has comment: http://stackoverflow.com/comment/35328668
type: UnansweredQuestion
tagged with: mouselistener
has body: I want to minimize the frame while I clicked on the frame using "mouseClicked" and maximize while I pressed 'n' char using "keyPressed" this is code is running but I think not doing any thing. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Test extends JPanel implements MouseListener,KeyListener { static JFrame frame = new JFrame("java lover"); public Test() { super(); this.addMouseListener(this); this.addKeyListener(this); } //************************************************************************************ public void mouseClicked(MouseEvent e){ frame.setState(Frame.ICONIFIED); // to minimize frame } //************************************************************************************ public void mouseEntered(MouseEvent e){ } public void mouseExited(MouseEvent e){ } public void mousePressed(MouseEvent e){ } public void mouseReleased(MouseEvent e){ } //*************key********************************* public void keyTyped(KeyEvent e) { } //*************key********************************************************************* public void keyPressed(KeyEvent e) { if(e.getKeyChar()=='n'){ frame.setState ( Frame.NORMAL );// for maximize or normal frame } } //*************key********************************************************************** public void keyReleased(KeyEvent e) { } //************************************************** public static void main(String[] args) { Test panel=new Test(); frame.setSize(600, 600); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } thanks for helping.
tagged with: java
has comment: http://stackoverflow.com/comment/35327162
tagged with: swing

http://stackoverflow.com/a/23127469
score: 1
accepted answer of: http://stackoverflow.com/q/23106877
upvote count: 1
answers question: http://stackoverflow.com/q/23106877
has body: I realized that the error was in the query that I used the REST API. So the operations I did in Java were correct. With the command httpResponse.getEntity().getContent() you can take the content that is returned even if this file is described in the content-disposition. Thanks to @Julian Reschke
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35329964
has text: Hi, thanks for your answer. I just edited my post, so you can see what contains my InputStream. It seems there is a problem with it, but I don't know what can I do :(
score: 0
comment on: http://stackoverflow.com/q/23111811
type: Comment
type: QuestionComment

masking
tag name: masking
tags question: http://stackoverflow.com/q/23094244
type: Tag

http://stackoverflow.com/q/23016239
tagged with: inputstreamreader
has body: When using this code below to make a get request: private String get(String inurl, Map headers, boolean followredirects) throws MalformedURLException, IOException { URL url = new URL(inurl); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setInstanceFollowRedirects(followredirects); // Add headers to request. Iterator entries = headers.entrySet().iterator(); while (entries.hasNext()) { Entry thisEntry = (Entry) entries.next(); Object key = thisEntry.getKey(); Object value = thisEntry.getValue(); connection.addRequestProperty((String)key, (String)value); } // Attempt to parse InputStream stream = connection.getInputStream(); InputStreamReader isReader = new InputStreamReader(stream ); BufferedReader br = new BufferedReader(isReader ); System.out.println(br.readLine()); // Disconnect connection.disconnect(); return connection.getHeaderField("Location"); } The resulting response is completely nonsensical (e.g ���:ks�6��﯐9�rђ� e��u�n�qש�v���"uI*�W��s) However I can see in Wireshark that the response is HTML/XML and nothing like the string above. I've tried a myriad of different methods for parsing the InputStream but I get the same result each time. Please note: this only happens when it's HTML/XML, plain HTML works. Why is the response coming back in this format? Thanks in advance! === SOLVED === Gah, got it! The server is compressing the response when it contains XML, so I needed to use GZIPInputStream instead of InputSream. GZIPInputStream stream = new GZIPInputStream(connection.getInputStream()); Thanks anyway!
has comment: http://stackoverflow.com/comment/35159285
type: UnansweredQuestion
has title: HttpURLConnection response is incorrect
has answer: http://stackoverflow.com/a/23016373
tagged with: httpurlconnection
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35157676
type: Question
has comment: http://stackoverflow.com/comment/35157802
tagged with: java
score: 0
answer count: 1

http://stackoverflow.com/q/23113221
has title: How to delete everything before a certain character with characters split into groups
type: AnsweredQuestion
has body: So I have a Java input in the form s1,s2,s3,s4,s5,...,sn Where I have n characters separated by a comma. I want to split them at a certain point and have only the characters with a greater index left in my string. Let's assume this code String s = "a,bn,c,st1,d,kr332,23,b4,46" I would like to split it, let's say after the third sign, so at c. I want the string that's left to be s="st1,d,kr332,23,b4,46" I have come up with one method but it seems quite primitive List&lt;String&gt; list = Arrays.asList(s.split(",")); s=""; Now I would have a list of Strings and I could iterate through them like for(int i=(number where i want to cut off); i&lt;list.size(); i++){ s+=list.get(i); } Is there a more elegant way of doing this?
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23113755
type: Question
score: 3
has comment: http://stackoverflow.com/comment/35332260
has comment: http://stackoverflow.com/comment/35332335
has answer: http://stackoverflow.com/a/23113344
upvote count: 3
tagged with: string
possible better answer: http://stackoverflow.com/a/23113755
has answer: http://stackoverflow.com/a/23113411
accepted answer: http://stackoverflow.com/a/23113411
favorite count: 0
has answer: http://stackoverflow.com/a/23113415
tagged with: regex
has comment: http://stackoverflow.com/comment/35332264
answer count: 4

http://stackoverflow.com/a/23051884
type: Answer
answers question: http://stackoverflow.com/q/23050079
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23050079
has comment: http://stackoverflow.com/comment/35222656
has comment: http://stackoverflow.com/comment/35222555
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35222537
has body: There are no new lines in a serialized file (unless you somehow make it that way when you originally write it). You will have to use ObjectOutputStream and ObjectInputStream to serialize and deserialize. If you are serializing a bunch of objects your best option would probably be to serialize the entire list, and then deserialize the whole thing at once again, and add it back to a new list. Judging by your other question, a good option might be to add each node into a list rather than writing each object to file separately: ... if (focusNode != null){ System.out.println(focusNode); list.add(focusNode); preOrderTraverseTree(focusNode.leftChild); preOrderTraverseTree(focusNode.rightChild); }//end if ... and then to save it: try (ObjectOutputStream output = new ObjectOutputStream( new FileOutputStream(file))) { output.writeObject(lList);//this will write the list as a whole to the file } and to read it back, I would suggest putting it back into the list: try (ObjectInputStream input = new ObjectInputStream( new FileInputStream(file))) { newList = (List) input.readObject(); from there, if you need to use the objects again, you can pull them out of the list, etc.

http://stackoverflow.com/q/23067739
tagged with: netbeans
has comment: http://stackoverflow.com/comment/35251350
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35252384
has comment: http://stackoverflow.com/comment/35252641
has comment: http://stackoverflow.com/comment/35252443
has comment: http://stackoverflow.com/comment/35251395
type: Question
has answer: http://stackoverflow.com/a/47376298
tagged with: jar
has comment: http://stackoverflow.com/comment/35251454
downvote count: 0
has body: I am doing a project in NetBeans. I made a .jar file of my project. Then gave clean and build, I can see a .jar file in my mainproject/dist folder. When I try to open the .jar file with OpenJDKJava 7 Runtime, nothing shows. Can anyone help me with this, why is it being blank? I mean it doesn't run or do anything- no response when I click on use OpenJDKJava 7 runtime. Any help would be appreciated.
has title: running .jar file in ubuntu
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/23068781
favorite count: 0
has answer: http://stackoverflow.com/a/23067821
has comment: http://stackoverflow.com/comment/35251446
has comment: http://stackoverflow.com/comment/35251914
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35251815

http://stackoverflow.com/comment/35259453
has text: Where does the NPE come from? Hibernate javadoc says `get()` method returns null if it's not found, not throws NPE
type: QuestionComment
comment on: http://stackoverflow.com/q/23071717
score: 1
type: Comment

http://stackoverflow.com/q/22975965
answer count: 1
accepted answer: http://stackoverflow.com/a/22976104
has comment: http://stackoverflow.com/comment/35085386
has title: Why if I import a library.jar, it is necessary to say the native library location?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22976104
type: Question
tagged with: opencv
has body: I am working with java in eclipse, and to use opencv I need to import the library .jar (for me opencv-2.4.8.jar) and I need to specify the native library location (i.e. for libopencv_java248.so). If not, I get an error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java248 in java.library.path. So, why I need to do this reference? why isn't it enough with import the opencv.jar library?
tagged with: eclipse
score: 0

http://stackoverflow.com/a/44332307
has body: I have seen both cases in practice, in medium- to large-sized business web applications, using various web frameworks (JSP/Struts 1.x, GWT, JSF 2, with Java EE and Spring). In my experience, it's best to demarcate transactions at the highest level, ie, at the "controller" level. In one case, we had a BaseAction class extending Struts' Action class, with an implementation for the execute(...) method that handled Hibernate session management (saved into a ThreadLocal object), transaction begin/commit/rollback, and the mapping of exceptions to user-friendly error messages. This method would simply rollback the current transaction if any exception got propagated up to this level, or if it was marked for rollback only; otherwise, it would commit the transaction. This worked in every case, where normally there is a single database transaction for the whole HTTP request/response cycle. Rare cases where multiple transactions were needed would be handled in use-case specific code. In the case of GWT-RPC, a similar solution was implemented by a base GWT Servlet implementation. With JSF 2, I've so far only used service-level demarcation (using EJB Session beans which automatically have "REQUIRED" transaction propagation). There are disadvantages here, as opposed to demarcating transactions at the level of the JSF backing beans. Basically, the problem is that in many cases the JSF controller needs to make several service calls, each one accessing the application database. With service-level transactions, this implies several separate transactions (all committed, unless an exception occurs), which taxes more the database server. It isn't just a performance disadvantage, though. Having multiple transactions for a single request/response can also lead to subtle bugs (I don't remember the details anymore, just that such issues did occur). Other answer to this question talks about "logic needed to identify the scope of a database/business transaction". This argument doesn't make sen…
downvote count: 1
answers question: http://stackoverflow.com/q/23118789
upvote count: 36
has comment: http://stackoverflow.com/comment/91578325
has comment: http://stackoverflow.com/comment/75741999
has comment: http://stackoverflow.com/comment/91577500
score: 35
type: Answer

http://stackoverflow.com/comment/35280595
type: QuestionComment
comment on: http://stackoverflow.com/q/23084165
has text: You could try window.onunload = closeDown; (closeDown calls your logout.jsp file). But browser implementation is flaky at best.
score: 0
type: Comment

http://stackoverflow.com/comment/35376201
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23123354
has text: xy for a y intercept ???
score: 0

http://stackoverflow.com/comment/35153096
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23009624
has text: Hi @Absurd-Mind , I've updated my question to include the `debugGlobalParams()` method. The `FamilyId` is assigned from ResultSet input param. Yes, I know I should not be creating this kind of dependencies, but was the easier way to avoid extra queries to DB. I'm already changing the approach to avoid this problem but I would still like to know what was happening in the code.... :S

http://stackoverflow.com/comment/35306056
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23097696
type: Comment
has text: Just looking at your code and one thing is a bit strange - you are looping through `numberOfFoods` for each gerbil - but there is only a single consumption value stored - so the consumption for food 0 will be overwritten by the consumption of food 1 which will be overwritten by food 2 and so on... Should it perhaps be `gerbilConsumption[index] = gerbilConsumption[index] + amountOfFood;` to keep a total of all food consumption per gerbil?

http://stackoverflow.com/q/23032697
has comment: http://stackoverflow.com/comment/35411680
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23032809
possible better answer: http://stackoverflow.com/a/23032948
tagged with: java
has answer: http://stackoverflow.com/a/23032948
type: Question
answer count: 2
tagged with: jtextarea
tagged with: layout
has title: using both JTabbedPane and JScrollPane
has body: As you see the code, I would like to implement the 2nd tab with a text area, scrolling, and a button down there. This (JScrollPane scr = new JScrollPane(secondTab(panel2));) code was in the function, private static JTextArea secondTab(JPanel panel) before but I took it out of the function and put that back to MainFrame. Because the scroll and text area didn't show up. Now that I moved the code to mainframe the tex tarea and scroll are visible, but I'm struggling with making the button showing up in the 2nd tab. Do you guys have any idea? public MainFrame(String username) { JTabbedPane tab = new JTabbedPane(); mainFrame.add(tab, BorderLayout.CENTER); JPanel panel1 = new JPanel(); firstTab(panel1); tab.add("babababa", panel1); JPanel panel2 = new JPanel(); JScrollPane scr = new JScrollPane(secondTab(panel2)); JButton saveButton = new JButton("Save"); panel2.add(saveButton); saveButton.setBounds(190, 280, 80, 40); tab.add("hahaha", panel2.add(scr)); mainFrame.setBounds(200,200,500,400); mainFrame.setVisible(true); } private static JTextArea secondTab(JPanel panel) { panel.setLayout(null); final JTextArea nameTextArea=new JTextArea(); nameTextArea.setBounds(10,10,440,270); nameTextArea.setLineWrap(true); return nameTextArea; } }
accepted answer: http://stackoverflow.com/a/23032809
score: 0

http://stackoverflow.com/a/23104024
has comment: http://stackoverflow.com/comment/35318536
upvote count: 1
has body: My guess is that this.Produit[nbrProduct] is null. It can be initialized: this.Produit[nbrProduct] = new String[someSize];
downvote count: 0
has comment: http://stackoverflow.com/comment/35315665
score: 1
has comment: http://stackoverflow.com/comment/35315649
answers question: http://stackoverflow.com/q/23103974
type: Answer
has comment: http://stackoverflow.com/comment/35318661

http://stackoverflow.com/comment/35129233
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23000002
has text: I'm not sure if you understand, in the R.java where all of the ids and strings are located (I assume), I cannot find itemTag. It is simply not there. I am assuming that once I create a string in string.xml, the string would also automatically pop up in R.java, but it doesn't seem like that is the case.
score: 0

http://stackoverflow.com/comment/35229893
comment on: http://stackoverflow.com/a/23056036
score: 0
type: AnswerComment
type: Comment
has text: same result `Could not open ServletContext resource [/WEB-INF/applicationContext.xml]`

http://stackoverflow.com/a/29306140
upvote count: 2
answers question: http://stackoverflow.com/q/22990378
has comment: http://stackoverflow.com/comment/71031367
score: 2
downvote count: 0
has body: you can try redirecting to a logical path that will be catched from a controller Try response.sendRedirect("/NotLogged"); And then create a function like this: @RequestMapping(value = {"/NotLogged"}, method = RequestMethod.GET) public String notLogged() { return "login.html"; } I hope it will work for you!
type: Answer

http://stackoverflow.com/q/23059620
has body: I am trying to access some values in an XML document with Dom parser and I am getting a strange null pointer exception error. the code I am using is: import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; public class readXML { public static void main(String[] args) { File file = new File("C:\\Users\\manolaki\\Desktop\\assets.xml"); try { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse(file); doc.getDocumentElement().normalize(); Node node = doc.getElementsByTagName("assets").item(0).getChildNodes().item(1).getChildNodes().item(1).getAttributes().getNamedItem("src"); String boo = node.getNodeValue(); System.out.println("Name is " + boo); } catch (Exception e) { e.printStackTrace(); } } } the xml I am Using: <?xml version="1.0" encoding="UTF-8"?> The code works fine as is and it prints out "menu.png" at the console. The problem is that while I can navigate through the assets nodes using the first "Item()" part, if i try to change the second "item()" to navigate through the sprites it prints a null pointer exception error. for example it works if I use: Node node = doc.getElementsByTagName("assets").item(1).getChildNodes().item(1).getChildNodes().item(1).getAttributes().getNamedItem("src"); but not when I use Node node = doc.getElementsByTagName("assets").item(0).getChildNodes().item(2).getChildNodes().item(1).getAttributes().getNamedItem("src"); Which I think is kind of strange.. given that eclipse is not finding any errors. any help would be appreciated. thanks
has title: how can I access the values of XML nodes using DOM API
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/23060481
has comment: http://stackoverflow.com/comment/35236460
has comment: http://stackoverflow.com/comment/35238130
answer count: 1
favorite count: 0
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23060481
tagged with: dom
has comment: http://stackoverflow.com/comment/35236288

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

http://stackoverflow.com/q/22972414
favorite count: 0
has title: Add parts to variable[]
has comment: http://stackoverflow.com/comment/35078694
type: AnsweredQuestion
has body: Is there a way to add parts to a variable[], when the amount of parts is not constant? For example: String[] S = {"hello", "hello1", "hello2"}; I want to add String S2 = "hello3" with something like this: S = S + {S2}
tagged with: java
has comment: http://stackoverflow.com/comment/35078689
upvote count: 1
has answer: http://stackoverflow.com/a/22972640
type: Question
has comment: http://stackoverflow.com/comment/35078743
possible better answer: http://stackoverflow.com/a/22972640
has answer: http://stackoverflow.com/a/22972455
has comment: http://stackoverflow.com/comment/35078692
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/22972455
score: 1

http://stackoverflow.com/comment/35333394
comment on: http://stackoverflow.com/q/23113855
score: 0
type: Comment
type: QuestionComment
has text: Are you initializing your ArrayList collections anywhere?

http://stackoverflow.com/a/23125865
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23125826
has body: Use a DocumentFilter to filter the values going to a text component in real time, that's what it's design for. Take a look at these examples, there's even a PatternFilter for using with regular expressions... For post validation, use a InputVerifier
answers question: http://stackoverflow.com/q/23125826

http://stackoverflow.com/comment/35261928
comment on: http://stackoverflow.com/a/23004121
type: AnswerComment
type: Comment
has text: I managed to solve this using the link you provided plus a lot of experimentation.
score: 0

http://stackoverflow.com/q/22976397
has body: //creating two lists of gui components ArrayList&lt;JLabel&gt; labelList = new ArrayList&lt;JLabel&gt;(); ArrayList&lt;JTextField&gt; textFieldList = new ArrayList&lt;JTextField&gt;(); //number of labels and textfields i want to add int numOfAt = Data.getInstance().getInstances().numAttributes(); //for loop, for adding these components for (int i = 0; i &lt; numOfAt - 1; i++) { String name = Data.getInstance().getInstances().attribute(i).name(); labelList.add(new JLabel(name)); labelList.get(i).setText(name); textFieldList.add(new JTextField()); add(labelList.get(i)); add(textFieldList.get(i)); textFieldList.get(i).setSize(55, 25); } These code works. Labels and fields is added on my jPanel. But i can't find solution how to place them one below other. jLabel and jTextField is placed next on each other on the first iteration of for loop. I want on second iteration, next two components to place below first two components. I'm using flow layout.
answer count: 1
tagged with: user-interface
tagged with: flowlayout
type: AnsweredQuestion
has title: Placing swing components one below other using for loop?
score: 0
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/22977087
tagged with: java
accepted answer: http://stackoverflow.com/a/22977087
tagged with: for-loop

http://stackoverflow.com/a/23143913
upvote count: 11
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/85518881
type: Answer
accepted answer of: http://stackoverflow.com/q/23114018
downvote count: 0
has comment: http://stackoverflow.com/comment/85519770
answers question: http://stackoverflow.com/q/23114018
score: 11
has body: Entering, exiting, and throwing are logged at level FINER. You'll have to set your logger to FINER or lower and set your FileHandler to FINER or lower. thisLogger.addHandler(logFileHandler); thisLogger.setLevel(Level.FINER); logFileHandler.setLevel(Level.ALL); As far as style goes, you should try creating a static final for class name because you'll use it as the name of the logger and reference it for entering, exiting, throwing, and log precise tracing: private static final String CLASS_NAME = MyClass.class.getName(); You always want to use a class literal to fetch the name (as above) because getClass().getName() can return a subclass name which can falsify your tracing. For method names don't include () in the name, just use the entering/exiting method that matches the number of arguments. For constructor method names use "&lt;init&gt;" and for static init blocks use "&lt;clinit&gt;" as the method name since that is what would show up in a stacktrace.

http://stackoverflow.com/comment/35086827
type: QuestionComment
has text: yes, i just tries it, thanks
comment on: http://stackoverflow.com/q/22976535
score: 0
type: Comment

http://stackoverflow.com/q/23125548
answer count: 1
has comment: http://stackoverflow.com/comment/35354724
has comment: http://stackoverflow.com/comment/35355391
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/35355407
has title: Java.lang.nullpointerException(Android)
type: UnansweredQuestion
tagged with: android
has body: I was passing the value from AsyncTask class to the addValue method and get the value from getValue method. Here addValue works well but the getValue somehow cannot get the value and return Java.lang.nullPointerException in my apps when i click the image package com.example.mobile_e_commerce; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.ResourceBundle; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.PropertyInfo; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; import com.example.mobile_e_commerce.dummy.ProductInfo.ProductItem; import android.app.Activity; import android.app.Fragment; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.GridView; import android.widget.Toast; //include soap passing here public class ProductCollection extends Activity { public final static String EXTRA_MESSAGE = "com.example.mobile_e_commerce.product_name"; private static final ResourceBundle rb = ResourceBundle.getBundle("com.example.mobile_e_commerce.webserviceurl"); public static Map&lt;String, ProductItem&gt; ITEM_MAP = new HashMap&lt;String, ProductItem&gt;(); //Class involve asynctask(background running)// public class objectTransfer extends AsyncTask&lt;Void,Void,Void&gt;{ the web services url and soap action all listed down here but i tested already and return value back too. private final String NAMESPACE = rb.getString("WSDLTargetNamespace"); private final String SoapURL = rb.getString("SoapAddress"); private final String SOAP_ACTION = rb.getString("SoapAction"); private final St…
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35354754
has comment: http://stackoverflow.com/comment/35355512
has answer: http://stackoverflow.com/a/23126577
score: 0

http://stackoverflow.com/a/23021283
downvote count: 0
answers question: http://stackoverflow.com/q/23021151
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/23021151
upvote count: 1
has body: I recommend you to use alarm manager that will be trigger at every time X... execute the download.. Why? because if you use services it might be closed at some point and you might end up skipping some updates at a certain time (unknown). Or just use service knowing that it is ok if its get close at certain point by the system fto free the ram and restart again after.
type: AcceptedAnswer

http://stackoverflow.com/comment/35252553
type: QuestionComment
comment on: http://stackoverflow.com/q/23068041
score: 1
type: Comment
has text: Then can you just put ---------- `Log.i(TAG, mUserName == null ? "mUserName is null" : mUserName.getText() == null ? "mUserName.getText() is null" : "nothing is null");` -------------- at line 39?

system.out
tags question: http://stackoverflow.com/q/23125289
tag name: system.out
tags question: http://stackoverflow.com/q/23123134
tags question: http://stackoverflow.com/q/22973572
type: Tag

http://stackoverflow.com/a/23036502
has comment: http://stackoverflow.com/comment/35194715
has comment: http://stackoverflow.com/comment/35194814
score: 0
has body: To answer your questions: Yes, a new object is being created every time you call that. But, the old object will be garbage collected because it won't be in use anymore. So there isn't much to worry about in terms of that. fadeOut.setAnimationListener(null) will in fact clear out the currently assigned listener, but if you're trying to set a new listener then it doesn't make a difference because, like I said above, assigning a new listener will clear out the previous one from memory. I would say that the more clean way to do it is to set it to 'this' and then implement AnimationListener inside your current class.
type: Answer
has comment: http://stackoverflow.com/comment/35194770
has comment: http://stackoverflow.com/comment/35194759
has comment: http://stackoverflow.com/comment/35194848
has comment: http://stackoverflow.com/comment/35194732
answers question: http://stackoverflow.com/q/23036432
has comment: http://stackoverflow.com/comment/35194879
has comment: http://stackoverflow.com/comment/35194730

http://stackoverflow.com/comment/35254322
comment on: http://stackoverflow.com/q/23069246
score: 0
type: QuestionComment
has text: this is just eclipse's prediction I believe, it ranks methods by relevancy of use.
type: Comment

http://stackoverflow.com/q/23109547
has body: Yesterday I was screwing around with Java, and I wrote this application. public class MaxInt { public static void main(String[] args){ long startTime = System.currentTimeMillis(); long endTime; for(int i = 0; i &lt; 2147483647; i++){ } endTime = System.currentTimeMillis(); long timeneeded = startTime - endTime; System.out.println("It took " + timeneeded + " milliseconds to count to 2,147,483,646."); } } Strangely, however, timeneeded is equal to -3 after the loop has completed, which doesn't make any sense to me at all. I was just curious as to why, and how, this program could generate time.
has answer: http://stackoverflow.com/a/23109885
has comment: http://stackoverflow.com/comment/35325178
favorite count: 0
has answer: http://stackoverflow.com/a/23109572
tagged with: process
has answer: http://stackoverflow.com/a/23109609
downvote count: 1
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23109609
score: -1
accepted answer: http://stackoverflow.com/a/23109572
tagged with: timing
type: Question
tagged with: benchmarking
upvote count: 0
has title: Time Generation in Java
answer count: 3

http://stackoverflow.com/q/23113199
answer count: 0
type: Question
has comment: http://stackoverflow.com/comment/35332209
score: 0
has body: Currently,I am using ANTLR to develop a interpreter for some specific area language by myself, you could think it as something like MATLAB.And I want to make a terminal that do 3 things: 1) input command for interpret in black color. 2) output result to user in black color ,as well as error info in red color 3) output hyperlink to help info in underline style,where user click the link,then related help window show . Some good software like VIM,MATLAB both use this kind of color text and hyperlink for users. for currently,I have referenced 342990 and realized requirements 2; referenced insert String to JTextPane as hyperlink and realized requirements 3. But how to redirect system.in to a JTextPane correctly,the link 9244108 haven't sovled it , it didn't work for me. Redirect system.in to JTextPane or JTextArea may have a lot job with buffer process,it seemd hard for me. Any one who can give me some suggestion is really appreciated.
tagged with: swing
has comment: http://stackoverflow.com/comment/35332440
linked to: http://stackoverflow.com/q/9244108
has title: What is the better way to use Swing to Simulate a Console?
tagged with: java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/342990

http://stackoverflow.com/a/23028054
has comment: http://stackoverflow.com/comment/35179732
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23027952
has comment: http://stackoverflow.com/comment/35179681
has comment: http://stackoverflow.com/comment/35179839
type: Answer
has body: If you're using argument matches, you need to use them for all arguments. So to fix your test, you can just use: verify(loginService).getUser(eq(loginName), Matchers.&lt;String&gt;eq(null)); Or: verify(loginService).getUser(eq(loginName), (String) isNull()); Or personally, I'd clarify this by simply having a userAgent variable with a value of null: String userAgent = null; verify(loginService).getUser(eq(loginName), eq(userAgent));
score: 2
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23027952

http://stackoverflow.com/comment/35309349
comment on: http://stackoverflow.com/q/23100148
type: QuestionComment
score: 1
has text: put code of `ActivityInstrumentationTestCase2`. does this class contain constructor that you tried to call?
type: Comment

http://stackoverflow.com/comment/35074364
comment on: http://stackoverflow.com/a/22969396
has text: Maybe the key is out of date?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23044904
upvote count: 6
has body: I think here is the correct version of your code: Session session = getCurrentSession(); ProjectionList projectionList = Projections.projectionList(); projectionList.add(Projections.groupProperty("totalCode")) .add(Projections.groupProperty("activityCode")) .add(Projections.sum("amount")) .add(Projections.rowCount()); Criteria criteria = session.createCriteria(Payment.class); criteria.setProjection(projectionList); List&lt;Object[]&gt; payments = criteria.list(); for (Object[] payment : payments) { System.out.println("totalCode: " + payment[0]); System.out.println("activityCode: " + payment[1]); System.out.println("amountSum: " + payment[2]); System.out.println("rowCount: " + payment[3]); }
accepted answer of: http://stackoverflow.com/q/23044565
has comment: http://stackoverflow.com/comment/105679159
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/54970224
type: Answer
score: 6
answers question: http://stackoverflow.com/q/23044565

http://stackoverflow.com/a/23085176
has body: The com.XXXXX.AuhProvider supports only objects of the type GeneralAuthentication.class. Since you mock authen it no longer has this class, but rather com.XXXXX.GeneralAuthentication$$EnhancerByMockitoWithCGLIB$$6db1e4cf. The test in the support method must be the other way around: GeneralAuthentication.class.isAssignableFrom(aClass) Which means "is aClass GeneralAuthentication.class or a subtype of it".
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/23084029
answers question: http://stackoverflow.com/q/23084029
upvote count: 1

http://stackoverflow.com/a/23112839
accepted answer of: http://stackoverflow.com/q/23112571
answers question: http://stackoverflow.com/q/23112571
score: 1
upvote count: 1
has body: Yes. The NetBeans IDE is built on the NetBeans Platform: https://netbeans.org/kb/trails/platform.html https://netbeans.org/features/platform/
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35239090
has text: You've not posted how `location` is calculated, nor how you print those logcats, nor what you mean by "shown as empty", nor how you know that the size is still 5.
type: Comment
comment on: http://stackoverflow.com/q/23060774
score: 0
type: QuestionComment

http://stackoverflow.com/q/23117769
has comment: http://stackoverflow.com/comment/35340718
answer count: 2
downvote count: 0
has title: why the "KeyPressed" is not work in java?
has answer: http://stackoverflow.com/a/23117933
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35340794
has answer: http://stackoverflow.com/a/23117935
score: 1
tagged with: java
has body: I want if I pressed 'n' char print some thing in java, I giving the action to the keylistener but I don't know why it is not worked? import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Test extends JPanel implements KeyListener { public Test() { super(); this.addKeyListener(this); } //*************key********************************* public void keyTyped(KeyEvent e) { } //*************key********************************************************************* public void keyPressed(KeyEvent e) { if(e.getKeyChar()=='n'){ System.out.print("hhhhhh"); } } //*************key********************************************************************** public void keyReleased(KeyEvent e) { } //************************************************** public static void main(String[] args) { JFrame frame = new JFrame("java lover"); Test panel=new Test(); frame.add(panel); frame.setSize(600, 600); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } thanks for helping.
upvote count: 1
type: Question

http://stackoverflow.com/q/22996441
answer count: 3
has comment: http://stackoverflow.com/comment/35121924
has answer: http://stackoverflow.com/a/22996539
favorite count: 0
has answer: http://stackoverflow.com/a/22996541
type: AnsweredQuestion
has title: Java error: not a statement and I don't know why?
has comment: http://stackoverflow.com/comment/35121750
accepted answer: http://stackoverflow.com/a/22996486
has body: I'm really not sure what is causing this compile time error to occur???? I've been trying to figure it out and can't seem to find what the problem is. ClassTable.java:253: error: not a statement class_c class = classes.nextElement(); ^ ClassTable.java:253: error: ';' expected class_c class = classes.nextElement(); ^ ClassTable.java:253: error: &lt;identifier&gt; expected class_c class = classes.nextElement(); ^ ClassTable.java:253: error: &lt;identifier&gt; expected class_c class = classes.nextElement(); ^ ClassTable.java:254: error: illegal start of expression class_c parent = table.getClass(class.getParent()); ^ ClassTable.java:254: error: ';' expected class_c parent = table.getClass(class.getParent()); ^ ClassTable.java:264: error: illegal start of expression list.add(class); ^ ClassTable.java:264: error: ';' expected list.add(class); Here's my Code: class ClassTable { private int semantErrors; private PrintStream errorStream; private Hashtable&lt;class_c,ArrayList&lt;class_c&gt;&gt; table; private boolean noCycles = true; public void addClass(class_c c){ Hashtable&lt;class_c, ArrayList&lt;class_c&gt;&gt; table = this.table(); if(table.containsKey(c)){ errorStream.print(c.getFilename() + ":" + c.getLineNumber() + ": " + "Class " + c.getName() + " was previously defined."); System.out.println(); this.semantError(); } else{ ArrayList&lt;class_c&gt; list = new ArrayList&lt;class_c&gt;(); table.put(c,list); } } public void addChildren(){ Enumeration classes = this.table.keys(); while(classes.hasMoreElements()) { class_c class = classes.nextElement(); class_c parent = table.getClass(class.getParent()); if(!table.containsKey(parent)){ errorStream.print(c.getFilename() + ":" + c.getLineNumber() + ": " + "Class "+ c.getName() + " inherits from an undefined class " + c.getParent()+"."); System.out.println(); this.semantError(); } else{ ArrayList&lt;class_c&gt; list = table.get(parent); list.add(class); this.table.put(parent,list); } } } } HELP ME PLEASE. Why do I keep get…
tagged with: java
possible better answer: http://stackoverflow.com/a/22996539
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22996486
upvote count: 0
score: -1

http://stackoverflow.com/comment/121227589
type: AnswerComment
comment on: http://stackoverflow.com/a/47527525
type: Comment
has text: I've found that this (and the accepted answer) works for Micronaut's application.yml as well.
score: 1

http://stackoverflow.com/q/23122866
has body: I want it to look as if the users input is being responded to by the machine in a loop like sequence that goes back to the original question and allows the previous answers to be accepted as viable answers. import java.util.Scanner; public class Application { public static void main(String[] args) { Scanner input = new Scanner( System.in); System.out.println("Please enter a command: "); String text = input.nextLine(); switch (text) { case "start": System.out.println("Machine Started!"); break; case "stop": System.out.println("Machine Stopped."); break; case "sleep": System.out.println("In progress: sleeping..."); break; case "transform": System.out.println("In progress: transforming..."); break; default: System.out.println("Command not recognized"); } } }
answer count: 1
has title: Loop when "talking to machine"
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35350224
tagged with: java.util.scanner
tagged with: loops
type: Question
tagged with: case
tagged with: java
has answer: http://stackoverflow.com/a/23123066
score: 0

http://stackoverflow.com/a/23032498
answers question: http://stackoverflow.com/q/23032477
has body: Array have the length field ArrayList doesnot have the length field type Use size()
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/35207828
has text: Personally, I'd probably make the "one line" a call to a function I'd written to read the file.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23041627
type: QuestionComment

http://stackoverflow.com/comment/35160221
score: 0
comment on: http://stackoverflow.com/a/23017572
has text: No, it isn't but that has not been a problem before with other applications. Should it be in it though?
type: Comment
type: AnswerComment

jsf-2
tags question: http://stackoverflow.com/q/23078752
type: Tag
tags question: http://stackoverflow.com/q/23043594
tags question: http://stackoverflow.com/q/23126618
tags question: http://stackoverflow.com/q/23074113
tags question: http://stackoverflow.com/q/23061172
tag name: jsf-2
tags question: http://stackoverflow.com/q/23007635
tags question: http://stackoverflow.com/q/23089372
tags question: http://stackoverflow.com/q/23042347
tags question: http://stackoverflow.com/q/23078684
tags question: http://stackoverflow.com/q/22980359
tags question: http://stackoverflow.com/q/23053891
tags question: http://stackoverflow.com/q/23087492
tags question: http://stackoverflow.com/q/23084344
tags question: http://stackoverflow.com/q/23042675
tags question: http://stackoverflow.com/q/22982635
tags question: http://stackoverflow.com/q/22981586
tags question: http://stackoverflow.com/q/22985468
tags question: http://stackoverflow.com/q/23038630

http://stackoverflow.com/comment/35277490
type: Comment
comment on: http://stackoverflow.com/a/23077728
has text: Yes. I have used all the files uiskin.atlas,uiskin.png and uiskin.json. But still not working.
score: 0
type: AnswerComment

client-server
tags question: http://stackoverflow.com/q/23089495
tags question: http://stackoverflow.com/q/23128232
tags question: http://stackoverflow.com/q/23000708
type: Tag
tags question: http://stackoverflow.com/q/23077581
tag name: client-server
tags question: http://stackoverflow.com/q/23079460
tags question: http://stackoverflow.com/q/23108835
tags question: http://stackoverflow.com/q/23068536
tags question: http://stackoverflow.com/q/23016484

http://stackoverflow.com/comment/35176230
type: QuestionComment
comment on: http://stackoverflow.com/q/23025901
has text: Are you sure you're sending correctly from Java? Do you have a piece of the code you use to send this JSON to the server?
score: 0
type: Comment

http://stackoverflow.com/q/23042575
has body: Below are two classes defined to have one to one relationship with each other. So basically Person table is maintained to contain PersonDetails table's id as foreign key. To my understanding as per one to one mapping for every entry in table Person there should be associated single entry in the PersonDetails entry and vice versa it true as well i.e., for every entry in the PersonDetails table there should be an associated single entry in the Person table. TestPerson class below tries to associated single entry in PersonDetails table to two or more entries in the Person table and to my surprise it succeeds. This behavior seems similar to many to one mapping. Can anyone explain to me why is it so? Or if I am missing anything? @Entity public class Person { private int personId; private String personName; private PersonDetails personDetails; @Id @GeneratedValue public int getPersonId() { return personId; } public void setPersonId(int personId) { this.personId = personId; } public String getPersonName() { return personName; } public void setPersonName(String personName) { this.personName = personName; } @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name="personDetailsFK") public PersonDetails getPersonDetails() { return personDetails; } public void setPersonDetails(PersonDetails personDetails) { this.personDetails = personDetails; } } @Entity public class PersonDetails { private int personDeatilsId; private int income; private String job; private int zipCode; @Id @GeneratedValue public int getPersonDeatilsId() { return personDeatilsId; } public void setPersonDeatilsId(int personDeatilsId) { this.personDeatilsId = personDeatilsId; } public int getIncome() { return income; } public void setIncome(int income) { this.income = income; } public String getJob() { return job; } public void setJob(String job) { this.job = job; } public int getZipCode() { return zipCode; } public void setZipCode(int zipCode) { this.zipCode = zipCode; } } public class Te…
type: Question
tagged with: postgresql
score: 0
answer count: 1
has title: Hibernate annotation @OnetoOne doesn't seem to restrict many to one entries in the database
has answer: http://stackoverflow.com/a/23042660
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23042660
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/23120587
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35346299
has comment: http://stackoverflow.com/comment/35346180
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23120671
linked to: http://stackoverflow.com/q/1908515
has title: Multithreading with waiting for finish
has answer: http://stackoverflow.com/a/23120708
has body: Recently I played around with multi threading a bit, and tried let multiple threads work on the same thing, but only continue with the execution of my programm once all threads are done. My code is way too slow (it should be way faster that it actually is) and I want to know if there is maybe a more efficient and faster way to achieve this: My runnable class. For a certain task there needs to be a new Runnable which extends this Runnable and overwrites doTask(). public abstract class ParallelCappedRunnable implements Runnable { private final Lock lock; private final Condition condition; private final ParallelCappedMultithreader pcm; public ParallelCappedRunnable(ParallelCappedMultithreader pcm, Lock lock, Condition condition) { this.lock = lock; this.condition = condition; this.pcm = pcm; } @Override public final void run() { doTask(); pcm.sendSignal(); if(pcm.getMissingSignals() == 0) { lock.lock(); try { condition.signal(); } finally { lock.unlock(); } } } public abstract void doTask(); } This class starts many new threads which all work on the same task as soon as someone calls start() and "the call is over" (idk how to call this) as soon as every thread is done. public class ParallelCappedMultithreader { private AtomicInteger missingSignals = new AtomicInteger (0); private final int MAX_THREADS; private final Lock lock = new ReentrantLock(); private final Condition condition = lock.newCondition(); private final Class runnable, parentClass; private final Object parentInstance; public ParallelCappedMultithreader(Class&lt;? extends ParallelCappedRunnable&gt; runnable, int threads, Class parentClass, Object parentInstance) { this.runnable = runnable; this.parentClass = parentClass; this.MAX_THREADS = threads; this.parentInstance = parentInstance; } public ParallelCappedMultithreader(Class&lt;? extends ParallelCappedRunnable&gt; runnable, int threads) { this(runnable, threads, null, null); } public void start() throws InterruptedException{ try { missingSignals.set(MA…
score: 0

http://stackoverflow.com/a/22993398
type: Answer
has comment: http://stackoverflow.com/comment/35148348
answers question: http://stackoverflow.com/q/22993174
has body: You will need an object like: public class DateFormat implements Serializable { private static final long serialVersionUID = 1L; private int column; private String pattern; public String getPattern() { return name; } public void setPattern(String pattern) { this.pattern = pattern; } public int getColumn() { return name; } public void setColumn(String column) { this.column = column; } } And then your main object like: public class DateFormatList implements Serializable { private static final long serialVersionUID = 2514719982327593095L; private List&lt;DateFormat&gt; dateFormats = new ArrayList&lt;DateFormat&gt;(); public List&lt;DateFormat&gt; getDateFormats() { return name; } public void setDateFormats(List&lt;DateFormat&gt; formats) { this.dateFormats= formats; } } The method in your controller will look like: public @ResponseBody String login(@RequestBody DateFormatList dataFormaPojo){ .... }
has comment: http://stackoverflow.com/comment/35152706
score: 0

http://stackoverflow.com/q/22995753
has answer: http://stackoverflow.com/a/22995842
type: Question
linked to: http://stackoverflow.com/q/7477181
answer count: 5
has body: Recently im studying Stack, Bag, and Queue. A question came out of my mind while im reading note from class. what is the difference between Array and Linked? Why we can't just use Stack? Stack&lt;String&gt; stack = new Stack&lt;String&gt;() Stack&lt;String&gt; stack = new ArrayStack&lt;String&gt;() These two i think they do the same thing, they can peek , pop , and remove I don't get it that why we need to implement array or linked
tagged with: linked-list
has answer: http://stackoverflow.com/a/22995903
tagged with: stack
tagged with: java
has answer: http://stackoverflow.com/a/22995904
upvote count: 1
has answer: http://stackoverflow.com/a/22995891
has title: What is the difference between Array Stack , Linked Stack , and Stack
accepted answer: http://stackoverflow.com/a/22995904
possible better answer: http://stackoverflow.com/a/22995865
type: AnsweredQuestion
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/22995865
score: 1
favorite count: 0

http://stackoverflow.com/q/22989806
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/36112619
favorite count: 0
has comment: http://stackoverflow.com/comment/120215597
answer count: 12
has title: Find the most common String in ArrayList()
score: 13
downvote count: 1
has answer: http://stackoverflow.com/a/37561800
has answer: http://stackoverflow.com/a/44236249
has comment: http://stackoverflow.com/comment/35109367
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35109416
tagged with: list
has answer: http://stackoverflow.com/a/22989899
has answer: http://stackoverflow.com/a/22990086
has answer: http://stackoverflow.com/a/22990163
has answer: http://stackoverflow.com/a/36112619
tagged with: java
accepted answer: http://stackoverflow.com/a/22990086
type: Question
has answer: http://stackoverflow.com/a/44844480
has answer: http://stackoverflow.com/a/22989860
has answer: http://stackoverflow.com/a/44883573
has answer: http://stackoverflow.com/a/28408433
linked to: http://stackoverflow.com/q/19031213
has answer: http://stackoverflow.com/a/22989891
tagged with: arrays
has answer: http://stackoverflow.com/a/44843167
has body: Is there a way to find the most common String in an ArrayList? ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;(); list.add("test"); list.add("test"); list.add("hello"); list.add("test"); Should find the word "test" from this list ["test","test","hello","test"]
upvote count: 14

http://stackoverflow.com/q/22972306
type: Question
has comment: http://stackoverflow.com/comment/35079133
has comment: http://stackoverflow.com/comment/35079051
has body: I have create a program in Java which allows dragging of two oval shapes. Now I want to convert it to a JApplet so I made the class extend JApplet instead of original JPanel. The problem with this is that super.paintComponent(g) does not work as it is no longer a parent class. I have tried creating a JPanel within the class then referring to this but I get the error: The method paintComponent(Graphics) from the type JComponent is not visible Any heads up on what I need to do or any help would be much appreciated thanks. Here is my code. public class Main extends JPanel { private static final String TITLE = "Drag me!"; private static final int W = 640; private static final int H = 480; private Point origin = new Point(W / 2, H / 2); private Point mousePt; public Main() { this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); this.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { mousePt = e.getPoint(); repaint(); } }); this.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseDragged(MouseEvent e) { int dx = e.getX() - mousePt.x; int dy = e.getY() - mousePt.y; origin.setLocation(origin.x + dx, origin.y + dy); mousePt = e.getPoint(); repaint(); } }); } @Override public Dimension getPreferredSize() { return new Dimension(W, H); } public void paintComponent(Graphics g) { super.paintComponent(g); g.drawOval(0, origin.y, getWidth(), origin.y); g.drawOval(origin.x, 0, origin.x, getHeight()); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { JFrame f = new JFrame(TITLE); f.add(new Main()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } }); } }
answer count: 1
tagged with: applet
tagged with: awt
upvote count: 1
tagged with: paintcomponent
favorite count: 0
has comment: http://stackoverflow.com/comment/35079217
downvote count: 0
has answer: http://stackoverflow.com/a/22972599
accepted answer: http://stackoverflow.com/a/22972599
has title: using paintComponent method in JApplet
has comment: http://stackoverflow.com/comment/35078565
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35092478
score: 1
has comment: http://stackoverflow.com/comment/35079934
tagged with: java
has comment: http://stackoverflow.com/comment/35078789

http://stackoverflow.com/a/40161129
answers question: http://stackoverflow.com/q/22976970
has body: public class TreeMapDemo { public static void main(String[] args) { // creating maps TreeMap&lt;Integer, String&gt; treemap = new TreeMap&lt;Integer, String&gt;(); SortedMap&lt;Integer, String&gt; treemapincl = new TreeMap&lt;Integer, String&gt;(); // populating tree map treemap.put(2, "two"); treemap.put(1, "one"); treemap.put(3, "three"); treemap.put(6, "six"); treemap.put(5, "five"); System.out.println("Getting tail map"); treemap.tailMap(3).clear(); System.out.println("Tail map values: " + treemapincl); System.out.println("Tree map values: " + treemap); } } This will remove the elements in the tree map.
type: Answer
score: 0

http://stackoverflow.com/a/22972596
accepted answer of: http://stackoverflow.com/q/22970073
has comment: http://stackoverflow.com/comment/35118659
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22970073
has comment: http://stackoverflow.com/comment/35086764
has comment: http://stackoverflow.com/comment/35086544
type: Answer
has body: It'd be really helpful if you added a link to your pom.xml or build.xml or whatever dependency management you use. You list cxf-2.0.3-incubator.jar which looks odd to me. cxf-rt-frontend-jaxrs-2.7.10.jar DOES have a org.apache.cxf.service.factory.AbstractServiceFactoryBean class with a sendEvent(FactoryBeanListener.Event ev, Object ... args) method -> you have different versions of the AbstractServiceFactoryBean class in your classpath
has comment: http://stackoverflow.com/comment/35121994
has comment: http://stackoverflow.com/comment/35170388
score: 0

http://stackoverflow.com/a/22979758
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22976852
has comment: http://stackoverflow.com/comment/35116168
answers question: http://stackoverflow.com/q/22976852
upvote count: 2
has comment: http://stackoverflow.com/comment/35118073
has body: You don't have the choice. There MUST be an owner side, and there MUST be an inverse side. And it's YOUR responsibility to maintain both sides of the association: don't expect to have B inside A's collection of Bs when you only add A to B (and vice-versa) Now, nothing forbids you to have a methods addB(B b) inside A that adds b to A's collection of Bs, and which adds this to B's collection of As. And you can of course also have a method addA(A a) in B that does the same thing.

http://stackoverflow.com/comment/35276838
has text: Yes it is a java application, but i havent got code because i dont write it. In this program I set listening port on 9000. When i tests it on localhost with my own simple server its receive well from this client, problem is when i put client on linux server. I listening some data by wireshark and nothing received from client so I think linux blocks something.
comment on: http://stackoverflow.com/q/23081739
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35303525
score: 2
comment on: http://stackoverflow.com/q/23096329
has text: According to the comment, you have created your own class `WordCount`, but you have **not** overridden the `equals` method. Post your `WordCount` class, and you'll receive help quickly.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35269919
type: Comment
comment on: http://stackoverflow.com/q/23058030
has text: Maybe you can rename the dates as "date1" and "date2"? And then use createOnElement="weather_data/date1" and createOnElement="weather_data/date2"?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35186289
comment on: http://stackoverflow.com/q/23031572
has text: Your code will work correctly if listOfThings is a float array. So I don't understand why you would would get any problems here.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23117464
has body: I tried this with just adding components to the frame but it had the same problem. So I created a class and a panel and I am trying it this way. But now I have the same exact problem. None of my buttons appear within the frame. I am getting an illegalargumentexception also. (this code now works) changed I made are shown below. import java.awt.*; import javax.swing.*; public class Pan extends JFrame { public Pan(){ setLayout(new GridLayout(1,1)); JPanel panel1 = new JPanel(new GridLayout(4,3)); JButton zero = new JButton(""+0); JButton one = new JButton(""+1); JButton two = new JButton(""+2); JButton three = new JButton(""+3); JButton four = new JButton(""+4); JButton five = new JButton(""+5); JButton six = new JButton(""+6); JButton seven = new JButton(""+7); JButton eight = new JButton(""+8); JButton nine = new JButton(""+9); panel1.add(zero); panel1.add(one); panel1.add(two); panel1.add(three); panel1.add(four); panel1.add(five); panel1.add(six); panel1.add(seven); panel1.add(eight); panel1.add(nine); add(panel1); } public static void main(String[] args){ Pan frame = new Pan(); frame.setSize(800, 800); frame.setLocationRelativeTo(null); frame.setTitle("Number Pad"); frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE); frame.setVisible(true); }}
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/23117519
has title: Why won't anything appear within my frame?
accepted answer: http://stackoverflow.com/a/23117637
has answer: http://stackoverflow.com/a/23117519
has comment: http://stackoverflow.com/comment/35340529
has comment: http://stackoverflow.com/comment/35340149
favorite count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/35340097
type: AnsweredQuestion
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23117637
downvote count: 1
type: Question

http://stackoverflow.com/comment/35170430
score: 0
comment on: http://stackoverflow.com/a/23022700
type: Comment
type: AnswerComment
has text: but when I try print "for (Object number : list){System.out.println("layer= "+number);} result is "Number = [Layer:null]"

http://stackoverflow.com/q/23074278
has title: What am I missing in libGDX to get InputEvent on Actor?
has answer: http://stackoverflow.com/a/23076973
tagged with: java
type: Question
tagged with: libgdx
score: 0
answer count: 2
has body: I am using libGDX on Android. I set up the Stage and added a CustomActor with a custom draw. It's working properly. However, I am not able to get any logs for the touchDragged method via the InputListener for this actor. Even the code within it does not run. Here is the required exposure to the code: public class CustomActor extends Actor { public CustomActor() { this.setListener(new InputListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { return true; } @Override public void touchDragged(InputEvent event, float x, float y, int pointer) { //This log doesn't print up! Gdx.app.log("CustomActor","touchDragged"); //This code doesn't work either Vector2 v = CustomActor.this.localToParentCoordinates(new Vector2(x,y)); CustomActor.this.setPosition(v.x, v.y); } }); } } Can anyone help me out here on what am I missing ?
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23083828

http://stackoverflow.com/comment/35316137
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23103974
has text: I think its an NPE : "Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException"
score: 0

http://stackoverflow.com/a/23019925
has body: getActionBar() can retrun null if your window don't have an ActionBar. Like if you chose the Theme.NoTitleBar style as an Activity/Application theme. Use this code instead (picked from there): @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // The Action Bar is a window feature. The feature must be requested // before setting a content view. Normally this is set automatically // by your Activity's theme in your manifest. The provided system // theme Theme.WithActionBar enables this for you. Use it as you would // use Theme.NoTitleBar. You can add an Action Bar to your own themes // by adding the element true // to your style definition. getWindow().requestFeature(Window.FEATURE_ACTION_BAR); setContentView(R.layout.main); // experiment with the ActionBar ActionBar actionBar = getActionBar(); } This link also may help.
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/23019691
has comment: http://stackoverflow.com/comment/35165365
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23019691
upvote count: 3
type: Answer

http://stackoverflow.com/a/23009498
upvote count: 2
answers question: http://stackoverflow.com/q/23009455
has body: Your question has nothing to do with Eclipse. You need to escape back-slashes in Strings, as they are themselves an escape character. What you can eventually use to somewhat "shorten" your code is the system property System.getProperty("file.separator"), then assign it to some constant and use that reference instead. But that's close to cosmetics.
accepted answer of: http://stackoverflow.com/q/23009455
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/23056356
type: Answer
answers question: http://stackoverflow.com/q/23055284
has comment: http://stackoverflow.com/comment/35230725
has comment: http://stackoverflow.com/comment/35230850
has body: I think this might be come because u have get parameter in wrong way. String stopName = request.getParameter("stopName") != null ? request.getParameter("stopName").toString() : "null value"; it will also handle the null condition. try this code.
has comment: http://stackoverflow.com/comment/35230658
has comment: http://stackoverflow.com/comment/35230832
score: 0
has comment: http://stackoverflow.com/comment/35230533

http://stackoverflow.com/q/22988580
tagged with: android
has title: Display all items in SquareTextView in GridView
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/8481844
has body: I would like to display all items (SquareTextView) in GridView but on some resolution not all item are visible and user need to scroll. I would like to show all content for user without scrolling. SquareTextView contain methods (Adding this method to CGridView does not help): @Override protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) { final int width = getDefaultSize(getSuggestedMinimumWidth(),widthMeasureSpec); setMeasuredDimension(width, width); } @Override protected void onSizeChanged(final int w, final int h, final int oldw, final int oldh) { super.onSizeChanged(w, w, oldw, oldh); } //items are matching their parent How should I calculate Grid width/height to display all content? I look at: Gridview height gets cut but answer does not help.
type: Question
has answer: http://stackoverflow.com/a/23005010
accepted answer: http://stackoverflow.com/a/23005010
answer count: 1
tagged with: android-gridview
score: 0

http://stackoverflow.com/a/23079293
has body: Construct the Scanner by defining the charset it should use: Scanner skener=new Scanner(file,"UTF-8"); I believe ASCII is the default charset for Scanner so that needs to be changed. Also the file might not be encoded in UTF-8.
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23079104
downvote count: 0
answers question: http://stackoverflow.com/q/23079104

http://stackoverflow.com/a/23326640
has comment: http://stackoverflow.com/comment/35863111
type: Answer
has comment: http://stackoverflow.com/comment/35730466
answers question: http://stackoverflow.com/q/23110828
score: 2
downvote count: 0
has body: Yes, it is possible. 1) You can one of this methods: ColumnBuilder.addConditionalStyles or ColumnBuilder.addConditionalStyle 2) You should implement your own ConditionStyleExpression The working sample The code The code of implementation ConditionStyleExpression: public class FieldComparator extends ConditionStyleExpression implements CustomExpression { private String fieldName; private String valueToCheck; public FieldComparator(String fieldName, String valueToCheck) { this.fieldName = fieldName; this.valueToCheck = valueToCheck; } @Override public Object evaluate(Map fields, Map variables, Map parameters) { Object value = getCurrentValue(); if (value == null) return null; if (!fields.containsKey(fieldName)) { return Boolean.FALSE; } if (valueToCheck == null) { return Boolean.FALSE; } return Boolean.valueOf(valueToCheck.equals(fields.get(fieldName))); } @Override public String getClassName() { return Boolean.class.getName(); } } I've compared the field's value with string passed via the parameter. The code for building report: public class ConditionalStylesTest extends BaseDjReportTest { public static void main(String[] args) throws Exception { ConditionalStylesTest test = new ConditionalStylesTest(); test.testReport(); test.exportToJRXML(); JasperViewer.viewReport(test.jp); } @Override public DynamicReport buildReport() throws Exception { DynamicReportBuilder drb = new DynamicReportBuilder(); Integer margin = 20; drb.setTitle("NBA Players") .setTitleHeight(30) .setDetailHeight(15) .setLeftMargin(margin) .setRightMargin(margin) .setTopMargin(margin) .setBottomMargin(margin) .setPrintBackgroundOnOddRows(true) .setColumnsPerPage(1) .setColumnSpace(1); drb.addColumn(ColumnBuilder.getNew().setColumnProperty("age", Integer.class.getName()) .setTitle("Age").setWidth(30).setFixedWidth(true).build()); drb.addColumn(ColumnBuilder.getNew().setColumnProperty("name", String.class.getName()) .setTitle("Name").setWidth(100).setFixedWidth(true).build()); drb.addColumn(ColumnBuild…
upvote count: 2

http://stackoverflow.com/a/23123306
type: AcceptedAnswer
downvote count: 0
score: 1
has body: The problem caused by this line: ArrayAdapter adapter = new ArrayAdapter(this,R.layout.activity_main,titles); The second parameter of ArrayAdapter's constructor is a view (TextView by default) which you populate with your data. When you're trying to populate R.layout.activity_main that is a RelativeLayout per se, you get ClassCastException. If you're not going to use more complex layout than TextView, use a preserved Android layout. Change the mentioned line to this one: ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.select_dialog_item,titles);
type: Answer
accepted answer of: http://stackoverflow.com/q/23118450
upvote count: 1
answers question: http://stackoverflow.com/q/23118450

http://stackoverflow.com/q/23001910
has title: How to make a html paragraph indent in java?
has comment: http://stackoverflow.com/comment/35131818
tagged with: java
has comment: http://stackoverflow.com/comment/35131953
tagged with: eclipse
type: Question
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/23001919
tagged with: http://stackoverflow.com/tag/html
type: UnansweredQuestion
has body: I tried this to get a indent on a html page in eclipse but does not seem to work. How can I get the indent? out.println("&lt;p class=\"indent\"&gt;" + meaning + "&lt;/p&gt;");

http://stackoverflow.com/a/33630549
has body: I had this problem when the target directory was open in Windows Explorer. Closing Windows Explorer made it work.
type: Answer
has comment: http://stackoverflow.com/comment/117728953
has comment: http://stackoverflow.com/comment/85206009
score: 10
upvote count: 10
downvote count: 0
answers question: http://stackoverflow.com/q/22988210

http://stackoverflow.com/comment/35288877
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23088612
has text: `Any solutions?` - As you have already stated, "I can simply make many buttons". There is no reason you can't do this as you can always share an ActionListener between all buttons so you don't have to create multiple listeners.
type: Comment

http://stackoverflow.com/comment/119052189
comment on: http://stackoverflow.com/a/67344845
has text: Whoever upvoted my comment, thanks, it’s better to upvote the answer to help other readers find it.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/76595078
answers question: http://stackoverflow.com/q/23069370
score: 0
type: Answer
has body: This exception also happens when the using pattern for a LocalDate object is not correct. For example the pattern yyyy-mm-dd which has to be yyyy-MM-dd would result in Unsupported field: HourOfDay exception.

http://stackoverflow.com/comment/35328209
score: 0
type: Comment
type: QuestionComment
has text: you can have global String variables in your class and set them in your constructor
comment on: http://stackoverflow.com/q/23111132

http://stackoverflow.com/a/23120671
has body: Have you tried thread.join()? http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.html#join%28%29 Basically you can start as many threads as you want, and the "parent" waits for the "child" thread to die by calling thread join() on it before continuing. Java: How to use Thread.join
score: 0
answers question: http://stackoverflow.com/q/23120587
type: Answer

http://stackoverflow.com/q/22997145
type: Question
has comment: http://stackoverflow.com/comment/35123871
accepted answer: http://stackoverflow.com/a/23010904
possible better answer: http://stackoverflow.com/a/22997429
tagged with: jcombobox
has comment: http://stackoverflow.com/comment/35124049
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/7387299
has comment: http://stackoverflow.com/comment/35125089
has title: JComboBox changinging other JComboBoxes (multiple times) error
tagged with: java
has answer: http://stackoverflow.com/a/23010904
has body: need some help with ComboBoxes in Java. Looked through similar questions, found one slightly related, but not what im dealing with. I need to load certain arrays into combo boxes depending on the items selected in the precious combo box: think getting some procedure done at a medical center: Choose a procedure->get a list of doctors who do it, choose a doctor->get a list of available hours etc. A single choice is working fine(whether it's "procedure->list of doctors", or "list of doctors->their working hours"), but doing more than a single one of those changes doesn't work. import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.Arrays; public class GUIbandymas extends JFrame { String[] start={"Choose","Choice1", "Choice2"}; String[] Option1={"Choose","A1"}; String[] Option2={"Choose","A2","A3"}; String[] Option3={"Choose","a","b","c","d"}; String[] Option4={"Choose","1","2","3","4"}; String[] Option5={"Choose","I","II","III","IV"}; String[] pradinis={"Pasirinkite Laika"}; String[] p1={"Pasirinkite Gydytoja"}; static double kainaR; static double kainaK; JComboBox&lt;String&gt; G=new JComboBox&lt;String&gt;(p1); JComboBox&lt;String&gt; proc; JComboBox&lt;String&gt; laikas=new JComboBox&lt;String&gt;(pradinis); JComboBox&lt;String&gt; minutes; JButton button = new JButton ("Registuotis"); JLabel label = new JLabel("Moketi uz vizita"); JLabel suma = new JLabel(); public GUIbandymas() throws Exception { setValueProc(start); frame(); } public void frame() { JFrame frame = new JFrame(); frame.setVisible(true); frame.setSize(500,300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); panel.add(proc); panel.add(G); panel.add(laikas); panel.add(button); button.setEnabled(false); //panel.add(minutes); frame.add(panel); panel.add(label); panel.add(suma); proc.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(proc.getSelectedItem().toString().equals("Choice1")) { setGyd(Option1); …
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22997429

http://stackoverflow.com/comment/35310781
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23100990
has text: i have created tabHost using fragments..In one of the tab i have created buttons so that onClick of that button it should call another view or replace current view
score: 0

http://stackoverflow.com/q/23045565
has title: ignoring white space and tabs in java
tagged with: java
answer count: 1
score: 0
type: UnansweredQuestion
tagged with: filereader
has body: Im getting an error message when trying to ignore a tab between 2 numbers the error appears as follows: In the text file im reading from there are some single digit number and some double digits which is why i am using .substring(42,44); Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "5 " at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at readTheFile.setSenID(readTheFile.java:230) at Sensor.setSensorID(Sensor.java:69) at getDrink.&lt;init&gt;(getDrink.java:22) at controlPanel$1.actionPerformed(controlPanel.java:54) I have tried several replace white space and tab options such as temp.replaceAll("//t","") or ("\s+",""). I cant seem to find a way to get just the int to read. Any ideas? heres the piece of code i think is causing the problem BufferedReader bufferedReader = new BufferedReader(fileReader); int lineNumber = 0; ArrayList&lt;Integer&gt; SenID = new ArrayList&lt;Integer&gt;(); while((line=bufferedReader.readLine())!=null){ lineNumber++; if (lineNumber &gt;= 24) { String temp = line.substring(42, 44); temp.replaceAll("//s+", ""); //think error is here int x = Integer.parseInt(temp); SenID.add(x); } } here is the file im reading from 25-Feb-2008 00:20:14 25-Feb-2008 00:22:57 24 1 25-Feb-2008 09:33:41 25-Feb-2008 09:33:42 24 1 25-Feb-2008 09:33:47 25-Feb-2008 17:21:12 24 1 25-Feb-2008 09:36:43 25-Feb-2008 09:37:04 5 1 25-Feb-2008 09:37:20 25-Feb-2008 09:37:23 6 1 25-Feb-2008 09:37:51 25-Feb-2008 09:37:52 14 1 25-Feb-2008 09:37:55 25-Feb-2008 09:37:56 14 1 25-Feb-2008 09:37:58 25-Feb-2008 09:38:01 6 1
type: Question
has answer: http://stackoverflow.com/a/23045590

http://stackoverflow.com/q/23107029
tagged with: c#
answer count: 1
tagged with: string
score: 4
tagged with: unicode
favorite count: 0
has comment: http://stackoverflow.com/comment/35320757
upvote count: 4
has comment: http://stackoverflow.com/comment/35321471
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23107283
accepted answer: http://stackoverflow.com/a/23107283
downvote count: 0
has title: C# .ToString("X4") equivalent in Java
tagged with: java
has comment: http://stackoverflow.com/comment/35320815
has comment: http://stackoverflow.com/comment/35320979
type: Question
has body: While converting String to Unicode, I am looking for a true equivalent of C# .ToString("X4") in Java. C# Code: char[] stringChars = "Notices".ToCharArray(); List&lt;string&gt; ucs2code = new List&lt;string&gt;(); foreach (char chr in stringChars) { string chrCode = ((int)chr).ToString("X4"); ucs2code.Add(chrCode); } string charCode = string.Join("", ucs2code); It gives me 004E006F00740069006300650073 as a result which is exactly what I need. Java code that I tried char[] stringChars = "Notices".toCharArray(); String charCode = ""; for (char chr : stringChars) { String chrCode = Integer.toHexString((int)chr); charCode += chrCode; } This gives me 4e6f7469636573 It looks correct but not quite what I need. Is there anything I missed? some suggestions would help a lot.

http://stackoverflow.com/comment/35077260
type: QuestionComment
has text: Do I get to know what line 51 is?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22971712

http://stackoverflow.com/a/22983907
has body: add one item in the list at a time when you click the button and call carAdapter.notifyDataSetChanged() .
has comment: http://stackoverflow.com/comment/35099485
score: 0
answers question: http://stackoverflow.com/q/22983737
type: Answer

http://stackoverflow.com/a/23081637
score: 0
answers question: http://stackoverflow.com/q/22979534
type: Answer
has body: Use The Joda Time library it can be helpful to calculate differences between Date and Time

http://stackoverflow.com/q/22989994
tagged with: ehcache
upvote count: 2
type: UnansweredQuestion
has body: I have a simple one class test to load ehache 2.8.1 Everything is fine however if setting either diskPersistent="true" or overflowToDisk="true" then the VM never terminates. I have tried setting the shutdown hook but this isn't fired as the thread used by Ehcache isn't a daemon so the vm never gets that far. &lt;ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"&gt; &lt;diskStore path="/temp"/&gt; &lt;defaultCache maxElementsInMemory="100" eternal="false" overflowToDisk="false" /&gt; &lt;cache name="resolveIpAddresses" maxElementsInMemory="100000" diskPersistent="true" overflowToDisk="true" eternal="false" timeToLiveSeconds="3600" /&gt; &lt;/ehcache&gt; The ehcache is being managed by a spring 3.1.8 container with the beans &lt;cache:annotation-driven /&gt; &lt;bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" p:cacheManager-ref="ehcache"/&gt; &lt;bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:config-location="/ehcache.xml" p:shared="true"/&gt; Changing the disk settings to false works fine but obviously not great. How do I tell ehcache that the disk threads are daemon?
has title: Ehcache - not terminating VM
score: 2
has comment: http://stackoverflow.com/comment/47998785
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/2373431
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23071750

http://stackoverflow.com/comment/35339019
type: Comment
comment on: http://stackoverflow.com/q/23115132
type: QuestionComment
score: 0
has text: @M42: That's a pure non-sense. The OP wasn't seeking a code-review, they were obviously asking a performance question. The fact that they presented some code doesn't qualify it for code review. Moreover, it was an example code, not a real one!

http://stackoverflow.com/comment/35097874
type: Comment
comment on: http://stackoverflow.com/a/22983470
has text: there is no JSON its just string in java
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35225105
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23053083
type: AnswerComment
has text: @casey what error do you get.? can you put up the log entries..?

http://stackoverflow.com/comment/35233322
comment on: http://stackoverflow.com/a/23026348
score: 0
type: AnswerComment
has text: May be the commons-digester jars is corrupted? Try to re download it
type: Comment

http://stackoverflow.com/comment/35263164
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23073951
type: Comment
has text: TreeMap sorts based on index. Gimme a minute to update my answer :)

http://stackoverflow.com/comment/35215429
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23043631
has text: The numbers in that JSON will be converted (by default) into `double` by most JSON kits. `double` can handle just shy of 16 digits, and your JSON contains at most 9, so the numbers will be represented to their full precision. But note that the numbers may *appear* different when logged, since, depending on the logging tool, different precisions may be used.
score: 0

http://stackoverflow.com/comment/35227215
comment on: http://stackoverflow.com/q/23054587
score: 0
type: Comment
type: QuestionComment
has text: `Class.cast(Object)` does *not* do conversions. The simplest solution is to use reflection to handle as many cases as possible but prepend a switch-based non-reflective conversion to accelerate *common* cases.

http://stackoverflow.com/comment/35132921
has text: Use a `DocumentFilter`, that what it's for
comment on: http://stackoverflow.com/q/23002522
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/23113261
has comment: http://stackoverflow.com/comment/35333138
score: 0
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/35333267
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/14706751
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23126622
accepted answer: http://stackoverflow.com/a/23126622
tagged with: nodelist
has title: Parsing XML(Nodes)
has body: I have a small problem that in this XML I want to get the title and description from Rss I found this solution and use this function RssObject Value = new RssObject(); public void getTagRss(String URL) { XMLParser parser = new XMLParser(); String xml = getXml(URL); Document doc = parser.getDomElement(xml); NodeList nl = doc.getElementsByTagName(Rss_key); // Site tag Name for (int i = 0; i &lt; nl.getLength(); i++) { Element e = (Element) nl.item(i); NodeList children = e.getChildNodes(); Log.i(TAG, "Children length: " + children.getLength()); for (int j = 0; j &lt; children.getLength(); j++) { Node child = children.item(j); // name child value if (child.getNodeName().equalsIgnoreCase(Item_key)) { // name child value Value.Title = parser.getValue(e, Title_key); Value.Desc = parser.getValue(e, Desc_key); Gen_Obj.Rsslist2.add(Value); } } } } and the output is this that repeat first item twice where give me the length of children is 5 what is the wrong in my function thanks

http://stackoverflow.com/q/22973051
has comment: http://stackoverflow.com/comment/35080314
upvote count: 3
tagged with: sjcl
type: Question
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35080755
has body: I want to use the SJCL library in an Android app that I'm building. The thing is SJCL is a javascript crypto library. I'm new to Android development and I was wondering how I could go about using the library in my project. What I'm looking to do is hash a person's username and password and decrypt whatever response I get from the server which is why I want to use SJCL. If anyone has any insight into how to do this, that'd be great!
answer count: 2
has comment: http://stackoverflow.com/comment/35080421
downvote count: 0
tagged with: javascript
favorite count: 0
has answer: http://stackoverflow.com/a/49778322
type: UnansweredQuestion
tagged with: android
tagged with: cryptography
has answer: http://stackoverflow.com/a/22973260
linked to: http://stackoverflow.com/q/9414312
has title: Use JavaScript Library in Android Application

http://stackoverflow.com/comment/82928855
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22989501
has text: So much discussion just confuses the end reader if at all the marked answer is correct or not :( I plan to call same restTemplate object from multiple threads. Can I consider it safe?
score: 0

http://stackoverflow.com/q/22988420
type: Question
tagged with: mockito
has comment: http://stackoverflow.com/comment/35109903
score: 0
has title: How do I set struts 1.0 Form class members using Mockito
has comment: http://stackoverflow.com/comment/35108952
has comment: http://stackoverflow.com/comment/35106997
answer count: 0
type: UnansweredQuestion
tagged with: struts-1
has comment: http://stackoverflow.com/comment/35108434
has body: I have a struts 1.0 form bean, and I'm trying to test custom validation. The form bean makes explicit reference to its class members, i.e., when validating an email address, the call looks like this: @Override public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); Validator validator = ESAPI.validator(); try { email = validator.getValidInput("AuthorizedPayerEmailAddr", email, "Email", Email.MAX_ADDRESS_SIZE, true); }catch(Exception e){ doStuff() } In my test class, I have attempted to tell Mockito to call real methods for setters and getters: AddAuthorizedPayerForm form = Mockito.mock(AddAuthorizedPayerForm.class); Mockito.doAnswer(Answers.CALLS_REAL_METHODS.get()).when(form).getEmail(); Mockito.doAnswer(new CallsRealMethods()).when(form).setEmail(Mockito.anyString()); This technique has resulted in my form class members not being set. The only way I've gotten this to work is by mocking the getter when(form.getEmail()).thenReturn(emailString); and then changing the form class to access its fields through the method like this: email = validator.getValidInput("AuthorizedPayerEmailAddr", getEmail(), "Email", Email.MAX_ADDRESS_SIZE, true); Which is exactly what I don't want to do! I don't want to alter my form logic just to make it testable. Additional Context: There are some abstract methods that set form state at runtime in the context of a user session. I know this is bad design (form bean should JUST be a form bean) but I can't fix that. This application does not use any dep injection so I need this form to be mocked for everything BUT the validate() method and the form fields its validating.
tagged with: java

http://stackoverflow.com/a/23095715
has comment: http://stackoverflow.com/comment/35302868
has body: Below line has a problem : if (list.get(i).password.equals(passwordField.getPassword())){ JPasswordField#getPassword() return char[] where as you are comparing a String password with char[] that is wrong. Try Arrays.equals() to compare arrays as follow: Arrays.equals(list.get(i).password.toCharArray(), passwordField.getPassword()); I suggest you to use Map in place of ArrayList. Make username as key of Map. Use Map&lt;String,Login&gt; map = new HashMap&lt;String,Login&gt;(); instead of ArrayList&lt;Login&gt; list= new ArrayList&lt;Login&gt;(); Map is more faster in search than ArrayList.
type: Answer
has comment: http://stackoverflow.com/comment/35302946
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35302805
has comment: http://stackoverflow.com/comment/35302534
has comment: http://stackoverflow.com/comment/35302296
has comment: http://stackoverflow.com/comment/35302742
answers question: http://stackoverflow.com/q/23095579
upvote count: 2
has comment: http://stackoverflow.com/comment/35302482
has comment: http://stackoverflow.com/comment/35302978

http://stackoverflow.com/comment/35275996
type: Comment
comment on: http://stackoverflow.com/q/23078603
type: QuestionComment
has text: You can create custom double converter.
score: 0

http://stackoverflow.com/a/22976639
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22976572
type: Answer
score: 2
has body: You set no views for your scroll panes, therefore they have no means by which to determine their preferred size. You set no text on your buttons, so it only calculates the size of the button on the requirements of the borders Don't mess with setXxxSize, your ChatGUI should have no concept of the viewable size it might need to occupy.
upvote count: 2
answers question: http://stackoverflow.com/q/22976572
has comment: http://stackoverflow.com/comment/35086906
type: AcceptedAnswer

http://stackoverflow.com/comment/35217609
comment on: http://stackoverflow.com/q/23049016
has text: You should not be working on your homework in the small hours of the morning. No wonder you are making silly mistakes.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/22994154
type: Answer
answers question: http://stackoverflow.com/q/22982570
has body: You need to use a custom editor. The following example should get you started: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.table.*; /* * The editor button that brings up the dialog. */ //public class TablePopupEditor extends AbstractCellEditor public class TablePopupEditor extends DefaultCellEditor implements TableCellEditor { private PopupDialog popup; private String currentText = ""; private JButton editorComponent; public TablePopupEditor() { super(new JTextField()); setClickCountToStart(1); // Use a JButton as the editor component editorComponent = new JButton(); editorComponent.setBackground(Color.white); editorComponent.setBorderPainted(false); editorComponent.setContentAreaFilled( false ); // Make sure focus goes back to the table when the dialog is closed editorComponent.setFocusable( false ); // Set up the dialog where we do the actual editing popup = new PopupDialog(); } public Object getCellEditorValue() { return currentText; } public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { SwingUtilities.invokeLater(new Runnable() { public void run() { popup.setText( currentText ); // popup.setLocationRelativeTo( editorComponent ); Point p = editorComponent.getLocationOnScreen(); popup.setLocation(p.x, p.y + editorComponent.getSize().height); popup.show(); fireEditingStopped(); } }); currentText = value.toString(); editorComponent.setText( currentText ); return editorComponent; } /* * Simple dialog containing the actual editing component */ class PopupDialog extends JDialog implements ActionListener { private JTextArea textArea; public PopupDialog() { super((Frame)null, "Change Description", true); textArea = new JTextArea(5, 20); textArea.setLineWrap( true ); textArea.setWrapStyleWord( true ); KeyStroke keyStroke = KeyStroke.getKeyStroke("ENTER"); textArea.getInputMap().put(keyStroke, "none"); JScrollPane scrollPane = new JScrollPane( textArea ); getContentPane…
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22982570

http://stackoverflow.com/comment/35218411
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23049464
has text: This worked: `String st = "";` `for (int i = 0; i < 15; i++)` `st += name[i][0] + " " + name[i][1] + "\n";` `outPut.setText(value);` @taylorcressy
type: AnswerComment

http://stackoverflow.com/a/23039981
answers question: http://stackoverflow.com/q/23034315
accepted answer of: http://stackoverflow.com/q/23034315
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: Have you set your main-class in the jar's manifest file ? It's not about the main method, it's about the main-class. Check the link I gave you. If you want to run a jar file from the command line you need to have it's main-class set in it's manifest file, else, specify the class you'd like to execute it's main function. java -jar jar-file-name.jar com.yourcompany.yourclass main-method-arguments-spearated-with-spaces
downvote count: 0
score: 1

http://stackoverflow.com/comment/35160039
type: QuestionComment
has text: Then, `List<WeakReference<Future<?>>>` will work. It will allow the `Future`s to get gc’ed but you have to remove the `WeakReference` instance manually (though a `WeakReference` itself does not take much space). An alternative would be `Collections.newSetFromMap(new WeakHashMap<Future<?>,Boolean>())` to create a `Set<Future<?>>` which allows its elements to get gc’ed. Can’t be easier…
comment on: http://stackoverflow.com/q/23014606
score: 0
type: Comment

http://stackoverflow.com/comment/35119539
type: Comment
comment on: http://stackoverflow.com/a/22993876
type: AnswerComment
has text: Unless the ide has some built in functionality, that's the only way you are going to solve it (i.e. writing some code). What kind of solution were you expecting? You can just step thru the debugger and see what's going on, or you can temporarily edit the code. Adding such a parameter is not going to hurt anything, and it makes the function easier to debug.
score: 0

http://stackoverflow.com/q/23087537
downvote count: 0
tagged with: ssl
has answer: http://stackoverflow.com/a/55939038
tagged with: tomcat
answer count: 3
has answer: http://stackoverflow.com/a/23087752
has title: How to export .key and .crt from keystore
favorite count: 0
tagged with: android
upvote count: 23
type: AnsweredQuestion
has body: When I was building android app on development machine, I was required to have SSL certificate for app so I generated a keystore with keytool for Tomcat. I extracted the cert from keystore and put it into .bks for using android, and all went well. Now we have to shift all server-side code to server which required Apache HTTP and Tomcat. Apache HTTP SSL requires .key and .crt files and I cannot find a way to export .key and .crt file from the keystore Can anyone help with this? I found that you can generate .crt from .pem openssl x509 -outform der -in your-cert.pem -out your-cert.crt But how can i get .key file?
tagged with: java
accepted answer: http://stackoverflow.com/a/23087752
score: 23
has answer: http://stackoverflow.com/a/77364861
type: Question
possible better answer: http://stackoverflow.com/a/77364861

http://stackoverflow.com/comment/35104023
score: 0
type: Comment
type: QuestionComment
has text: Your code has numerous errors. It does not compile. Post valid code.
comment on: http://stackoverflow.com/q/22986918

http://stackoverflow.com/q/23003617
tagged with: tomcat
has answer: http://stackoverflow.com/a/35514997
has title: Trouble starting tomcatv7 via Eclipse Kepler
has answer: http://stackoverflow.com/a/27607441
has answer: http://stackoverflow.com/a/28414569
has answer: http://stackoverflow.com/a/35720882
answer count: 10
possible better answer: http://stackoverflow.com/a/27607441
favorite count: 0
linked to: http://stackoverflow.com/q/30962732
has answer: http://stackoverflow.com/a/32629014
has body: I see that problems like mine have been posted before, some of which posts were answered. I've attempted the fixes, which indeed seem like they should have worked, but I'm still running into the same problem: I'm trying to run a dynamic web project in Eclipse Kepler (Java EE) via apache tomcat 7.0.53 on my localhost. I've created tomcat as a server in Eclipse, and copied the config files from /tomcat/7.0.53/libexec/conf into /workspace/Servers/Tomcat v7.0 Server at localhost-config, and changed the permissions on the files so that they are all readable and writeable. However, when I try to start the tomcat server in eclipse, I get this error: Could not load the Tomcat server configuration at /Servers/Tomcat v7.0 Server at localhost-config. The configuration may be corrupt or incomplete. In case it's helpful, it's all being run in mac osx 10.6.8, on a 64-bit machine. Thanks in advance for your help.
score: 11
has answer: http://stackoverflow.com/a/24151568
has answer: http://stackoverflow.com/a/23003704
upvote count: 11
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/30281243
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/27540542
has answer: http://stackoverflow.com/a/31413577
accepted answer: http://stackoverflow.com/a/24151568
tagged with: apache
downvote count: 0

servlets
tags question: http://stackoverflow.com/q/23053426
tags question: http://stackoverflow.com/q/23072420
tags question: http://stackoverflow.com/q/22990167
tags question: http://stackoverflow.com/q/23007222
tags question: http://stackoverflow.com/q/22972753
tags question: http://stackoverflow.com/q/23118114
tags question: http://stackoverflow.com/q/23036284
tags question: http://stackoverflow.com/q/23066812
tags question: http://stackoverflow.com/q/22989154
tags question: http://stackoverflow.com/q/23077812
tags question: http://stackoverflow.com/q/23005986
tags question: http://stackoverflow.com/q/22989278
tags question: http://stackoverflow.com/q/23003660
tags question: http://stackoverflow.com/q/23042431
tags question: http://stackoverflow.com/q/23062649
tags question: http://stackoverflow.com/q/23005149
tags question: http://stackoverflow.com/q/23074240
tags question: http://stackoverflow.com/q/23030622
tags question: http://stackoverflow.com/q/22999666
tags question: http://stackoverflow.com/q/22987560
tags question: http://stackoverflow.com/q/23009367
tags question: http://stackoverflow.com/q/23050995
tags question: http://stackoverflow.com/q/22968504
tags question: http://stackoverflow.com/q/23122608
tags question: http://stackoverflow.com/q/23032391
tags question: http://stackoverflow.com/q/23076779
tags question: http://stackoverflow.com/q/23001948
tags question: http://stackoverflow.com/q/23068553
tags question: http://stackoverflow.com/q/22989607
tags question: http://stackoverflow.com/q/22969795
tags question: http://stackoverflow.com/q/23052019
tags question: http://stackoverflow.com/q/23054452
tags question: http://stackoverflow.com/q/23066144
tags question: http://stackoverflow.com/q/23007364
tags question: http://stackoverflow.com/q/23110032
tags question: http://stackoverflow.com/q/23123345
tags question: http://stackoverflow.com/q/23055076
tags question: http://stackoverflow.com/q/23073555
tags question: http://stackoverflow.com/q/23054631
tags question: http://stackoverflow.com/q/23026452
tags question: http://stackoverflow.com/q/23036384
tags question: http://stackoverflow.com/q/23104740
tags question: http://stackoverflow.com/q/22981424
tags question: http://stackoverflow.com/q/23031379
tags question: http://stackoverflow.com/q/23103088
tags question: http://stackoverflow.com/q/23018894
tags question: http://stackoverflow.com/q/23110475
tags question: http://stackoverflow.com/q/23054912
tags question: http://stackoverflow.com/q/23011247
tags question: http://stackoverflow.com/q/22983183
tags question: http://stackoverflow.com/q/23111020
tags question: http://stackoverflow.com/q/23055094
tags question: http://stackoverflow.com/q/23005825
tags question: http://stackoverflow.com/q/23024629
tags question: http://stackoverflow.com/q/23119018
tags question: http://stackoverflow.com/q/23060307
tags question: http://stackoverflow.com/q/23062499
tags question: http://stackoverflow.com/q/23045690
tags question: http://stackoverflow.com/q/23096394
tags question: http://stackoverflow.com/q/23081392
tags question: http://stackoverflow.com/q/23102945
tags question: http://stackoverflow.com/q/23086119
tags question: http://stackoverflow.com/q/23101319
tags question: http://stackoverflow.com/q/23075933
tags question: http://stackoverflow.com/q/22980924
tags question: http://stackoverflow.com/q/22972565
tags question: http://stackoverflow.com/q/23116770
tags question: http://stackoverflow.com/q/22992039
tags question: http://stackoverflow.com/q/23020975
tags question: http://stackoverflow.com/q/23013316
tags question: http://stackoverflow.com/q/23089283
tags question: http://stackoverflow.com/q/23055284
tags question: http://stackoverflow.com/q/23107241
tags question: http://stackoverflow.com/q/23057898
tags question: http://stackoverflow.com/q/23003251
tag name: servlets
tags question: http://stackoverflow.com/q/22977358
tags question: http://stackoverflow.com/q/23027739
tags question: http://stackoverflow.com/q/23062536
tags question: http://stackoverflow.com/q/22994142

http://stackoverflow.com/a/23112771
type: Answer
answers question: http://stackoverflow.com/q/23111808
score: 0
has body: Don't use regex if you are not familiar with its concepts! There is a simple plain java solution for your problem: String begin = "<table"; String end = " "; String s = "0000000001 blaalb gfdg kgdfkg fkkkkk 4555"; int tableIndex = s.indexOf(begin); int tableEndIndex = s.indexOf(end, tableIndex); while (tableIndex > -1) { s = s.substring(0, tableIndex) + s.substring(tableEndIndex + end.length()); tableIndex = s.indexOf("<table"); tableEndIndex = s.indexOf(" ", tableIndex); }

http://stackoverflow.com/comment/35242807
has text: How unique do you want it to be?
comment on: http://stackoverflow.com/q/23062918
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35121994
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22972596
type: Comment
has text: my2cents for you: let Maven handle the dependencies mess for you rather than doing it manually with Ant.

http://stackoverflow.com/comment/35359031
has text: when I started it in standalone mode it gives me no error. but you got these errors in tomcat server.isn't it?
score: 0
comment on: http://stackoverflow.com/a/23125960
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35204526
score: 0
type: QuestionComment
type: Comment
has text: I gave you a link. Read it. If it doesn't work, ask a GOOD question, showing your code, telling us which class contains the code, and where the sound file is.
comment on: http://stackoverflow.com/q/23041673

http://stackoverflow.com/q/22995419
upvote count: 4
tagged with: css
type: AnsweredQuestion
tagged with: java
type: Question
score: 4
tagged with: struts2
has title: How can I determine which Struts action I'm rendering in my JSP?
tagged with: jstl
has answer: http://stackoverflow.com/a/22995955
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22995955
tagged with: jsp
favorite count: 0
has body: I have a menu that's common to most of my site. If I'm on Page 1, for example, I want the "Page 1" link in the menu to be highlighted so I can compare the current action to "page1.action" and dynamically add the appropriate CSS class based on the comparison. I've tried the following from various other Stack Overflow answers but none of them are giving me what I want: req.contextPath: ${req.contextPath }&lt;br/&gt; req.requestURL: ${req.requestURL }&lt;br/&gt; pageContext.request.requestURL: ${pageContext.request.requestURL }&lt;br/&gt; pageContext.request.requestURI: ${pageContext.request.requestURI }&lt;br/&gt; pageContext.request.servletPath: ${pageContext.request.servletPath }&lt;br/&gt; action name: ${com.opensymphony.xwork2.ActionContext.name }&lt;br/&gt; action name 2: ${#context['struts.actionMapping'].name}&lt;br/&gt; Here's the output: req.contextPath: /myContextRoot req.requestURL: http://localhost:9080/myContextRoot/WEB-INF/app/layout/simpleLayout.jsp pageContext.request.requestURL: http://localhost:9080/myContextRoot/WEB-INF/app/layout/simpleLayout.jsp pageContext.request.requestURI: /myContextRoot/WEB-INF/app/layout/simpleLayout.jsp pageContext.request.servletPath: /WEB-INF/app/layout/simpleLayout.jsp action name: action name 2: I basically want something where I can do this: &lt;c:choose&gt; &lt;c:when test="${pageContext.request.requestURI == 'page1.action')}"&gt; &lt;c:set var="page1ButtonClass" value="class=\"active\""/&gt; &lt;/c:when&gt; &lt;/c:choose&gt; For what it's worth, we're using Struts 2.3.8.

http://stackoverflow.com/q/23096346
tagged with: java
has title: filling combo box on radio button select
has comment: http://stackoverflow.com/comment/35321496
has comment: http://stackoverflow.com/comment/35303422
type: Question
has body: 1.0 I'm filling combobox on checkbox checked depends on wihich genre you choose combobox should display options Worked for a while but than I did something and now it only displays one option a displays it only when unchecking the checkbox Is there better way to do this ? UPDATE 1.1: Okay I updated the code. Deleted all unnecessary I hope. I tryied with ItemListener and ActionListener. But I think that's not problem, I think that I'm filling the JCOmboBox somehow wrong. It's somewhere around jcboCountry.removeAllItems(); this makes mess I think. I even try to write method empty(); to delete one by one but it still fills my JCB only with one item. Also the radio buttons sometimes don't check when I click on them. And sometimes it files the JCB on second click on RadioButton. public class FinalPlayer extends JApplet implements ActionListener, ItemListener{ JPanel westP = new JPanel(); JPanel centerP = new JPanel(); JPanel bottomP = new JPanel(); JPanel genresP = new JPanel(); JPanel imagePanel = new JPanel(); JPanel countryPanel = new JPanel(); JComboBox jcboCountry = new JComboBox(); JTextField genreF = new JTextField(); String country; JRadioButton jazzCB = new JRadioButton("Pop",true); JRadioButton rockCB = new JRadioButton("Rock",false); JRadioButton allCB = new JRadioButton("All",false); ButtonGroup bG = new ButtonGroup(); /** Initialize the applet */ public void init() { Container contentPane = getContentPane(); mainPanel.setPreferredSize( new Dimension(701, 341)); topP.setPreferredSize( new Dimension(700, 30)); eastP.setPreferredSize( new Dimension(225,280)); centerP.setPreferredSize( new Dimension(250,280)); westP.setPreferredSize( new Dimension(225,280)); bottomP.setPreferredSize( new Dimension(700, 30)); // TOP //WEST genreF.setPreferredSize( new Dimension(124, 29)); genreF.setEditable(false); genreF.setText("Choose Genre"); genresP.setPreferredSize( new Dimension(124, 250)); jazzCB.setPreferredSize( new Dimension(123, 19)); rockCB.setPreferredSize( new Dime…
score: 0
tagged with: combobox
answer count: 0
type: UnansweredQuestion
tagged with: swing
tagged with: checkbox

http://stackoverflow.com/q/23101319
has comment: http://stackoverflow.com/comment/35311325
tagged with: servlets
type: Question
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/23101668
has answer: http://stackoverflow.com/a/23101668
has body: I was trying to upload an image in java using commonsIO and Jar for file upload.But the problem am facing is that i am having two checkboxes on my form as follow : &lt;div style="float:left"&gt; &lt;input name="Mcheckbox" type="checkbox" value="Mobile"/&gt; Mobile &lt;/div&gt; &lt;div style="float:right"&gt; &lt;input name="Echechkbox" type="checkbox" value="Email"/&gt; Email &lt;/div&gt; And then browse option : Upload Image : &lt;INPUT TYPE="file" NAME="file" value="file"&gt;&lt;/input&gt; And in my servlet am doing something like this : ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory()); List&lt;FileItem&gt; files = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request); Iterator it = files.iterator(); And then: while (it.hasNext()) { FileItem fi = (FileItem) it.next(); if (fi.isFormField()) { if (fieldname.compareTo("Mcheckbox") == 0) { System.out.println("checkbox value is " + fieldvalue); mymobilepass = fieldvalue; } else if (fieldname.compareTo("Echeckbox") == 0) { System.out.println("checkbox value is " + fieldvalue); myemailpass = fieldvalue; } } else { InputStream is = fi.getInputStream(); FileOutputStream fos = new FileOutputStream(path + "\\" + fi.getName()); int x = is.read(); while (x &gt;= 0) { fos.write((byte) x); x = is.read(); //System.out.println("reading"); } } } But am getting null as the value of myemailpass or mymobilepass everytime.What can be the reason ? The if statement is never executed .Why ? Please help
has comment: http://stackoverflow.com/comment/35311977
has comment: http://stackoverflow.com/comment/35311373
has comment: http://stackoverflow.com/comment/35312056
has comment: http://stackoverflow.com/comment/35311883
has comment: http://stackoverflow.com/comment/35312205
has title: Getting values of checkboxes along with uploading the file
tagged with: file-upload
favorite count: 0
has answer: http://stackoverflow.com/a/23102102
has comment: http://stackoverflow.com/comment/35313033
accepted answer: http://stackoverflow.com/a/23102102
has comment: http://stackoverflow.com/comment/35311274
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35311258
downvote count: 0
tagged with: java

http://stackoverflow.com/a/23075755
answers question: http://stackoverflow.com/q/23073650
accepted answer of: http://stackoverflow.com/q/23073650
has body: You can stop Actions by: removing them with actor.removeAction(Action) or actor.clearActions() you can override the actor.act(delta) method, and if gameOver is set don't update the Actor (don't call super.act()) In the render don't call act for the stage, if gameOver is set So basicly the Actions get updated in the act method of Actor. If your gameOver is set to true you can simply stop the Stage from updating: In Render: if (!gameOver) { stage.act(); } stage.draw();
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 11
upvote count: 11

http://stackoverflow.com/comment/95243399
type: Comment
comment on: http://stackoverflow.com/a/23229927
has text: Make sure that the chrome driver version is compatible with the Chrome browser version. Otherwise it may not work.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35198925
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23038499
has text: The problem is much more complicated than this. Objenesis appears to be doing dynamic code generation. This is not simply a matter of missing JARs.
type: Comment

http://stackoverflow.com/q/23006063
type: Question
accepted answer: http://stackoverflow.com/a/23006722
tagged with: netbeans
has comment: http://stackoverflow.com/comment/35139003
upvote count: 2
tagged with: java
tagged with: javafx
answer count: 3
has comment: http://stackoverflow.com/comment/35139582
has answer: http://stackoverflow.com/a/58654422
has answer: http://stackoverflow.com/a/73066548
has comment: http://stackoverflow.com/comment/35138928
has body: I've set this OnClick method in JavaFX SceneBuilder on a text field that will pop up the Windows 8 touch keyboard if the user select the textfield. However it seems to be nothing happen when I click on the textfield but when I try to check Tabtip.exe in the task manager, it did shown up there. The codes are: try { Runtime rt = Runtime.getRtuntime(); rt.exec( "cmd /c C:\\Programs Files\\Common Files\\Microsoft Shared\\ink\\TabTip.exe"); } catch { ex.printStackTrace(); } There is not errors triggered or whatsoever, and TabTip.exe is running in task manager, but the pop up keyboard does not show up, anyone has any solution to this? Thanks!
possible better answer: http://stackoverflow.com/a/58654422
has title: Runtime.getRuntime().exec could not execute/show Tabtip.exe
has answer: http://stackoverflow.com/a/23006722
type: AnsweredQuestion
score: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/35224234
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23052597
type: Comment
has text: Also, this doesn't account for the corners, right? If row - 1 or col - 1 is not greater than 0 what would happen..?

http://stackoverflow.com/a/23095032
accepted answer of: http://stackoverflow.com/q/23095004
type: AcceptedAnswer
score: 66
has body: == has higher precedence than &amp;. You might want to wrap your operations in () to specify how you want your operands to bind to the operators. ((a[0] &amp; 1) == 0) Similarly for all parts of the if condition.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23095004
upvote count: 66

http://stackoverflow.com/comment/35282495
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23082104
has text: I googled for classifiers and I found references only below plugin element of maven-jar-plugin. So I blindly edited my POM with: /project/profiles/profile[1]/build/plugins/plugin/configuration/classifier and rebuild the project. Is it correct? I do not see any change in the war (under META-INF).

http://stackoverflow.com/comment/35358447
comment on: http://stackoverflow.com/q/23126801
score: 0
type: Comment
type: QuestionComment
has text: That's how topics work. You are using the wrong kind of JMS destination for your purpose. Use a JMS Queue destination instead.

swing
tags question: http://stackoverflow.com/q/22995314
tags question: http://stackoverflow.com/q/23019703
tags question: http://stackoverflow.com/q/23022532
tags question: http://stackoverflow.com/q/23063324
tags question: http://stackoverflow.com/q/22982739
tags question: http://stackoverflow.com/q/23068508
tags question: http://stackoverflow.com/q/23101811
tags question: http://stackoverflow.com/q/23110270
tags question: http://stackoverflow.com/q/22982570
tags question: http://stackoverflow.com/q/22971158
tags question: http://stackoverflow.com/q/23095068
tags question: http://stackoverflow.com/q/23101290
tags question: http://stackoverflow.com/q/22992217
tags question: http://stackoverflow.com/q/23052777
tags question: http://stackoverflow.com/q/23012328
tags question: http://stackoverflow.com/q/23118594
tags question: http://stackoverflow.com/q/23127807
tags question: http://stackoverflow.com/q/22984052
tags question: http://stackoverflow.com/q/23114782
tags question: http://stackoverflow.com/q/23034404
tags question: http://stackoverflow.com/q/23123161
tags question: http://stackoverflow.com/q/22991590
tags question: http://stackoverflow.com/q/23028273
tags question: http://stackoverflow.com/q/22970785
tags question: http://stackoverflow.com/q/23045956
tags question: http://stackoverflow.com/q/23007715
tags question: http://stackoverflow.com/q/23014455
tags question: http://stackoverflow.com/q/23052393
tags question: http://stackoverflow.com/q/23020009
tags question: http://stackoverflow.com/q/22999256
tags question: http://stackoverflow.com/q/22982734
tags question: http://stackoverflow.com/q/23040212
tags question: http://stackoverflow.com/q/23004079
tags question: http://stackoverflow.com/q/23051105
tags question: http://stackoverflow.com/q/22985634
tags question: http://stackoverflow.com/q/23025733
tags question: http://stackoverflow.com/q/23047252
tags question: http://stackoverflow.com/q/23095631
tags question: http://stackoverflow.com/q/23062341
tags question: http://stackoverflow.com/q/22974731
tags question: http://stackoverflow.com/q/23047023
tags question: http://stackoverflow.com/q/23097281
tags question: http://stackoverflow.com/q/23020722
tags question: http://stackoverflow.com/q/23011931
tags question: http://stackoverflow.com/q/23093870
tags question: http://stackoverflow.com/q/23014682
tags question: http://stackoverflow.com/q/23024988
tags question: http://stackoverflow.com/q/23030439
tags question: http://stackoverflow.com/q/22984760
tags question: http://stackoverflow.com/q/23045715
tags question: http://stackoverflow.com/q/23119569
tags question: http://stackoverflow.com/q/22992602
tags question: http://stackoverflow.com/q/23120971
tags question: http://stackoverflow.com/q/23118747
tags question: http://stackoverflow.com/q/23036646
tags question: http://stackoverflow.com/q/22975993
tags question: http://stackoverflow.com/q/23103665
tags question: http://stackoverflow.com/q/22970014
tags question: http://stackoverflow.com/q/23074580
tags question: http://stackoverflow.com/q/23038917
tags question: http://stackoverflow.com/q/23023730
tags question: http://stackoverflow.com/q/23047701
tags question: http://stackoverflow.com/q/23004882
tags question: http://stackoverflow.com/q/23068197
tags question: http://stackoverflow.com/q/23072353
tags question: http://stackoverflow.com/q/23060805
tags question: http://stackoverflow.com/q/23090470
tags question: http://stackoverflow.com/q/23096346
tags question: http://stackoverflow.com/q/23073818
tags question: http://stackoverflow.com/q/23077081
tags question: http://stackoverflow.com/q/22976397
tags question: http://stackoverflow.com/q/23060067
tags question: http://stackoverflow.com/q/23016525
tags question: http://stackoverflow.com/q/23122492
tags question: http://stackoverflow.com/q/23110444
tags question: http://stackoverflow.com/q/22976484
tags question: http://stackoverflow.com/q/23091864
tags question: http://stackoverflow.com/q/23061863
tags question: http://stackoverflow.com/q/23064450
tags question: http://stackoverflow.com/q/22977395

http://stackoverflow.com/comment/35142023
has text: 1) Always copy/paste error & exception output. 2) Then post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example) so we can match the line numbers to source code.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23007715

compiler-errors
tags question: http://stackoverflow.com/q/23091812
tag name: compiler-errors
tags question: http://stackoverflow.com/q/23101742
tags question: http://stackoverflow.com/q/23049832
tags question: http://stackoverflow.com/q/23050140
type: Tag
tags question: http://stackoverflow.com/q/22976335
tags question: http://stackoverflow.com/q/23064112
tags question: http://stackoverflow.com/q/23124721
tags question: http://stackoverflow.com/q/23100275
tags question: http://stackoverflow.com/q/23093686
tags question: http://stackoverflow.com/q/22970696
tags question: http://stackoverflow.com/q/23000908
tags question: http://stackoverflow.com/q/23084863
tags question: http://stackoverflow.com/q/23115878

timedelay
tags question: http://stackoverflow.com/q/23093902
type: Tag
tag name: timedelay

http://stackoverflow.com/comment/35293285
type: Comment
type: QuestionComment
has text: check your *.ear/lib or *.war/WEB-INF/lib if it includes the jar file corresponding to org.slf4j.impl
comment on: http://stackoverflow.com/q/23087782
score: 0

http://stackoverflow.com/a/23001275
answers question: http://stackoverflow.com/q/23000676
upvote count: 1
type: Answer
has body: You create your own Preference. CsvPreference excelPreference = new CsvPreference.Builder('\'', ',', "\n").build(); CsvListReader parser = new CsvListReader(Files.newBufferedReader(pathToFile , StandardCharsets.UTF_8), excelPreference); After that, it will output as expected. In this example, you will strip the single quote if you have that in your csv file and keep the double quote untouched.
downvote count: 0
score: 1

http://stackoverflow.com/comment/35311626
comment on: http://stackoverflow.com/q/23089703
type: Comment
type: QuestionComment
has text: @Tyler : This is in Java.
score: 0

http://stackoverflow.com/q/23083583
has body: I'm trying to implement file upload with Jersey so I followed this example : http://www.mkyong.com/webservices/jax-rs/file-upload-example-in-jersey/ which worked well with an HTML page. Now I adapted it to my application, here is code : public Response uploadFile( @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail) throws IOException { Response.Status respStatus = Response.Status.OK; if (fileDetail == null) { respStatus = Response.Status.INTERNAL_SERVER_ERROR; } else { try { initPath(); if (fileDetail.getSize() &gt; OntoWebStudioUtil .getUploadFileLimit()) { respStatus = Response.Status.NOT_ACCEPTABLE; return Response.status(respStatus).build(); } writeToFile(uploadedInputStream, tempDirectory); } catch (Exception e) { respStatus = Response.Status.INTERNAL_SERVER_ERROR; e.printStackTrace(); } } return Response.status(respStatus).build(); } But with debug view, once I uploaded my picture and pushed the button send and then get here, uploadedInputStream and fileDetail are null. So I can do nothing... I am a beginner with Servlet and then REST, so please be indulgent. Thank you.
tagged with: jersey
has comment: http://stackoverflow.com/comment/35314606
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23109881
score: 6
favorite count: 0
tagged with: rest
accepted answer: http://stackoverflow.com/a/23109881
upvote count: 6
has comment: http://stackoverflow.com/comment/35318195
has comment: http://stackoverflow.com/comment/35293011
type: AnsweredQuestion
tagged with: java
has title: File upload with Jersey : FormDataContentDisposition is null
type: Question

http://stackoverflow.com/comment/82053806
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/46772424
has text: THANK YOU, that was it for me. <3
type: Comment

http://stackoverflow.com/comment/35220127
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23050513
has text: Where is your `if` statement? Is it in `onCreate()`?
score: 0

http://stackoverflow.com/a/23104934
answers question: http://stackoverflow.com/q/23103864
score: 0
has body: Here is complete sample for your problem.. save below code in Test.java file and run it.. import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; class Person implements Serializable{ private static final long serialVersionUID = 1L; String name ; String phone ; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public Person(String name, String phone) { super(); this.name = name; this.phone = phone; } @Override public String toString() { return "Person [name=" + name + ", phone=" + phone + "]"; } } class Diary { ArrayList&lt;Person&gt; list = new ArrayList&lt;Person&gt;(); public ArrayList&lt;Person&gt; getList() { return list; } public void setList(ArrayList&lt;Person&gt; list) { this.list = list; } public Diary(ArrayList&lt;Person&gt; list) { super(); this.list = list; } } public class Test { public static void main(String[] args) { Person p1 = new Person("John","123"); Person p2 = new Person("Aby","456"); Person p3 = new Person("Debra","789"); ArrayList&lt;Person&gt; list = new ArrayList&lt;Person&gt;(); list.add(p1); list.add(p2); list.add(p3); Diary d = new Diary(list); Collections.sort(d.getList(), new Comparator&lt;Person&gt;(){ public int compare(Person item1, Person item2){ int compare = item1.getName().compareTo(item2.getName()); return compare; } }); for (int i = 0; i &lt; list.size(); i++) { System.out.println(list.get(i)); } } } It sorts list of person in diary using comparator without touching your person class..
type: Answer

http://stackoverflow.com/comment/35072795
comment on: http://stackoverflow.com/q/22969348
score: 9
has text: A question which might lead you the way: What type would you assign the expression "null + null" and why?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23009977
has body: There are different algorithms for converting colors to grayscales. This is an explanation of an algorithm, the Wikipedia article on Grayscale might also lead you to useful ressources. The implementation you finally choose highly depends on your use case.
type: Answer
answers question: http://stackoverflow.com/q/23009912
score: 3
upvote count: 3
downvote count: 0

yahoo
type: Tag
tag name: yahoo
tags question: http://stackoverflow.com/q/23028621

http://stackoverflow.com/q/23096163
has body: i am trying to call other methods in run() method. But only when i exit/terminate the client connection the methods are displaying the output. For example: listall method should print when a client gives listall command. But it gets invoked only when client terminates the connection. Can anyone please tell me what am i doing wrong here public void run() { try { System.out.println("Client socket : "+ clientSocket); clientPortNumber=clientSocket.getPort(); clients.add(clientSocket); String line; while(true) { line=is.readLine(); //System.out.println(line); if(line==null) break; String temp[]=line.split(" "); if(temp[0].equals("ADD")) { addRfc();//add method invocation } else if(temp[0].equals("LOOKUP")) send(os);//send method invocation else if(temp[0].equals("ListAll")) { listAll(); /*listall method should print when cient gives listall command. But it gets invoked only when client terminates the connection*/ } else if(line.equalsIgnoreCase("quit")) { break; } } } catch (IOException e) { System.out.println(e); } }
has comment: http://stackoverflow.com/comment/35303207
has answer: http://stackoverflow.com/a/23096230
has comment: http://stackoverflow.com/comment/35303085
score: 0
answer count: 1
has title: calling methods from run() method in java multithreaded client-server architecutre
accepted answer: http://stackoverflow.com/a/23096230
tagged with: multithreading
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35303069
tagged with: java
type: Question

http://stackoverflow.com/q/23031867
has comment: http://stackoverflow.com/comment/35186400
tagged with: jdbc
answer count: 0
score: 0
tagged with: java
type: Question
has title: How to insert an auto-generated id into another table in jdbc?
has comment: http://stackoverflow.com/comment/35186534
tagged with: derby
has body: Can you please help me, I need to insert an auto-generated key, ADDRESS_ID, into another table, DEBTOR, where it is a foreign key? Below is part of my code? try { String host = "jdbc:derby://localhost:1527/CreditManager"; String uName = "fact"; String uPass = "r107866x"; Connection con = DriverManager.getConnection(host, uName, uPass); String query1 = "insert into ADDRESS (ADDRESS_LINE1, ADDRESS_LINE2, PROVINCE)" + "values (?,?,?)"; String query = "insert into DEBTOR (NATIONAL_ID, FIRSTNAME, MIDDLENAME, SURNAME,PHONE_NUMBER,DOB)" + "values (?,?,?,?,?,?)"; PreparedStatement preparedStatement1 = con.prepareStatement(query1); preparedStatement1.setString(1, address_line1); preparedStatement1.setString(2, address_line2); preparedStatement1.setString(3, province); preparedStatement1.executeUpdate(); PreparedStatement preparedStatement = con.prepareStatement(query); preparedStatement.setString(1, national_id); preparedStatement.setString(2, fname); preparedStatement.setString(3, mname); preparedStatement.setString(4, sname); preparedStatement.setString(5, phone_no); preparedStatement.setString(6, dob); preparedStatement.executeUpdate(); // execute insert SQL stetement } catch (SQLException ex) { Logger.getLogger(AddAccountForm.class.getName()).log(Level.SEVERE, null, ex); }
type: UnansweredQuestion

http://stackoverflow.com/comment/35352846
score: 0
type: Comment
has text: How does this differ from the earlier answer?
comment on: http://stackoverflow.com/a/23124488
type: AnswerComment

http://stackoverflow.com/q/23094877
has comment: http://stackoverflow.com/comment/35300883
type: Question
has comment: http://stackoverflow.com/comment/35300954
tagged with: database
has comment: http://stackoverflow.com/comment/35301246
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/35300917
favorite count: 0
has answer: http://stackoverflow.com/a/23095039
linked to: http://stackoverflow.com/q/4932503
has comment: http://stackoverflow.com/comment/35300748
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35300849
has comment: http://stackoverflow.com/comment/35300802
has body: I'm currently writing a program in java where I often get data from the MySQL database, with a JDBC driver. At first I tried to close the connection every time I ran the program to test it, but it gave an error at that line. I left the 'connection.close()' line out and it worked, which at the time was good enough for me. Unfortunatly that backfired, because now I can't run the program anymore. It gives the following error. Data source rejected estabilishment of connection, message from server: "Too many connections" I honestly have no idea how to fix this. Another related app in Visual Studio rebuild the database every time I run that, so I don't think that's a problem. I deleted the databse in my java editor, Netbeans, and re-imported it, but that didn't solve it either. My googling skills have failed me as well, even the question on stackoverflow didn't seem to work. Any help would be much appreciated
has title: MySQL database in java, too many connections
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/23094937
tagged with: java
tagged with: mysql

http://stackoverflow.com/comment/35185714
score: 0
has text: Oh wow, I hadn't even gotten that far yet. That's horrible!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23025363

http://stackoverflow.com/comment/35352792
comment on: http://stackoverflow.com/a/23124234
type: Comment
score: 0
type: AnswerComment
has text: could i like post it someother way here because i am trying to paste what i got from executing it here, but it says on this site that its too long

http://stackoverflow.com/q/22999188
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/22999340
has comment: http://stackoverflow.com/comment/35127376
downvote count: 0
has comment: http://stackoverflow.com/comment/35137544
type: Question
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/35155586
linked to: http://stackoverflow.com/q/504103
favorite count: 0
has body: While toying with the new Java streams, I have noticed something strange related to the performance of parallel streams. I've used a simple program that reads the words from a text file and counts the words having length > 5 (the test file has 30000 words): String contents = new String(Files.readAllBytes(Paths.get("text.txt"))); List&lt;String&gt; words = Arrays.asList(contents.split("[\\P{L}]+")); long startTime; for (int i = 0; i &lt; 100; i++) { startTime = System.nanoTime(); words.parallelStream().filter(w -&gt; w.length() &gt; 5).count(); System.out.println("Time elapsed [PAR]: " + (System.nanoTime() - startTime)); startTime = System.nanoTime(); words.stream().filter(w -&gt; w.length() &gt; 5).count(); System.out.println("Time elapsed [SEQ]: " + (System.nanoTime() - startTime)); System.out.println("------------------"); } This generates the following output on my machine (I mention only the first and the last 5 loop iterations): Time elapsed [PAR]: 114185196 Time elapsed [SEQ]: 3222664 ------------------ Time elapsed [PAR]: 569611 Time elapsed [SEQ]: 797113 ------------------ Time elapsed [PAR]: 678231 Time elapsed [SEQ]: 414807 ------------------ Time elapsed [PAR]: 755633 Time elapsed [SEQ]: 679085 ------------------ Time elapsed [PAR]: 755633 Time elapsed [SEQ]: 393425 ------------------ ... Time elapsed [PAR]: 90232 Time elapsed [SEQ]: 163785 ------------------ Time elapsed [PAR]: 80396 Time elapsed [SEQ]: 154805 ------------------ Time elapsed [PAR]: 83817 Time elapsed [SEQ]: 154377 ------------------ Time elapsed [PAR]: 81679 Time elapsed [SEQ]: 186449 ------------------ Time elapsed [PAR]: 68849 Time elapsed [SEQ]: 154804 ------------------ Why is the first processing 100 times slower than the rest? Why is the parallel stream slower than the sequential one in the first iterations but it is twice as fast in the last iterations? Why do both the sequential and parallel streams become faster over time? Is this related to loop optimization? Later edit: At Lui…
has answer: http://stackoverflow.com/a/22999340
has title: Java parallel stream performance
answer count: 1
tagged with: parallel-processing
tagged with: microbenchmark
tagged with: performance
has comment: http://stackoverflow.com/comment/35166385

http://stackoverflow.com/comment/35316864
has text: you should call `random.nextInt()` with positive argument
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23104707

http://stackoverflow.com/a/22978127
has body: A bit in the result of &amp; is a 1 if both operands had a 1 set in that bit, so for example: 01010101 & 00001111 ========== 00000101 0x0F is 1111 in binary. (This is called a "mask".) So the expression says "if any of the lowest 4 bits are set in the byte at index 5, throw an exception".
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22978034
has comment: http://stackoverflow.com/comment/35089495
answers question: http://stackoverflow.com/q/22978034
score: 1
has comment: http://stackoverflow.com/comment/35089224
upvote count: 1
has comment: http://stackoverflow.com/comment/35089074
has comment: http://stackoverflow.com/comment/35089343
has comment: http://stackoverflow.com/comment/35088883
type: AcceptedAnswer

http://stackoverflow.com/q/23118407
linked to: http://stackoverflow.com/q/2784514
has comment: http://stackoverflow.com/comment/35342010
has answer: http://stackoverflow.com/a/26034106
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26034106
accepted answer: http://stackoverflow.com/a/23127038
tagged with: spring
has title: Sort JsonArray of JsonObjects Java
has comment: http://stackoverflow.com/comment/35352755
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/35341980
score: 1
tagged with: gson
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35341964
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I'm Using Gson Library.I need to sort an JsonArray of JsonObjects based on keys in the JsonObjects.The JsonArray is given below [{"AS1000":["5.1","0","false","false",null,null],"AS2000":["-","-","-","-","-","-"],"Date":"2014-03-02 08:07:00.0"}, {"AS1000":["5.0","0","false","false",null,null],"AS2000":["-","-","-","-","-","-"],"Date":"2014-03-02 17:58:00.0"}, {"AS1000":["5.0","0","false","false",null,null],"AS2000":["-","-","-","-","-","-"],"Date":"2014-03-30 14:59:00.0"}, {"AS1000":["-","-","-","-","-","-"],"AS2000":["27.0","0","true","false","30.0 - 20.0",null],"Date":"2014-03-30 06:03:00.0"}, {"AS1000":["-","-","-","-","-","-"],"AS2000":["15.0","0","false","false",null,null],"Date":"2014-03-02 02:00:00.0"}, {"AS1000":["5.0","0","false","false",null,null],"AS2000":["-","-","-","-","-","-"],"Date":"2014-03-14 20:06:00.0"}, {"AS1000":["5.0","0","false","false",null,null],"AS2000":["-","-","-","-","-","-"],"Date":"2014-03-30 07:00:00.0"}, {"AS1000":["-","-","-","-","-","-"],"AS2000":["61.0","0","false","false",null,null],"Date":"2014-03-17 19:07:59.0"}] Is it possible to sort based on keys in the object for example AS2000[0] or Date? I have tried Boon like this JsonArray listLoggerDataObj=gson.fromJson(listloggerdata, JsonArray.class); List&lt;JsonObject&gt; list=new ArrayList&lt;JsonObject&gt;(); for (JsonElement entry : listLoggerDataObj) { list.add(entry.getAsJsonObject()); } sort(list,"Date"); /*list ,key used to sort*/ System.out.println("printing sorted" +list.toString()); But it prints the same input.Any Ideas? Thanks, Gowrish
has answer: http://stackoverflow.com/a/23127038
type: Question
answer count: 2

http://stackoverflow.com/comment/35290134
type: Comment
has text: Thanks for suggestion Andrei I changed the version to 3.2 now its working.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23049753

http://stackoverflow.com/comment/35286705
comment on: http://stackoverflow.com/q/23087533
type: Comment
type: QuestionComment
score: 2
has text: Post your Java code so far, and where the issue specifically is.

feature-detection
type: Tag
tag name: feature-detection
tags question: http://stackoverflow.com/q/23000388

http://stackoverflow.com/q/23012536
has title: Run sequential jobs Hadoop
has body: I am using ChainMapper what happens is that they run in a pipeline fashion but what I want is that each mapper waits that the previous one has totally completed it's job. Let's take the count words example where the firstmapper breaks the line to words, secondmapper counts uppercase word and thirdmapper counts the lower case words. Now currently this runs in this fashion the secondmapper can start counting words even if the firstmapper has not finished reading the whole file. What I want is to force the secondmapper to wait till the firstmapper has totally finished reading the input file then it can start. My current configurations are the following: JobConf conf = new JobConf(getConf(), ChainDriver.class); conf.setJobName("wordcount"); .... //first mapper JobConf mapAConf = new JobConf(false); ChainMapper.addMapper(conf, TokenizerMapper.class, LongWritable.class, Text.class, Text.class, IntWritable.class, true, mapAConf); //secondmapper JobConf mapBConf = new JobConf(false); ChainMapper.addMapper(conf, UpperCaserMapper.class, Text.class, IntWritable.class, Text.class, IntWritable.class, true, mapBConf); ..... JobConf reduceConf = new JobConf(false); ChainReducer.setReducer(conf, WordCountReducer.class, Text.class, IntWritable.class, Text.class, IntWritable.class, true, reduceConf); JobClient.runJob(conf); return 0; } Is there a way to force the to run sequentially one after another ?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23013243
score: 1
tagged with: java
upvote count: 1
tagged with: mapreduce
type: Question
tagged with: hadoop
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/105337179
favorite count: 0

antlr
tags question: http://stackoverflow.com/q/23009797
tags question: http://stackoverflow.com/q/23098415
tags question: http://stackoverflow.com/q/23022079
tag name: antlr
tags question: http://stackoverflow.com/q/23092081
type: Tag
tags question: http://stackoverflow.com/q/23078583

http://stackoverflow.com/q/23078280
has answer: http://stackoverflow.com/a/23078396
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/23078446
accepted answer: http://stackoverflow.com/a/23078396
has answer: http://stackoverflow.com/a/23078446
has body: a little time ago I concluded my class diagram and now I want to populate it in a massive way. I made my database (Oracle 10g) from java objects through the ddl-generation function of EclipseLink. Now my doubt is how to make this bulk insert. I thought to do this in two way: Since I think to use also spring and maven during the development, I thought to read the data from an file and to persist them during test life cycle. Or serching on google I saw a few example like Bulk insert with oracle Any suggestion about this?
tagged with: oracle-database
favorite count: 0
tagged with: maven
type: AnsweredQuestion
score: 1
has title: Performing massive insert
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/a/23083830
type: Answer
accepted answer of: http://stackoverflow.com/q/23083629
has body: I would suggest instead of using method addChangeListener nameList.addChangeListener( new MouseAdapter(){ @Override public void mouseClicked(MouseEvent me) { nameListUpdated(); } } ); use method for adding mouse listener addMouseListener nameList.addMouseListener( new MouseAdapter(){ @Override public void mouseClicked(MouseEvent me) { nameListUpdated(); } } );
answers question: http://stackoverflow.com/q/23083629
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23028758
score: 0
tagged with: printing
answer count: 1
has body: In this piece of code: //Staff pf.setOrientation(PageFormat.LANDSCAPE); pj.setPrintable(graphComponent); try { pj.print(); // This is the function in question !! } catch (PrinterException e2) { System.out.println(e2); } //Staff The function print of the job printer, leads you to What I want, is that I give a default name to the file (printing result) without having that prompt. How can I change that code to get that?
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/35183511
tagged with: java
has answer: http://stackoverflow.com/a/23030246
accepted answer: http://stackoverflow.com/a/23030246
has title: Get rid of Prompt Dialog when printing with Java

http://stackoverflow.com/comment/35242648
type: QuestionComment
type: Comment
has text: of course, current code get the query in the loop, i just ask this question to know if it's possible and better (or not)
comment on: http://stackoverflow.com/q/23063006
score: 0

http://stackoverflow.com/a/23081353
downvote count: 0
has comment: http://stackoverflow.com/comment/35277686
has comment: http://stackoverflow.com/comment/35276345
has body: Take a look at FindContours You can use it in Android with: Imgproc.findContours(Mat image, java.util.List&lt;MatOfPoint&gt; contours, Mat hierarchy, int mode, int method) The hierarchy parameter concerns image topology and nested contours, therefore, for simple contours you can just pass new Mat() and Imgproc.RETR_LIST and Imgproc.CHAIN_APPROX_NONE for mode and method respectively.
type: Answer
has comment: http://stackoverflow.com/comment/35277400
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/35278085
answers question: http://stackoverflow.com/q/23080968

http://stackoverflow.com/q/23085018
answer count: 1
has comment: http://stackoverflow.com/comment/35282159
favorite count: 0
has comment: http://stackoverflow.com/comment/35282090
tagged with: gridview
type: UnansweredQuestion
tagged with: dataadapter
tagged with: android
downvote count: 0
score: 1
tagged with: java
has title: Display Data in GridView with DataAdapter in Android
type: Question
has answer: http://stackoverflow.com/a/23109031
upvote count: 1
has body: I have try the following code for displaying data from data adapter in gridview. Following link is for GridView with DataAdapter Tutorial. I am wanted the following output : I have follow the tutorial and get the output as i wanted, but unfortunetly when scroll the page, application will be closed automatically. ERROR : "Application Failure Detected, Please Try Again" How to resolve these problem? code : main.xml file. &lt;GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:stretchMode="columnWidth" android:cacheColorHint="#00000000" android:layout_width="fill_parent" android:layout_height="fill_parent" android:numColumns="2" android:clipChildren="true" android:horizontalSpacing="5dip" android:verticalSpacing="5dip" /&gt; code : MainActivity.java file. package com.example.gridviewdata; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.widget.GridView; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(new DataAdapter(this)); } code : customgrid.xml file &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;TableLayout android:id="@+id/TableLayout01" android:layout_height="wrap_content" android:layout_width="fill_parent"&gt; &lt;TableRow android:id="@+id/TableRow01" android:layout_height="wrap_content" android:layout_width="wrap_content"&gt; &lt;TextView android:text="@string/hello_world" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtId" android:layout_gravity="center_horizontal" /&gt; &lt;TextView android:text="@string/hello_world" android…

http://stackoverflow.com/q/23110032
type: Question
upvote count: 4
has title: WebServlet - urlPatterns with two chars
downvote count: 0
score: 4
tagged with: tomcat
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: annotations
has comment: http://stackoverflow.com/comment/35326112
has answer: http://stackoverflow.com/a/23115145
has body: I'm using WebServlet annotation something like below: @WebServlet( urlPatterns = {"/en", "/de", "/fr"}) public class GeoServlet { // servlet code goes here } As you can see I need to define every single geo in the URL, but instead of that I want to say something like allow all patterns from a-z but limit the pattern by two chars for example something like: @WebServlet( urlPatterns = {"/[a-z]"}{2} ) How can I achieve this? tnx.
tagged with: java
tagged with: servlets

http://stackoverflow.com/comment/35350806
comment on: http://stackoverflow.com/q/23123345
score: 0
type: Comment
type: QuestionComment
has text: use `jquery` `$("#buttonid").click(function(){});`

http://stackoverflow.com/q/22968520
has body: I've got a question regarding children retrieval when using Transformers.aliasToBean function in Hibernate. I've wrote a query which populates my object, but when I try to populate children query doesn't work. I'll post sample code first and add generated SQL and exception below. Parent public class Parent { @Id @Column(name="id") @GeneratedValue private long id; @Column(name="name") private String name; @OneToMany(cascade = CascadeType.ALL) @JoinColumn(name="parent_id") @LazyCollection(LazyCollectionOption.FALSE) private List&lt;Child&gt; children; @Transient private long someCount; // public constructor + getters and setters } Child public class Child { @Id @Column(name="id") @GeneratedValue private long id; // public constructor + getters and setters } Query Query query = session.createQuery("SELECT p.id as id, p.name as name, " + " (SELECT COUNT(*) FROM stat WHERE parent_id=p.id) as someCount, " + " FROM " + Parent.class.getSimpleName() + " p ") .setResultTransformer(Transformers.aliasToBean(Parent.class)); Basically when I try to include p.children as children right in the first line of query I get the following sql generated by hibernate: select parent0_.id as col_0_0_, parent0_.name as col_1_0_, . as col_2_0_, (select count(*) from stats stat3_ where parent_id=parent0_.id) as col_3_0_, child2_.id as id1_2_1_ from inner join child child2_ on parent0_.id=child2_.parent_id And the error is: WARN: SQL Error: 0, SQLState: 42601 ERROR: ERROR: syntax error at or near "." at position 60 That position 60 corresponds to , . as col_2_0_, the position before the dot in the first line of the query. Basically it seems to retrieve the children, but generated SQL prevents it from successfully executing the query. Any help appreciated!
score: 0
tagged with: sql
answer count: 1
has answer: http://stackoverflow.com/a/23047500
has title: Retrieving object children while using Transformers.aliasToBean
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/23047500
type: Question

http://stackoverflow.com/q/23086289
tagged with: frame
has answer: http://stackoverflow.com/a/23086343
tagged with: swing
type: AnsweredQuestion
tagged with: joptionpane
has body: I'm writing a program for a login page I have everything working including the JOptionPane except when I click ok on the option pane it closes that and the JFrame how do I change my code to stop closing the JFrame and just close the JOptionPane package softwareDesign; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.ResultSet; import java.sql.SQLException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import java.sql.ResultSetMetaData; public class LoginPage extends JFrame implements ActionListener { JPanel panel; JLabel label; JTextField userfield; JPasswordField passfield; JButton loginButton, createButton; boolean authenticated = false; MySQLEngine engine = new MySQLEngine("root", ""); /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub new LoginPage(); } public LoginPage() { super("The Online Music Store"); Container c = getContentPane(); panel = new JPanel(); label = new JLabel(); label.setText("Log In"); Font Fancyfont = new Font("Calibri(Body)", Font.BOLD, 26); label.setFont(Fancyfont); userfield = new JTextField(20); Font Fancyfont1 = new Font("Calibri(Body)", Font.ITALIC, 12); userfield.setFont(Fancyfont1); passfield = new JPasswordField(10); Font Fancyfont2 = new Font("Calibri(Body)", Font.ITALIC, 12); passfield.setFont(Fancyfont2); loginButton = new JButton("Log In"); loginButton.addActionListener(this); loginButton.setBackground(Color.CYAN); createButton = new JButton("Create Account"); createButton.setBackground(Color.CYAN); createButton.addActionListener(this); engine.connect(); panel.add(userfield); panel.add(passfield); panel.add(loginButton); panel.add(createButton); c.add(label, BorderLayout.NORTH); c.add(p…
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/9554636
accepted answer: http://stackoverflow.com/a/23086343
score: 0
has title: How to stop JFrame from closing when clicking ok in a JOptionPane
answer count: 1

http://stackoverflow.com/comment/35321996
comment on: http://stackoverflow.com/q/23024629
score: 0
type: Comment
type: QuestionComment
has text: As suggested setCharacterEncoding() was removed and not require. flush() I have move after write.

http://stackoverflow.com/a/23095061
score: 1
has comment: http://stackoverflow.com/comment/35392755
downvote count: 0
has comment: http://stackoverflow.com/comment/35301839
answers question: http://stackoverflow.com/q/23023583
has comment: http://stackoverflow.com/comment/35394178
has comment: http://stackoverflow.com/comment/35387603
has body: What does the complete stream contain that the server is creating and the client is reading? Note that by using MimeMultipart without MimeMessage, you're missing some of the things that are done automatically for you by MimeMessage, in particular you're missing the call to MimeMultipart.updateHeaders(). Since the method is protected, you'll need to subclass MimeMultipart and call that method before calling writeTo. If that doesn't fix your problem, show us the exact data that's being written and read on the stream. As mentioned above, if you're expecting binary data, you almost certainly want to use getInputStream. The getRawInputStream gives you the data before it has been decoded, e.g., the base64 input instead of binary output.
accepted answer of: http://stackoverflow.com/q/23023583
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35307530
has comment: http://stackoverflow.com/comment/35346630
has comment: http://stackoverflow.com/comment/35307575
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35339400

http://stackoverflow.com/a/23112530
answers question: http://stackoverflow.com/q/23108223
has body: I have found the solution - the proxy class which was generated using svcutil.exe generate strange type for one of the members of response objects: private list validationErrorsField; which is: [System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.17929")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.oracle.com/webservices/internal/literal")] public partial class list : collection { } and collection is: /// &lt;remarks/&gt; [System.Xml.Serialization.XmlIncludeAttribute(typeof(list))] [System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.17929")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.oracle.com/webservices/internal/literal")] public partial class collection { private object[] itemField; /// &lt;remarks/&gt; [System.Xml.Serialization.XmlElementAttribute("item", Order=0)] public object[] item { get { return this.itemField; } set { this.itemField = value; } } } so I just changed this problematic type to string[] and everything is working now.
score: 0
type: Answer

http://stackoverflow.com/comment/35229112
type: Comment
score: 0
type: AnswerComment
has text: Use the same system property in both systems with the same value: A file that they both should read and then put the shared information into that file.
comment on: http://stackoverflow.com/a/23006169

http://stackoverflow.com/q/23083558
tagged with: cdi
type: Question
score: -1
tagged with: jsf
downvote count: 2
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/23084028
tagged with: java
accepted answer: http://stackoverflow.com/a/23084028
has body: I made a simple xhtml page for upload file by using &lt;h:inputFile&gt; component. And everything works fine. And in managed bean I used dependency injection for the Logger. I used a factory class and createLogger() method in, to enable injection for object of Logger class. Everything is ok but, nothing works without a @Model annotation in managed bean. Can somebody explain the meaning of the @Model annotation. I can not find on internet proper explanation. A founded explanation of other annotation like as @Session, @Request, @Application etc. What does the @Model annotation do?
has title: JSF and CDI with inputFile component
type: AnsweredQuestion
favorite count: 0

http://stackoverflow.com/comment/35341319
comment on: http://stackoverflow.com/a/23117575
score: 0
type: AnswerComment
type: Comment
has text: dear down voter, the asker has edited the code later. so you must check it before down voting :( even the commentors on the question have said the same thing.

http://stackoverflow.com/comment/35192817
has text: Thanks jahroy for your feedback. In truth my posting has .* in all three spots but somehow when my question is posted the first two * do not show.
comment on: http://stackoverflow.com/q/23035427
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35153276
type: Comment
has text: @user3523456 see edit :) edit: fixed typos. notify me if you need more details
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23013607

http://stackoverflow.com/q/23040274
has answer: http://stackoverflow.com/a/34741515
has answer: http://stackoverflow.com/a/34740588
type: AnsweredQuestion
upvote count: 14
possible better answer: http://stackoverflow.com/a/37080841
has answer: http://stackoverflow.com/a/37080841
type: Question
score: 14
has answer: http://stackoverflow.com/a/23040494
has comment: http://stackoverflow.com/comment/35201616
tagged with: java
has body: I have edittext in a form, I want that when the user inputs text into the edittext for my program to detect which language was inserted into the edittext. Is there a way to determine a string is English or Persian? I found this code for Arabic public static boolean isProbablyArabic(String s) { for (int i = 0; i &lt; Character.codePointCount(s, 0, s.length()); i++) { int c = s.codePointAt(i); if (c &gt;= 0x0600 &amp;&amp; c &lt;=0x06E0) return true; } return false; } but how can I change this code for Persian?
has comment: http://stackoverflow.com/comment/35201697
accepted answer: http://stackoverflow.com/a/34740588
has answer: http://stackoverflow.com/a/23040359
has comment: http://stackoverflow.com/comment/35201495
has comment: http://stackoverflow.com/comment/35201569
downvote count: 0
linked to: http://stackoverflow.com/q/22565100
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/35201458
tagged with: android
has title: How to determine a string is English or Persian?

http://stackoverflow.com/a/23125308
type: Answer
has body: Based on the code you've given, the code inside the System.out.print() call will return a PostalCode object. So to get a string you could do something like: String x = postalCodeIndex.findClosestBruteForce(latitude, longitude).toString(); //use x as String
answers question: http://stackoverflow.com/q/23125289
downvote count: 1
has comment: http://stackoverflow.com/comment/35354380
has comment: http://stackoverflow.com/comment/35354249
upvote count: 4
score: 3
has comment: http://stackoverflow.com/comment/35354424

http://stackoverflow.com/q/23066532
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: android-asynctask
tagged with: android
has body: public class ViewData extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_data); AccessDBTask db=new AccessDBTask(); db.execute(new String[]{""}); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.view_data, 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); } private class AccessDBTask extends AsyncTask&lt;String, Void, List&lt;String&gt;&gt; { List&lt;String&gt; myData1 ; @Override protected List&lt;String&gt; doInBackground(String... params) { String driverClassName="org.postgresql.Driver"; String url="jdbc:postgresql://url:port/dbname"; Connection dbConnect=null; Statement statement=null; ResultSet result; //code for jdbc myData1 = new ArrayList&lt;String&gt;(); try{ Class.forName (driverClassName).newInstance(); dbConnect = DriverManager.getConnection (url, "username", "password"); statement = dbConnect.createStatement(); DatabaseMetaData databaseMetaData = dbConnect.getMetaData(); String[] types = { "TABLE" }; result = databaseMetaData.getTables("%","username", "%", types ); while(result.next()) { //int counter++; String tableName = result.getString(3); myData1.add(tableName); } statement.close(); dbConnect.close(); }catch(Exception ex){ } return myData1; } @Override protected void onPostExecute(List&lt;String&gt; myData12){ if(myData1.isEmpty()){ Toast.makeText(ViewData.this,"ERROR", Toast.LENGTH_SHORT).show(); } ArrayAdapter adapter = new ArrayAdapter&lt;String&gt;(ViewData.this,R.layout.activity_listview, myData1)…
tagged with: jdbc
has title: jdbc not working on asynstask on android
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23066769

http://stackoverflow.com/q/22972288
has answer: http://stackoverflow.com/a/22973048
has comment: http://stackoverflow.com/comment/35079788
has body: I have set a JTable to initialize at the beginning of the program, and I set it to a DefaultTableModel: public DefaultTableModel usernameScraperTableModel = new DefaultTableModel(); private JTable usernameScraperTable; I then initialize the table inside the constructor as below, this.usernameScraperTable = new JTable(this.usernameScraperTableModel); this.usernameScraperTableModel.addColumn("Username"); and then in my actionPerformed(ActionEvent) for my startButton, I run a method. If something is collected, it is supposed to add it to the table. this.usernameScraperTableModel.addRow(new Object[] { user.getName() } ); It works somewhat. During run-time, the table is blank and doesn't show anything. I know this because in my Eclipse console it's working like it's supposed to. But after the method is done running, it then has the JTable update and all of the names are there. I'm wondering how I can have my table update in real time inside of an ActionEvent of a button. EDIT Thanks for this. It still doesn't work though. I used WindowBuilder from the Eclipse website, and it's a JFrame. When I click start, the GUI kind of "freezes" (I can't click anything else, can't press the exit button, anything) until the method is done with
has comment: http://stackoverflow.com/comment/35086903
answer count: 1
downvote count: 0
tagged with: jtable
favorite count: 0
has comment: http://stackoverflow.com/comment/35085710
type: UnansweredQuestion
upvote count: 1
tagged with: swing
type: Question
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/3179136
has title: JTable runtime error

http://stackoverflow.com/a/23126013
has comment: http://stackoverflow.com/comment/35356399
type: Answer
score: 1
upvote count: 1
has body: The current problem in your code is that if the string you pass in argument is null, thenstring !=null is evaluated to false. Hence you'll try to evaluate !string.isEmpty() which will lead to a NullPointerException. On the other hand if you pass a String that is not null (ex "" or "test"), string != null is evaluated to true and hence you return true. So to fix that you should, as the name of your method suggests, check if the String is null OR empty. But since you're on android, don't reinvent the wheel and use TextUtils.isEmpty(CharSequence str). boolean isEmpty = TextUtils.isEmpty(myString); Returns true if the string is null or 0-length. If you want to look about how is it implemented: 427 public static boolean isEmpty(CharSequence str) { 428 if (str == null || str.length() == 0) 429 return true; 430 else 431 return false; 432 }
has comment: http://stackoverflow.com/comment/35356444
has comment: http://stackoverflow.com/comment/35357434
has comment: http://stackoverflow.com/comment/35357694
downvote count: 0
answers question: http://stackoverflow.com/q/23125968

http://stackoverflow.com/q/23083194
possible better answer: http://stackoverflow.com/a/23083535
tagged with: google-glass
has answer: http://stackoverflow.com/a/23083535
type: AnsweredQuestion
has body: I am trying to make an offline application on google glass using the speech recognition. Indeed, my application should understand the command "Next", said at anytime, in order to launch an action. My application should work offline, so I would like to use a dictionnary / words list. (Development in Java) Are there any issues for my problem ? Thank in advance. Cheers.
tagged with: offline
has comment: http://stackoverflow.com/comment/35283476
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23118248
has title: Speech recognition on google glass offline
score: 0
tagged with: java
tagged with: speech
accepted answer: http://stackoverflow.com/a/23118248

http://stackoverflow.com/q/22980276
type: UnansweredQuestion
tagged with: java
type: Question
has body: I am trying to find the rest api reference for deleting the azure vm endpoint configured. i got the rest api reference for update/create endpoints over the below link but unable to get the reference for deleting the enpoint. do any one have tried to delete the endpoint using rest api. if so kindly share how to delete the endpoint of a vm in azure using rest api. http://msdn.microsoft.com/en-us/library/jj157187.aspx - Update Role Thanks in Advance.
score: 0
answer count: 2
tagged with: azure
has title: Unable to find Rest api reference for deleting azure vm endpoint
has answer: http://stackoverflow.com/a/30442605
tagged with: rest
has answer: http://stackoverflow.com/a/22980400

http://stackoverflow.com/q/23058500
has answer: http://stackoverflow.com/a/23058575
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23058568
accepted answer: http://stackoverflow.com/a/23058575
tagged with: java
has answer: http://stackoverflow.com/a/23058568
has title: how to print object value with String method
answer count: 2
tagged with: string
score: 0
tagged with: abstract-class
has body: I have an abstract class like this public abstract class Temperature { private float value; public Temperature(float v) { value = v; } public final float getValue() { return value; } public abstract Temperature toCelsius(); public abstract Temperature toFahrenheit(); public abstract Temperature toKelvin(); } then I have classes that extend this Temperature class, example: public class Celsius extends Temperature { public Celsius(float t) { super(t); } public String toString() { return ""; } @Override public Temperature toCelsius() { // TODO Auto-generated method stub return this; } public Temperature toKelvin(){ return new Kelvin(this.getValue() + 273); } @Override public Temperature toFahrenheit() { // TODO Auto-generated method stub return new Fahrenheit(this.getValue() * 9 / 5 +32); } } main method creates objects of of Celcius Temperature inputTemp = null, outputTemp = null; inputTemp = new Celsius(temp_val); outputTemp = inputTemp.toCelsius(); then prints the object by calling this method System.out.println("\n The converted temperature is " + outputTemp.toString() +"\n\n"); } What do i have to put in the toString method in order to print the desired value? this.super.getValue() didnt work and im kinda clueless. Since we are not going to be returning the same object everytime, dont we have to use the superclass?
has comment: http://stackoverflow.com/comment/35234340

http://stackoverflow.com/comment/35141054
has text: Basically the same way. You have to generate the checksums everytime a file is added and you need a way to read the checksum from the server. Often the checksum is stored next to the original file with the same name but with the .md5 file extension.
comment on: http://stackoverflow.com/a/23006900
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23005986
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23006137
tagged with: java
tagged with: servlets
type: Question
score: 0
has body: I've been reading about asynchronous servlets in an attempt to see if it fits my use case. The server will receive long-running requests that take time to read from the db, and process each message. Here is the basic flow: Client makes a request to validate some data. Server receives a request for the long-running process (~1-2 minutes) Request needs to talk to a db (redis, in my case) to grab 100,000 docs in batches. Processing occurs for each doc, and if it is valid, it is written to the client. Similarly, upto 25 sample docs are written to the client. When the full data set is processed (but no more than 25 docs are written), a result is calculated and sent. Connection is successfully closed. So there is a db wait, which all similar requests will have, and then the processing for each doc, which happens in the same thread. Is there any benefit to switching to async servlets versus a regular synchronous servlet in this case? Additionally, if I do use an async servlet, would there be any benefit in also trying to parallelize the processing of the docs with thread pools? It seems like I won't be getting any additional benefit, but want to clarify this as well. Thanks for your help!
answer count: 1
tagged with: asynchronous
has title: Is this long running request a valid use case for java asynchronous servlets?

http://stackoverflow.com/a/23079779
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23079460
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23079460
has body: I would consider sending a key code to the server. See KeyStroke.getKeyCode(). This is an integer value. There are many examples on the Internet of how to send an int from a client to a server (e.g. send/read int in a client/server app). Take a look and pick one that matches your use case.

http://stackoverflow.com/comment/35178417
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23027084
score: 0
has text: How try with `Servlet Filter` to check ip address of the request?

http://stackoverflow.com/comment/35129546
score: 1
has text: How would you do it in C++?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23000609

audio
tags question: http://stackoverflow.com/q/23029098
tags question: http://stackoverflow.com/q/23045299
tags question: http://stackoverflow.com/q/23087031
tags question: http://stackoverflow.com/q/23116426
tags question: http://stackoverflow.com/q/23127527
type: Tag
tag name: audio
tags question: http://stackoverflow.com/q/23118001
tags question: http://stackoverflow.com/q/23010150
tags question: http://stackoverflow.com/q/23093545
tags question: http://stackoverflow.com/q/22997800
tags question: http://stackoverflow.com/q/23096533
tags question: http://stackoverflow.com/q/23023083
tags question: http://stackoverflow.com/q/22986101
tags question: http://stackoverflow.com/q/23041673

http://stackoverflow.com/comment/35122367
type: QuestionComment
score: 0
has text: I think you need to call the repaint on an object -- probably either the label or the dialog would work. try `popUpLabel.repaint()` or `popUpDialog.repaint()`
comment on: http://stackoverflow.com/q/22996619
type: Comment

http://stackoverflow.com/comment/41788018
score: 0
type: Comment
type: QuestionComment
has text: Hey man if you got any solution to your problem since 6 months than please share with me I need the same thing that you want to do with webview, Thanks :)
comment on: http://stackoverflow.com/q/22984430

http://stackoverflow.com/q/23055376
type: Question
has answer: http://stackoverflow.com/a/23055558
accepted answer: http://stackoverflow.com/a/23055558
downvote count: 0
answer count: 1
upvote count: 6
favorite count: 0
has title: Disabling goals in a maven plugin execution
score: 6
tagged with: maven
tagged with: plugins
type: AnsweredQuestion
tagged with: java
has body: I have a setup where most of my projects require the xtend plugin to be run both for the compile and testCompile goals. I describe it in a pluginManagement section: org.eclipse.xtend xtend-maven-plugin 2.5.3 compile testCompile Now, there are some projects that don't need one goal or the other. I've tried the inherited tag, played around with random attributes but none worked. How can I override the execution to contain only the desired goal? UPDATE: The conclusion of the story is that individial goals cannot be disabled. The smallest scope that can be managed is the execution.

http://stackoverflow.com/a/23017572
score: 0
answers question: http://stackoverflow.com/q/23017483
type: Answer
has body: You code looks fine. Is the other activity in your AndroidManifest.xml? EDIT Your problem is definitely that the class wasn't declared in the manifest by looking at your error log. Declare it and you should be fine.
has comment: http://stackoverflow.com/comment/35160221
has comment: http://stackoverflow.com/comment/35160454
has comment: http://stackoverflow.com/comment/35160335

http://stackoverflow.com/q/23093440
has title: How do you use "Range" to Scan an entire table in accumulo
possible better answer: http://stackoverflow.com/a/23095391
has answer: http://stackoverflow.com/a/23097077
answer count: 2
downvote count: 0
tagged with: accumulo
favorite count: 0
linked to: http://stackoverflow.com/q/21503594
accepted answer: http://stackoverflow.com/a/23097077
type: AnsweredQuestion
upvote count: 3
has body: How do you use "Range" to Scan an entire table in accumulo without apriori knowledge? How do folks currently do that. I want to take the random search from:I am looking at writing an Accumulo iterator to return a random sample of a percentile of a table and scan over (then write to hdfs) a sample. This requires me to scan the entire table I believe. thanks! Chris
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23095391
score: 3

http://stackoverflow.com/comment/35307118
type: Comment
comment on: http://stackoverflow.com/q/23098312
has text: The short answer is no, if you have classes in different packages with the same name you will need to use their absolute names (package.name) to reference them in your code, this is the point of having package name spaces. So in your code you would need to use `org.a.a` and `org.a.a.a` explicitly, rather than using the `import` statement...
score: 0
type: QuestionComment

http://stackoverflow.com/a/23056715
downvote count: 0
has body: There are two ways you can acheive this, either use a enum as constructor parameter. The enum itself contains only the allowed values, which is what I would do, keep everythign nice an oop and you can add logic to enums at a later date. Or alternatively you can just check if the constuctor paramters value is valid, by performing a comparison and throwing an exception if not in allowed values. Have a predfined list and then, myList.contains(myString) - throw exception if false.
score: 1
has comment: http://stackoverflow.com/comment/35231150
answers question: http://stackoverflow.com/q/23056662
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/35231434

http://stackoverflow.com/q/23070298
type: Question
linked to: http://stackoverflow.com/q/56501897
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/44069226
has answer: http://stackoverflow.com/a/41751144
has answer: http://stackoverflow.com/a/64354984
has answer: http://stackoverflow.com/a/23071080
has answer: http://stackoverflow.com/a/27976073
answer count: 13
accepted answer: http://stackoverflow.com/a/23071080
linked to: http://stackoverflow.com/q/34288873
linked to: http://stackoverflow.com/q/32942661
has answer: http://stackoverflow.com/a/27493233
has answer: http://stackoverflow.com/a/34375405
has body: I'm consuming an API from my android app, and all the JSON responses are like this: { 'status': 'OK', 'reason': 'Everything was fine', 'content': { &lt; some data here &gt; } The problem is that all my POJOs have a status, reason fields, and inside the content field is the real POJO I want. Is there any way to create a custom converter of Gson to extract always the content field, so retrofit returns the appropiate POJO?
downvote count: 0
has answer: http://stackoverflow.com/a/35894539
has answer: http://stackoverflow.com/a/34113460
has comment: http://stackoverflow.com/comment/35257417
has answer: http://stackoverflow.com/a/40691739
favorite count: 0
has comment: http://stackoverflow.com/comment/35256400
has comment: http://stackoverflow.com/comment/59832844
tagged with: retrofit
tagged with: android
has answer: http://stackoverflow.com/a/56493333
has title: Get nested JSON object with GSON using retrofit
score: 118
has answer: http://stackoverflow.com/a/40239564
upvote count: 118
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has answer: http://stackoverflow.com/a/40254090
possible better answer: http://stackoverflow.com/a/27976073

http://stackoverflow.com/q/23005558
answer count: 1
tagged with: jsp
favorite count: 0
has body: I want to display JSON &amp; XML using a single jsp page. at a time only one attribute will come from the java class. My code something look like this. &lt;% String json = (String) request.getAttribute("userRequestedJsonById"); if (!StringUtility.isNullOrEmpty(json)) {%&gt; &lt;%=json%&gt; &lt;% } else { %&gt; &lt;% String xml = (String) request.getAttribute("searcherRespondedXmlById"); if(!StringUtility.isNullOrEmpty(xml)) {%&gt; &lt;%@page contentType="text/xml"%&gt; &lt;%=xml%&gt; &lt;%}%&gt; &lt;%}%&gt; I am having a plugin called JSONVIEW to display the json properly.which doesn't work if it finds content type xml. Content type is set only on the condition,jsp is including this content type even condition is not satisfied. I don't know much how jsp set content type works,is there any other way to do this or to restrict to set content type xml on a particular condition. Thanks.
tagged with: http://stackoverflow.com/tag/xml
has title: is it possible to set page content type on a condition in jsp or to set different content type for a single jsp
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/35138788
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/23017988
upvote count: 3
has answer: http://stackoverflow.com/a/23017988

http://stackoverflow.com/comment/35338222
has text: then change data[1] to data[4] since your closing is 4th element in array ( array starts with 0)
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23116292

http://stackoverflow.com/comment/35245802
has text: `String` `x` is not a component so you cant set its background color. It seems you are trying to set the color of the `JComboBox` selected item. In this case you need a [custom renderer](http://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html#renderer)
comment on: http://stackoverflow.com/a/23064157
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22981823
answers question: http://stackoverflow.com/q/22981729
has comment: http://stackoverflow.com/comment/35095041
downvote count: 0
has body: Your structure is not really JSON. A json structure would be like { Username : "John", Message : "Hello" } Anf if your want to really use JSON, there is not way to remove braces and quotes. This IS Json. If you want to output only the part you quoted, store the json value in a variable String myoutput = stringWriter.toString(); And then remove the parts you don't want with replace() or a regexp
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/35095205
has comment: http://stackoverflow.com/comment/35095125

http://stackoverflow.com/a/23293250
has comment: http://stackoverflow.com/comment/35737479
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23101112
has body: "Another application is listening" means that JProfiler opened a socket connection, but the magic number of the JProfiler protocol was not sent by the remote side. For example, this would happen if the remote port served HTTP pages.
has comment: http://stackoverflow.com/comment/35744972

http://stackoverflow.com/a/58945154
score: 1
upvote count: 1
has body: A solution using Regular expression and group: String pattern = "(\\w*://)([\\w-_.]+)([:\\w\\W]*)"; Pattern r = Pattern.compile(pattern); Matcher m = r.matcher(a); if (m.find()) { System.out.println(m.group(0)); System.out.println(m.group(1)); System.out.println(m.group(2)); System.out.println(m.group(3)); } group(2) is the hostname.
downvote count: 0
answers question: http://stackoverflow.com/q/23079197
type: Answer

http://stackoverflow.com/q/23056225
downvote count: 0
has answer: http://stackoverflow.com/a/23057956
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/23058952
score: 1
tagged with: java
has title: Is there a way to control the keyboard in java without awt.robot
answer count: 2
upvote count: 1
has body: Is there a way to control the keyboard in java without using awt.robot? Unfortunatly the robot class cannot press every key on an azerty layout. And I need one of them. The only solution seems to code the equivalent of robot in C then use java to call it. Thanks.
tagged with: awtrobot
tagged with: keyboard
favorite count: 0
has comment: http://stackoverflow.com/comment/35233053

http://stackoverflow.com/comment/35199402
comment on: http://stackoverflow.com/a/23038920
has text: Or you could read the tutorial and download the examples from the tutorial, because the tutorial also has an explanation about what the code does, unlike these examples. Plus this question is about adding the checkboxes when you click a button, so this example doesn't really help.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/23101320
has body: Assuming that the question is about the difference of Cipher.getInstance("AES") and Cipher.getInstance("AES/CFB/NoPadding"): For Oracle JDK the default mode/padding when you do not specify them in the transformation string is "ECB/PKCS5Padding", meaning that Cipher.getInstance("AES") is the same as Cipher.getInstance("AES/ECB/PKCS5Padding"). The result of encoding some data with AES/ECB/PKCS5Padding is predictably different from encoding the same data with AES/CFB/NoPadding. To minimize the confusion you should always specify the full transformation with explicit mode and padding values.
score: 0
answers question: http://stackoverflow.com/q/23087482
type: Answer

http://stackoverflow.com/comment/35208892
comment on: http://stackoverflow.com/a/23044555
type: AnswerComment
score: 0
has text: @bgth Wouldn't that still require an object to parse through the serialized files?
type: Comment

http://stackoverflow.com/q/23118911
answer count: 0
has comment: http://stackoverflow.com/comment/35343843
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35343902
has comment: http://stackoverflow.com/comment/35343424
has comment: http://stackoverflow.com/comment/35343370
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35343964
has comment: http://stackoverflow.com/comment/35342912
has comment: http://stackoverflow.com/comment/35343044
has comment: http://stackoverflow.com/comment/35343201
has comment: http://stackoverflow.com/comment/35343619
has title: App gets installed on all phones except on a certain brand
has body: I am facing a strange problem. My android app gets installed on all android phones viz. Sony, Samsung except that of Micromax. On Micromax phones, I get an error saying : File format not supported. It's just a .apk file. I tried on different Micromax phones but the issue is still there. I am awe-struck. What is wrong ?
tagged with: android
tagged with: apk
has comment: http://stackoverflow.com/comment/35343359

http://stackoverflow.com/comment/35237699
comment on: http://stackoverflow.com/q/23060316
type: Comment
type: QuestionComment
has text: does this help? https://stackoverflow.com/questions/19570608/where-does-getresourceasstreamfile-search-for-the-file
score: 0

http://stackoverflow.com/a/23123699
score: 0
type: Answer
has body: how can I tell regular users from premium users, prior to creating the user object to authenticate? ok, you have @Service("regularUserService") public class RegularUserServiceImpl implements UserService { ..... } and another one like: @Service("premiumUserService") public class PremiumUserServiceImpl implements UserService { ..... } OK, but Spring will found more than one implementation of UserService, use @Primary annotation to tell Spring which autowire candidate will preferred when more than one matching bean instance exists. for example if you want to make RegularUserService as prior then add @Primary on it: @Primary @Service("regularUserService") public class RegularUserServiceImpl implements UserService { ..... } See Also: @Primary @Named and @Inject
answers question: http://stackoverflow.com/q/23121805
has comment: http://stackoverflow.com/comment/35364861

http://stackoverflow.com/a/22991065
accepted answer of: http://stackoverflow.com/q/22990957
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/22990957
has comment: http://stackoverflow.com/comment/35112386
has comment: http://stackoverflow.com/comment/35113030
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35112256
has body: The constant pool does not have a concept of "method start" and "method end". What you are actually seeing here are string constants, which have the type "Utf8" in the constant pool. From the pool's point of view, these are just strings -- however, they are compiler-generated strings representing various things. These strings are required and their format is described in the JVMS. There are a few types. From your lambda example: lambda$new$0 - This is a signature, described in 4.3.4. (I)I - This is a method descriptor (not the same as a signature), described in 4.3.3 I - This is a field descriptor, described in 4.3.2. The simple I entry is just a field of type int. For your (I) I entry, the string between the (..) is the parameter type. It can be a list. I is the primitive type int. The string outside the (..) is the return type. So (I) I describes a method with a parameter list accepting an int and a return type of int. Specifically, from the JVMS, method descriptor strings have the format: MethodDescriptor: ( ParameterDescriptor* ) ReturnDescriptor ParameterDescriptor: FieldType ReturnDescriptor: FieldType VoidDescriptor VoidDescriptor: V Where FieldType is (from table 4.2): Character Type Interpretation B byte signed byte C char Unicode character code point in the Basic Multilingual Plane, encoded with UTF-16 D double double-precision floating-point value F float single-precision floating-point value I int integer J long long integer L ClassName; reference an instance of class ClassName S short signed short Z boolean true or false [ reference one array dimension Note, however, that these are still strings like any other. When you actually call these methods, a different kind of entry - a method reference - will appear in the constant pool. javap identifies these with the "NameAndType" type (as opposed to "Utf8" for strings), and they will take forms like (using your first example): #123 = NameAndType #11:#12; // "foo":(I)I They reference the method name string as…
type: Answer
has comment: http://stackoverflow.com/comment/35111777

http://stackoverflow.com/comment/35280193
score: 0
comment on: http://stackoverflow.com/a/23068409
type: AnswerComment
type: Comment
has text: I just explained it. If you're gridlayout it 12 by 12 and you want 2,5 then use the labels[2][5]. Other than that you need to explain what you're trying to accomplish.

http://stackoverflow.com/q/23009846
has comment: http://stackoverflow.com/comment/35147304
has title: JNI - Disconnected from the target VM, during the execution of native code
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35146807
tagged with: c++
tagged with: java
type: Question
tagged with: c++-cli
tagged with: c#
has comment: http://stackoverflow.com/comment/35146189
tagged with: java-native-interface
has body: I'm getting an error with a Java exception while executing my program. Though java catches the exception it continues the execution of native code without giving the intended result. here is the native code that I guess something wrong with it :- System::Collections::Generic::List&lt;cli::array&lt;unsigned char&gt;^&gt;^ processImages(unsigned char* frontImage, unsigned char* backImage); jbyteArray convertUnsignedCharIntoJByteArray(JNIEnv *env,array&lt;unsigned char&gt;^ inputArray); unsigned char* convertJByteArrayIntoUnsignedChar(JNIEnv *env, jbyteArray inImage); JNIEXPORT jobject JNICALL Java_com_me_NativeCaller_processImages (JNIEnv *env, jclass c, jbyteArray front, jbyteArray back){ unsigned char* frontBuffer = convertJByteArrayIntoUnsignedChar(env, front); unsigned char* backBuffer = convertJByteArrayIntoUnsignedChar(env, back); jbyteArray intermediateArray1 = convertUnsignedCharIntoJByteArray(env,(array&lt;unsigned char&gt;^)returnedValue[0]); jbyteArray intermediateArray2 = convertUnsignedCharIntoJByteArray(env,(array&lt;unsigned char&gt;^)returnedValue[1]); int aLen1 = strlen(reinterpret_cast&lt;const char*&gt;(&amp;intermediateArray1)); int aLen2 = strlen(reinterpret_cast&lt;const char*&gt;(&amp;intermediateArray2)); jbyteArray finalArray = env-&gt;NewByteArray(2); env-&gt;SetByteArrayRegion(finalArray,0,1,(jbyte*)&amp;intermediateArray1); env-&gt;SetByteArrayRegion(finalArray,1,2,(jbyte*)&amp;intermediateArray2); return static_cast&lt;jobject&gt;(finalArray); } /*takes an array&lt;unsigned char&gt;^ as input and convert it into a jbyteArray*/ jbyteArray convertUnsignedCharIntoJByteArray(JNIEnv *env,array&lt;unsigned char&gt;^ inputArray){ int aLen = strlen(reinterpret_cast&lt;const char*&gt;(&amp;inputArray)); jbyteArray intermediateArray = env-&gt;NewByteArray(aLen); env-&gt;SetByteArrayRegion(intermediateArray,0,aLen,(jbyte*)&amp;inputArray); return intermediateArray; } to be precise I think the way I convert manged unsigned char into jbyteArray is not …
has answer: http://stackoverflow.com/a/23011155
score: 0
has comment: http://stackoverflow.com/comment/35147594
has comment: http://stackoverflow.com/comment/35146428
answer count: 1
has comment: http://stackoverflow.com/comment/35147011
has comment: http://stackoverflow.com/comment/35146533

http://stackoverflow.com/q/23025115
has answer: http://stackoverflow.com/a/23029357
favorite count: 0
has body: I created EditorGrid using GXT 2.2.3.Everything required is over.But at one point I stucked i.e I need to disable and enable some cells based on the value in one cell.I asked Question for this How to make cell as non editable based on another cell value in Editable Grid in gxt. But I got the solution that doesn't working for me.I asked in Sencha,coderanch and some other forums,but still I didn't got solution. Now I decided to migrate this to GXT 3.0.1. I need an EditableGrid and need to disable and enable the cell editing based on the value in another Cell.Please suggest which grid is suitable for this in GXT 3.0.1 and how to migrate to GXT 2.2.3 to GXT 3.0.1.
type: AnsweredQuestion
has title: How to migrate from GXT 2.2.3 to GXT 3.0.1
downvote count: 0
score: 1
tagged with: java
tagged with: gxt
possible better answer: http://stackoverflow.com/a/23029357
type: Question
tagged with: gwt
has comment: http://stackoverflow.com/comment/35225659
has answer: http://stackoverflow.com/a/23108103
has comment: http://stackoverflow.com/comment/35222843
accepted answer: http://stackoverflow.com/a/23108103
answer count: 2
upvote count: 1
linked to: http://stackoverflow.com/q/22610705

http://stackoverflow.com/comment/35220269
comment on: http://stackoverflow.com/q/23050598
type: Comment
has text: Can you rephrase this as a specific question, rather than "I dunno, do I need a hint?" If not, code review requests go on a different section of Stack Exchange.
score: 2
type: QuestionComment

http://stackoverflow.com/q/23036959
has comment: http://stackoverflow.com/comment/35195659
accepted answer: http://stackoverflow.com/a/23036994
score: 0
type: AnsweredQuestion
has body: I'm trying to make it where I get a user input, that has a string, than a number after it so [String] [int] And what I want to do is save that String onto the number value the integer is... and all I have is here public class test { public static String[] mem; public static void main(String args[]) { System.out.println(" "); Scanner sc=new Scanner(System.in); String A=sc.nextLine(); String[] B=A.split(" "); int D; switch(B.length) { case 1: D=0; mem[D]=B[0]; break; case 2: D=Integer.parseInt(B[1]); mem[D]=B[0]; break; default: main(null); break; } System.out.println(mem.length); } } And it gives me an error which is Exception in thread "main" java.lang.NullPointerException at test.main(test.java:16)
type: Question
has answer: http://stackoverflow.com/a/23036994
tagged with: java
has title: Saving a certain object in an array by user input
answer count: 1
tagged with: arrays

arraylist
tags question: http://stackoverflow.com/q/23020604
tags question: http://stackoverflow.com/q/23044965
tags question: http://stackoverflow.com/q/22979509
tags question: http://stackoverflow.com/q/22992440
tags question: http://stackoverflow.com/q/23088286
tags question: http://stackoverflow.com/q/22988859
tags question: http://stackoverflow.com/q/23029161
tags question: http://stackoverflow.com/q/23124576
tags question: http://stackoverflow.com/q/22989806
tags question: http://stackoverflow.com/q/23085410
tags question: http://stackoverflow.com/q/22972624
tags question: http://stackoverflow.com/q/22985634
tags question: http://stackoverflow.com/q/23025733
tags question: http://stackoverflow.com/q/23082075
tags question: http://stackoverflow.com/q/23092931
tags question: http://stackoverflow.com/q/23107181
tags question: http://stackoverflow.com/q/23093757
tags question: http://stackoverflow.com/q/23031572
tags question: http://stackoverflow.com/q/23075364
tags question: http://stackoverflow.com/q/23031886
tags question: http://stackoverflow.com/q/23036650
tags question: http://stackoverflow.com/q/23032851
tags question: http://stackoverflow.com/q/23040550
tags question: http://stackoverflow.com/q/23087795
tags question: http://stackoverflow.com/q/22972729
tags question: http://stackoverflow.com/q/22973112
tags question: http://stackoverflow.com/q/22985167
tags question: http://stackoverflow.com/q/23013685
tags question: http://stackoverflow.com/q/23046048
tags question: http://stackoverflow.com/q/23094244
tags question: http://stackoverflow.com/q/23016637
tags question: http://stackoverflow.com/q/23031349
tags question: http://stackoverflow.com/q/23024663
tags question: http://stackoverflow.com/q/23020328
tags question: http://stackoverflow.com/q/23068932
tags question: http://stackoverflow.com/q/23050343
tags question: http://stackoverflow.com/q/23091752
tags question: http://stackoverflow.com/q/23000615
tags question: http://stackoverflow.com/q/23063408
tags question: http://stackoverflow.com/q/23125740
tags question: http://stackoverflow.com/q/23036686
tags question: http://stackoverflow.com/q/23121718
tags question: http://stackoverflow.com/q/23097980
tags question: http://stackoverflow.com/q/22999482
tags question: http://stackoverflow.com/q/22992032
tags question: http://stackoverflow.com/q/23111566
tags question: http://stackoverflow.com/q/22978193
tags question: http://stackoverflow.com/q/23036278
tags question: http://stackoverflow.com/q/23095579
tags question: http://stackoverflow.com/q/22977272
tags question: http://stackoverflow.com/q/23113855
tags question: http://stackoverflow.com/q/22995619
tags question: http://stackoverflow.com/q/23073885
tags question: http://stackoverflow.com/q/23069208
tags question: http://stackoverflow.com/q/22968977
tags question: http://stackoverflow.com/q/22979956
tags question: http://stackoverflow.com/q/23084363
tags question: http://stackoverflow.com/q/23050936
tags question: http://stackoverflow.com/q/23016936
tags question: http://stackoverflow.com/q/23086658
tags question: http://stackoverflow.com/q/22969538
tags question: http://stackoverflow.com/q/23045088
tags question: http://stackoverflow.com/q/23103864
tags question: http://stackoverflow.com/q/23104778
tags question: http://stackoverflow.com/q/23045115
tags question: http://stackoverflow.com/q/23049603
tags question: http://stackoverflow.com/q/23038024
tags question: http://stackoverflow.com/q/23032121
tags question: http://stackoverflow.com/q/23003874
tags question: http://stackoverflow.com/q/23126615
tags question: http://stackoverflow.com/q/23102996
tags question: http://stackoverflow.com/q/23102736
tags question: http://stackoverflow.com/q/23072013
tags question: http://stackoverflow.com/q/23112915
tags question: http://stackoverflow.com/q/23024280
tags question: http://stackoverflow.com/q/23060774
tags question: http://stackoverflow.com/q/22977276
tags question: http://stackoverflow.com/q/23096881
tags question: http://stackoverflow.com/q/23103028
tags question: http://stackoverflow.com/q/23044159

http://stackoverflow.com/comment/52716210
has text: please let us know what is the solution of that problem, i am also facing same problem
comment on: http://stackoverflow.com/q/23071038
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23063965
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35244598
type: Question
has comment: http://stackoverflow.com/comment/35263247
has comment: http://stackoverflow.com/comment/35245322
tagged with: combobox
has title: Leading and trailing spaces must be detected in the names contained in the combobox
answer count: 0
score: 0
has body: Im new to Swings, so id like to know something. I have a table, and a Column name-CA1 which has a combobox. Now i want each item in the list of combobox to be according to this condition. Condition is: Leading and trailing spaces must be detected by '#' symbol. So I am trying to use a renderer for the combobox.... but since im new... im not able to figure out. The Combobox consists of a list of names... alphanumeric characters along with special characters.. So requirement is that the names, if they consist of spaces before or after it, it must be detected with '#' before or after it respectively.
tagged with: swing
tagged with: renderer
has comment: http://stackoverflow.com/comment/35263279
tagged with: java

http://stackoverflow.com/comment/35179615
score: 0
comment on: http://stackoverflow.com/a/23022773
has text: thanks man, I forgot to add the .next at the condition of the loops!
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23088062
answers question: http://stackoverflow.com/q/23086607
has comment: http://stackoverflow.com/comment/35289582
has body: You just need to use one of the unmarshal methods that take a Class parameter. public Student unMarshall(String input){ JAXBContext context; try { context = JAXBContext.newInstance(Student.class); Unmarshaller m = context.createUnmarshaller(); StreamSource source = new StreamSource(new StringReader(input)) return m.unmarshal(source, Student.class).getValue(); } catch (JAXBException e) { e.printStackTrace(); return null; } } For More Information You can find out more information about this use case in my blog: http://blog.bdoughan.com/2012/07/jaxb-no-annotations-required.html
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23086607

http://stackoverflow.com/comment/35202086
comment on: http://stackoverflow.com/q/23040661
type: QuestionComment
type: Comment
has text: What you should ask yourself is: what would be the purpose of `instanceof` if it evaluated to false in this scenario?
score: 0

http://stackoverflow.com/a/23025555
type: Answer
has body: This question is a bit too vague to be able to produce code as an answer, but essentially, if the problem is to ensure that method A of class B is called, with certain parameters, when you call method C of class D, then the usual thing to do is the following. Create a mock object of class B, that you're going to check the interaction on. Create a real object of class D, that you're actually going to test. Somehow inject your mock B into your real object D. This may be done via the constructor of D, in which case this step will be part of step 2. Call method C, passing whatever arguments are required. Verify that method A was called, with the right arguments on your mock object. If the return value of method A is important for the workings of class D, then it will work like this instead. Create a mock object of class B, that you're going to check the interaction on. Create a real object of class D, that you're actually going to test. Somehow inject your mock B into your real object D. This may be done via the constructor of D, in which case this step will be part of step 2. Stub method A, so that when it's called with the correct arguments, the appropriate return value is returned. Call method C, passing whatever arguments are required. Check the state of your object of class D, to ensure that the return value from A has had the correct effect on the state. If the state of D is not correct, then either D is not handling the return correctly, or method A was never called, or method A was called with the wrong arguments. In this second case, there is no need to verify the mock as well as stubbing it. The mocking purists will tell you that you should either stub, or verify, but never both. Now, looking at the code in your question, it doesn't seem to me that you've done any of the required steps. So this "test case" is not going to do anything much. Even if you think "it works", you haven't tested anything. As far as the use of Mockito is concerned, you would use a meth…
score: 0
answers question: http://stackoverflow.com/q/23020817

http://stackoverflow.com/a/22997585
score: 4
has body: I had the wrong column names in my Bulletin.hbm.xml file. When I corrected it, the problem was solved.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22976563
answers question: http://stackoverflow.com/q/22976563
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/22976762
tagged with: tomcat
score: 0
tagged with: rpc
has title: Error in Call RPC - GWT , 404 the server responded with a status of 404 (Not Found)
type: UnansweredQuestion
has body: I deploy my GWT app on a server, in dev mode, with eclipse. The RPC calls works fine, but after i deploy to a tomcat sever, i can't do the calls. Here is whats the console of the browser shows : Failed to load resource: the server responded with a status of 404 (Not Found) http://greenti.platon.com.br/war2/softheart/adminService Failed to load resource: the server responded with a status of 404 (Not Found) here is my web.xml: <?xml version="1.0" encoding="UTF-8"?> index.html adminService greenti.server.service.AdminServiceImpl adminService /softheart/adminService My class Service: @RemoteServiceRelativePath("adminService") public interface AdminService extends RemoteService{ ... } My .gwt.xml: <?xml version="1.0" encoding="UTF-8"?> <inherits name='com.google.gwt.user.User'/> <inherits name='com.google.gwt.user.theme.clean.Clean'/> <!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> --> <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> --> <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> --> <entry-point class='greenti.client.view.PanelMain'/> Any help would be appreciated
has answer: http://stackoverflow.com/a/22987650
tagged with: gwt
tagged with: java
has answer: http://stackoverflow.com/a/22977115
tagged with: eclipse
type: Question
answer count: 2

http://stackoverflow.com/a/22988120
downvote count: 0
answers question: http://stackoverflow.com/q/22987967
score: 1
has body: As far as I know (haven't messed with Swing in a couple of years...) the only key button events that can act upon a button are Tab which changes the element focus, Enter which fires the actionPerformed method and mnemonics, which also fire the actionPerformed. To handle events on button clicks, you could do something like so: button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //Execute when button is pressed } });
upvote count: 1
type: Answer

http://stackoverflow.com/comment/35238535
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22994163
has text: I have used poi in a few applications. I've encounters similar problems twice: First, usually when I accidentally use a local class (like lotus.local.domino.Database and lotus.domino.Database). The other time I encountered this (and the only time the package name was identical) was when I had poi in a plug-in that I had added to the build path and also had it installed by a poi extension library I had built. If you can't cast an object as itself, there is an issue with the ClassLoader, and I don't know what would cause that other than a class being listed twice.
score: 0

http://stackoverflow.com/a/23100156
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: Assuming you have a word list available somewhere, likely stored in a Trie data structure (I've created a working Trie with comments on improving its efficiency here). Once you have a Trie structure (a prefix tree) which allows you to search for words based on their prefixes, you would want to use a recursive method something like the following psudo-code. char[][] gameBoard = new char[4][4]; List&lt;String&gt; wordList = new ArrayList&lt;String&gt;(); //fill in the game board with characters //Start the word search at each letter for(int x = 0; x &lt; 4; x++){ for(int y = 0; y &lt; 4; y++){ recursiveWordSearch(x, y, ""); } } recursiveWordSearch(int x, int y, String word){ //Concatenate gameBoard[x][y] to word. //Check to see if word is a valid word (check against your word list). //If word, add to wordList /*Check word list to see if any words contain current prefix. If not, then there's no point in continuing further (return). IE if AQZ isn't the start of any word at all in the list, no reason to keep adding letters, it's never going to make a word. */ //Otherwise recursively call this method moving left/right/up/down recursiveWordSearch(x+1, y, word); //move right recursiveWordSearch(x, y+1, word); //move up recursiveWordSearch(x-1, y, word); //move left recursiveWordSearch(x, y-1, word); //move down /*You'll want to make sure that x-1, x+1, y-1 and y+1 are valid values before sending them. */ }
answers question: http://stackoverflow.com/q/23075689

http://stackoverflow.com/q/22981581
has answer: http://stackoverflow.com/a/22982991
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35137130
type: Question
has comment: http://stackoverflow.com/comment/35102340
tagged with: java
has body: I have a problem in implementing a Camel Route, where I call a URl and convert the JSON Response into Pojo. I use Camel-Jackson. Connection establishes with status 200. But I get at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:541) at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:644) at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:152) caused because of java.lang.StackOverflowError. Here is a sample code from("direct:start") .setHeader(Exchange.HTTP_METHOD, constant("GET")) .to("URL") .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { int responseCode = exchange.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class); System.out.println(exchange.getIn().getBody()); System.out.println(responseCode); } }) .marshal(cont) .process(new MyProcessor()) .end(); cont is the Jackson data format. I increased my heap memory to 1024 M. But still it's showing Stack overflow error. But the Json file is just 26 Kb. I used http://www.jsonschema2pojo.org/‎ site to create the Pojos for the json.
tagged with: http://stackoverflow.com/tag/json
tagged with: pojo
tagged with: apache-camel
answer count: 2
has comment: http://stackoverflow.com/comment/35097288
tagged with: jackson
has title: Java Out of heap, Stack Overflow error
score: 0
has answer: http://stackoverflow.com/a/23006358
has comment: http://stackoverflow.com/comment/35094652
has comment: http://stackoverflow.com/comment/35100816

http://stackoverflow.com/q/22984129
has comment: http://stackoverflow.com/comment/35123397
score: 12
answer count: 2
has comment: http://stackoverflow.com/comment/35144428
has comment: http://stackoverflow.com/comment/35147569
tagged with: junit
favorite count: 0
has answer: http://stackoverflow.com/a/27628978
has comment: http://stackoverflow.com/comment/35146774
has comment: http://stackoverflow.com/comment/35147994
has body: I'm writing a game over libgdx; I'm using the junit framework to simplify unit-testing my code. Now there's part of the code (a map generator, a class converting my own map format into TiledMap...) which I need to test thoroughly, but it uses libgdx code: from file handling to asset loading. I'm not planning to test the actual graphical output, or the game itself, in this way: but I want to test the single components (calculation, asset access...) to avoid blatant errors. I've tried to do something like this in the "setUpBeforeClass" method: LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); cfg.useGL20 = true; cfg.width = 480; cfg.height = 320; cfg.resizable = true; LwjglApplication app = new LwjglApplication( new TestApplicationListener(), cfg); And calling within tearDownAfterClass(): Gfx.app.exit() But it does create a window I do not need, and seems overkill when all I need is the file handling initialized. Is there a better way to initialize the libGDX components without creating an entire application object? Thanks. EDIT Going back over it (thanks to Sam in the comments), I realize GL access is needed (loading assets requires it), but this approach does not seem to work: the graphic library does not seem to be initialized. GDX documentation hasn't helped. Any clue?
possible better answer: http://stackoverflow.com/a/27628978
has answer: http://stackoverflow.com/a/24117864
accepted answer: http://stackoverflow.com/a/24117864
upvote count: 12
type: AnsweredQuestion
downvote count: 0
has title: Unit-testing of libgdx-using classes
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/35148069
type: Question
tagged with: libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/35144821
linked to: http://stackoverflow.com/q/32492526

http://stackoverflow.com/comment/35353720
comment on: http://stackoverflow.com/q/23124861
score: 0
has text: @anonymous Pardon my improper word usage. I know concepts better than terminology when it comes to Java.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35266605
comment on: http://stackoverflow.com/q/23075576
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Java HashMap not finding key, but it should](http://stackoverflow.com/questions/7565341/java-hashmap-not-finding-key-but-it-should)

http://stackoverflow.com/comment/35292274
type: Comment
comment on: http://stackoverflow.com/a/23067677
has text: How are you making sure here that after hitting the catch block, I can get out of that block after seeing the exception one time?
score: 0
type: AnswerComment

http://stackoverflow.com/q/23048171
type: Question
has title: Possible to specify Eclipse task tag colors by priority?
tagged with: eclipse
score: 6
has comment: http://stackoverflow.com/comment/35968757
has comment: http://stackoverflow.com/comment/35224675
has answer: http://stackoverflow.com/a/25579691
has comment: http://stackoverflow.com/comment/37561786
has comment: http://stackoverflow.com/comment/37554058
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/9296338
upvote count: 6
has body: This is specifically for the Eclipse IDE. I know it is possible to edit the color (and font, etc.) of task tags by going to: Preferences-&gt;Java-&gt;Editor-&gt;Syntax Coloring-&gt;Comments-&gt;Task Tags But what I'd like to do is define different colors for different task tag priorities. For example, TODO is Normal priority, and so should be blue in color; while FIXME is High priority, and so should be red in color. Is this possible? If so, how? Edit: This is in the Java editor itself.
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/22972447
downvote count: 0
has body: Why on earth would you do something like that anyway? Methinks either your design is wrong or you are leaving out some important information. If myMethod is in the same class as the attempted call, so that your caller is privy to information about how the method is implemented, you should create a private myMethodAux that returns the more specific type. You are probably still going to run into variance problems, however, as ClassAImpl&lt;ClassBImpl&gt; is not a subclass of AbstractClassA&lt;AbstractClassB&gt;. It is a subclass of AbstractClassA&lt;? extends AbstractClassB&gt;. Your comment above seems to indicate that you were not aware of this variance restriction on the subtyping relation in Java.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22971246
type: Answer

http://stackoverflow.com/comment/35179712
score: 0
has text: The errors in the project structure are : Module 'app': invalid item '<1.7>' in the dependencies list & Module 'app-build': invalid item '<1.7>' in the dependencies list Nothing changes with the change in the jdk version
comment on: http://stackoverflow.com/q/23027662
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23111029
has answer: http://stackoverflow.com/a/23113895
tagged with: validation
has body: I'm building a java tool to validate an xml document and build an html report containing the input data and validation results. I think that a possible way is: validate XML with XSD enrich the XML with validation results transform the enriched XML in the final HTML report (this point is not object of the question) First and foremost, is this a valid approach? Or there are more suitable ways to get those things done in java? If this is is a viable solution, how can i implement step 2? For example, if I start from this input document: How can I produce an enriched output document like that: id is correct type is correct id is NOT correct type is NOT correct
score: 0
answer count: 3
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24616117
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23111257
tagged with: xsd
tagged with: java
has title: Validate XML against XSD and enrich with validation results
type: Question

http://stackoverflow.com/comment/35197239
comment on: http://stackoverflow.com/a/23037510
type: AnswerComment
score: 0
type: Comment
has text: It would contain 0.8 plus a few critical fixes maybe; I don't know what that particular one is, but it is not the source of the error in your question. The problem is being compiled for Hadoop 1.

http://stackoverflow.com/a/22999031
has body: XML animations can be very powerful and still easy to read and modify. You can animate almost everything you desire: opacity, size, color, coordinates, rotation, apply animations simultaneously or separately, starting from now or after any delay--any way you can imagine. After you get skilled, you will be able to create custom animated views without using XML nor animation nor interpolator objects--just by you view's onDraw() method. Frame animations are also available--such in which you change images (drawables) quickly one by one. Android documentation how to create and create and use Animation and Interpolator objects and apply them to views will take some time to read and learn--but it is really worth it! http://developer.android.com/guide/topics/resources/animation-resource.html
accepted answer of: http://stackoverflow.com/q/22998698
answers question: http://stackoverflow.com/q/22998698
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/23023220
tagged with: eclipse
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35171409
has body: Last week I faced a problem of windows activation and my windows start slow down. After I solved that problem, windows run normally as before but I got Errors in Eclipse for developing android applications. Everything is OK in Eclipse and I'm using "ctrl+space" in Java Projects is fine, Autocomplete popup is shown and working properly. But, when I use "ctrl+space" in Android project, autocomplete popup show with several options and eclipse suddenly freeze for a couple of minutes(sometimes more than 3 or 4 minutes). After that I can choose the first option from the popup by hitting enter, but scroll down or choose another option, it's freeze again and wait for another several minutes. Here is my environment. Windows 7 (64bit) Eclipse Juno - build id - 20120614-1722 ADT 22.6.0.v201403010043 JDK-7u51 x64 Here is Eclipse.ini file. -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 512M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -startup D:\Android\Eclipse\eclipse\plugins\org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library D:\Android\Eclipse\eclipse\plugin\org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813 -vmargs -Dosgi.requiredJavaVersion=1.5 -Dhelp.lucene.tokenizer=standard -Xms1024m -Xmx1024m My problem is similar to Eclipse freezes on android related autocomplete eclipse freezes when "android.R.attr" is selected from autocomplete popup But I'm using the same Eclipse on my desktop and laptop. Laptop run normally on Android and working fine. The only problem is on my desktop. So, upgrading to another Eclipse is not the best option to solve (just my opinion). Because I've tried latest Eclipse (Juno), but problem still happened. I think, some program or file is mis…
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/23050396
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/23025584
downvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/14968580
accepted answer: http://stackoverflow.com/a/23050396
linked to: http://stackoverflow.com/q/6774485
tagged with: autocomplete
tagged with: java
linked to: http://stackoverflow.com/q/4304312
possible better answer: http://stackoverflow.com/a/23025584
has title: Eclipse freezes when using "ctrl+space" for Android autocomplete popup

http://stackoverflow.com/q/23095026
has title: java.lang.IllegalArgumentException: already added: Lorg/hamcrest/BaseDescription;
has answer: http://stackoverflow.com/a/23116649
type: UnansweredQuestion
tagged with: android
tagged with: maven
linked to: http://stackoverflow.com/q/12333238
tagged with: java
type: Question
has body: So I am aware of the page that describes the error in the simple case when you are including JUnit 4.10: java.lang.IllegalArgumentException: already added: Lorg/hamcrest/BaseDescription; Conversion to Dalvik format failed with error 1 Unfortunately, I am using a library that depends on JUnit: com.googlecode.json-simple:json-simple:jar:1.1.1 So I cannot add the exclusion. Here is the dependency tree: [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ androidapp --- [INFO] com.mycompany:androidapp:apk:0.1 [INFO] +- com.google.android:android:jar:2.3.3:provided [INFO] | +- commons-logging:commons-logging:jar:1.1.1:provided [INFO] | +- org.apache.httpcomponents:httpclient:jar:4.0.1:provided [INFO] | | \- org.apache.httpcomponents:httpcore:jar:4.0.1:provided [INFO] | +- org.khronos:opengl-api:jar:gl1.1-android-2.1_r1:provided [INFO] | +- xerces:xmlParserAPIs:jar:2.6.2:provided [INFO] | +- xpp3:xpp3:jar:1.1.4c:provided [INFO] | \- org.json:json:jar:20080701:provided [INFO] +- com.google.android:support-v4:jar:r7:compile [INFO] \- com.mycompany:api-client-java:jar:1.0:compile [INFO] +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile [INFO] | \- junit:junit:jar:4.10:compile [INFO] | \- org.hamcrest:hamcrest-core:jar:1.1:compile [INFO] +- commons-io:commons-io:jar:2.4:compile [INFO] +- commons-codec:commons-codec:jar:1.9:compile [INFO] +- org.slf4j:slf4j-api:jar:1.7.6:compile [INFO] +- ch.qos.logback:logback-core:jar:1.1.1:compile [INFO] \- ch.qos.logback:logback-classic:jar:1.1.1:compile Here is the maven error: [INFO] [INFO] UNEXPECTED TOP-LEVEL EXCEPTION: [INFO] java.lang.IllegalArgumentException: already added: Lorg/hamcrest/BaseDescription; [INFO] at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122) [INFO] at com.android.dx.dex.file.DexFile.add(DexFile.java:161) [INFO] at com.android.dx.command.dexer.Main.processClass(Main.java:685) [INFO] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634) [INFO] at com.android.d…
score: 0
answer count: 1

http://stackoverflow.com/q/23051569
tagged with: android
has comment: http://stackoverflow.com/comment/35221902
answer count: 0
has comment: http://stackoverflow.com/comment/35222023
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35221940
has comment: http://stackoverflow.com/comment/35221971
tagged with: java
has comment: http://stackoverflow.com/comment/35222028
has body: I wonder whether it is the Activity declaration in the source code down there cause the ImageView cannot find the R.id.productImgDisplay and this class is only the supporting class and the image is in productsListFragment class package com.example.mobile_e_commerce.dummy; import java.io.File; import java.io.FileInputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.ResourceBundle; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.PropertyInfo; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.util.Log; import android.view.View; import android.widget.ImageView; import com.example.mobile_e_commerce.ProductsListFragment; import com.example.mobile_e_commerce.R; /** * Helper class for providing sample content for user interfaces created by * Android template wizards. * &lt;p&gt; * TODO: Replace all uses of this class before publishing your app. */ public class ProductInfo extends AsyncTask&lt;Void,Void,Void&gt; { /** * An array of sample (dummy) items. */ private static final ResourceBundle rb = ResourceBundle.getBundle("com.example.mobile_e_commerce.webserviceurl"); private final static String NAMESPACE = rb.getString("WSDLTargetNamespace"); private final static String SoapURL = rb.getString("SoapAddress"); private final static String SOAP_ACTION = rb.getString("SoapAction"); private final static String METHOD_NAME = rb.getString("OperationName"); private final String SOAP_ACTION2 = rb.getString("SoapAction2"); private final String METHOD_NAME2 = rb.getString("OperationName2"); private final String SOAP_ACTION3 = rb.getString("SoapAction3"); private final String METHOD_NAME3 = rb.getString("OperationName3"); private final String SOAP_ACTION4 = rb…
type: Question
has title: Activity causes?(java.lang.nullPointerException)
has comment: http://stackoverflow.com/comment/35222008
has comment: http://stackoverflow.com/comment/35222066
has comment: http://stackoverflow.com/comment/35222044
score: 0
tagged with: nullpointerexception

http://stackoverflow.com/q/23028977
has body: Operand1 ShiftOperator Operand2 Shift Rule If either of the Operand is Negative don't forget to calculate its 2's complement since Negative integers is stored in Memory using 2's complement Mask Operand2 with 0x1F Right shift 81814621&gt;&gt;-12 = 78 81814621&gt;&gt;&gt;-12 = 78 OK!! Right shift (Operand1 is NEGATIVE) -81814621&gt;&gt;-12 = -79 -81814621&gt;&gt;&gt;-12 = 4017 Why different? Left shift 21&lt;&lt;-12 = 22020096 -21&lt;&lt;-12 = -22020096 Unlike Right shift no matter Operand1 is Positive/Negative only sign get changed instead value Thanks for all of your support! now i have a better idea on it...:)
tagged with: java
has answer: http://stackoverflow.com/a/23029051
tagged with: bitwise-operators
downvote count: 1
has answer: http://stackoverflow.com/a/23029063
has title: Java Bitwise shift operator with Negative Operands
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35181539
accepted answer: http://stackoverflow.com/a/23029063
score: 1
has comment: http://stackoverflow.com/comment/35184007
favorite count: 0
has comment: http://stackoverflow.com/comment/35188772
type: Question
linked to: http://stackoverflow.com/q/16763917
answer count: 2
has comment: http://stackoverflow.com/comment/35181198
has comment: http://stackoverflow.com/comment/35182110
tagged with: negative-number
possible better answer: http://stackoverflow.com/a/23029051
upvote count: 2

http://stackoverflow.com/comment/35195271
has text: How do i incorporate your suggestion into my code? Also do you know how to implement an interface?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23036220
type: AnswerComment

http://stackoverflow.com/comment/35256243
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23070135
has text: Did you debug your program to see what value `multiplier` is getting?
score: 0

http://stackoverflow.com/a/23387187
has body: It should work with "server key" as well as with "browser key " . But in some cases if any one of them is not working then you should try another one .See here
type: Answer
answers question: http://stackoverflow.com/q/23110138
score: 0

http://stackoverflow.com/comment/35296217
type: QuestionComment
comment on: http://stackoverflow.com/q/23092361
has text: It would be better if you show more of your code and show errors too.
score: 0
type: Comment

http://stackoverflow.com/q/23001696
has comment: http://stackoverflow.com/comment/35174181
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I'm trying to develop an application layout like that: * +------------------+--------+ * | | | * | | | * | | | * | 70% | 30% | * | | | * | | | * | | | * | | | * | | | * +------------------+--------+ To do this, I'm using MigLayout. According to this cheat sheet, to set the column weight we shold use [weight]. However, it isn't working somehow. Take a look at my code: package com.test; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.TitledBorder; import net.miginfocom.swing.MigLayout; public class MainWindow { private JFrame frame; private JTextField iterationsTextField; private JTextField populationSizeTextField; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MainWindow window = new MainWindow(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public MainWindow() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new MigLayout("", "[grow 70][grow 30]", "[grow]")); JPanel canvasPanel = new JPanel(); frame.getContentPane().add(canvasPanel, "cell 0 0,grow"); canvasPanel.setLayout(new MigLayout("", "[]", "[]")); JPanel settingsPanel = new JPanel(); settingsPanel.setBorder(new TitledBorder(null, "Settings", TitledBorder.LEADING, TitledBorder.TOP, null, null)); frame.getContentPane().add(settingsPanel, "cell 1 0,grow"); settingsPanel.setLayout(new MigLayout("", "[][grow]", "[][]")); JLabel iterationsLabel = new JLabel("Iterations"); settingsPanel.add(iterationsLabel, "cell 0 0,alignx trailing"); iterationsTextField = new JTextField(); iterationsTextField.setText("1000"); settingsPanel.add(iterationsTextField, "…
tagged with: swing
has comment: http://stackoverflow.com/comment/35139737
type: Question
tagged with: miglayout
has title: MigLayout column constraint
has comment: http://stackoverflow.com/comment/35131554
has comment: http://stackoverflow.com/comment/35131592
upvote count: 1
answer count: 1
tagged with: layout-manager
has answer: http://stackoverflow.com/a/23028022
accepted answer: http://stackoverflow.com/a/23028022
favorite count: 0

http://stackoverflow.com/comment/35132125
has text: `ExecutorService`s are just a simpler way to handle executing things asynchronously. What small difference are you looking for? In regards to what?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23002090

http://stackoverflow.com/comment/35094305
type: AnswerComment
type: Comment
score: 1
has text: I hope you have not asked this question to answer it, cos thats not encoraged here. else we are super cool
comment on: http://stackoverflow.com/a/22981362

http://stackoverflow.com/a/23013516
score: 6
accepted answer of: http://stackoverflow.com/q/23013471
has body: array[2] will be populated with the null char literal. The value of which is \u0000. char is a primitive type. This means that it can never hold null, so like int, double and the rest, it needs some starting value. For int it's 0, for char it's \u0000, which actually evaluates to 0. You can view the starting values for primitive types here.
answers question: http://stackoverflow.com/q/23013471
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/84094723
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/84098951

http://stackoverflow.com/comment/35134563
comment on: http://stackoverflow.com/a/23003186
score: 0
type: AnswerComment
type: Comment
has text: I added some description :)

http://stackoverflow.com/a/23095469
accepted answer of: http://stackoverflow.com/q/23095354
upvote count: 3
answers question: http://stackoverflow.com/q/23095354
has comment: http://stackoverflow.com/comment/35335000
score: 3
has body: You have to put the location of the .class files in the classpath. Even if you are in the same folder it won't find them if they are not in the classpath. That comes from DOS x .... anyone else. In DOS the OS looks first in the current folder. Everywhere else the OS looks first in the path (or classpath for Java). If Item is in the package com.example.Item and the class is in c:\users\test\myproj\target\com\example\Item.class then you must add c:\users\test\myproj\target\ to the classpath
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35336417
type: Answer

http://stackoverflow.com/comment/35081444
has text: Some question somewhat similar to this was once answered with a very smart suggestion of crossing the candidate address with google maps API.
comment on: http://stackoverflow.com/q/22973633
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/a/78800285
type: Answer
answers question: http://stackoverflow.com/q/23027315
score: 0
has body: Remember to restart the IDE(STS 4, Eclipse, Netbeans, IntelliJ, etc) after you added environment variable. Otherwise, the new variable won't be available for your application running on the current IDE. Restart IDE!

http://stackoverflow.com/q/23124777
type: Question
tagged with: arrays
accepted answer: http://stackoverflow.com/a/23124993
has comment: http://stackoverflow.com/comment/35353324
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/23124801
has answer: http://stackoverflow.com/a/23124801
has answer: http://stackoverflow.com/a/23124876
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23124993
has title: Java ArrayList - storing inputted integer into an array and printing it
tagged with: java
has comment: http://stackoverflow.com/comment/35353420
has comment: http://stackoverflow.com/comment/35353349
has body: Everything works except it's not giving me what I want. Where it says 'list.add(ln)', all it does is give me a boolean that says true. Is there any way to store what I wrote from the keyboard into the array then print it out? ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); ln = 1; // prime the loop while(ln != 0) { // begin while ln doesnt equal to zero System.out.println("\nFor list[" + n + "], enter a number."); ln = console.readInt(); if (ln != 0){ // begin if the input from keyboard does not equal to zero System.out.println("Array " + list.add(ln)); n++; // update array size } // end if the input from keyboard does not equal to zero else System.out.println(); } // end while ln doesnt equal to zero

http://stackoverflow.com/a/23121115
answers question: http://stackoverflow.com/q/23112985
type: Answer
has body: Problem was solved. it was trying to get files externally.
score: 0

http://stackoverflow.com/q/23057456
tagged with: java
has body: I've been a .NET web developer for several years now, working with asp.net web forms and c#, wcf etc.But recently developed touch enabled customer facing application. Its device-agnostic application designed for any platform capable of running HTML5 applications (iOS, Android, Windows8), for Mobile devices (such as tablets), Assisted or unassisted kiosks, Laptop or desktop computers. we used asp.net webapi, ASP.net MVC 4.0 framework, Jquery mobile libraries, HTML 5, signal R for development. Is it possible for us to migrate or convert complete server side code(i.e controllers methods) under Java? Does Apache tomcat server or (webspehere) supports verbs like PUT, DELETE inaddition to GET and POST? Any thing available in Java world which is equivalent ASP.NET SignalR functionality? what are the required softwares or libraries for developing device aganostic touch enabled applications in java? I think Web API objectively wins out over other APIs in below few key areas. Content negotiation, Flexibility, Separation of concerns How much extent Spring MVC API or Jersey API will support the above areas?
score: 17
upvote count: 18
linked to: http://stackoverflow.com/q/369301
type: Question
has answer: http://stackoverflow.com/a/47061427
has title: Is there an equivalent to ASP.NET WEB API in JAVA world?
linked to: http://stackoverflow.com/q/78811
answer count: 3
tagged with: asp.net
favorite count: 0
has answer: http://stackoverflow.com/a/23057929
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/31392215

teradata
type: Tag
tags question: http://stackoverflow.com/q/23115137
tag name: teradata
tags question: http://stackoverflow.com/q/22998749

http://stackoverflow.com/q/23036062
duplicate of: http://stackoverflow.com/q/13102045
accepted answer: http://stackoverflow.com/a/23036112
answer count: 1
has title: Can't use Scanner.nextInt() and Scanner.nextLine() together
favorite count: 0
tagged with: java.util.scanner
score: 14
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23036112
tagged with: java
downvote count: 1
type: Question
upvote count: 15
linked to: http://stackoverflow.com/q/13102045
has body: I have to get a string input and an integer input, but there order of input should be that integer comes first then user should be asked for string input Scanner in = new Scanner(System.in); input = in.nextLine(); k = in.nextInt(); in.close(); The above code works fine but if I take an integer input first like in the following code Scanner in = new Scanner(System.in); k = in.nextInt(); input = in.nextLine(); in.close(); then it throws the java.lang.ArrayIndexOutOfBoundsException. Here's the complete code of my source file: import java.util.Scanner; public class StringSwap { public static void main(String args[]) { String input; int k; Scanner in = new Scanner(System.in); k = in.nextInt(); input = in.nextLine(); in.close(); int noOfCh = noOfSwapCharacters(input); originalString(input, noOfCh, k); } public static int noOfSwapCharacters(String s) { char cS[] = s.toCharArray(); int i = 0, postCounter = 0; while (cS[i] != '\0') { if (cS[i] != '\0' &amp;&amp; cS[i + 1] != '\0') { cS[cS.length - 1 - postCounter] = '\0'; postCounter++; } i++; } return postCounter; } public static void originalString(String s, int noOfCh, int k) { int counter = 1, chCounter = 0; char cArray[] = s.toCharArray(); String post = ""; String pre = ""; String finalString = ""; char temp; for (int i = 1; i &lt;= k; i++) { chCounter = 0; counter = 1; post = ""; pre = ""; for (int j = 0; j &lt; cArray.length; j++) { if (counter % 2 == 0 &amp;&amp; chCounter &lt;= noOfCh) { temp = cArray[j]; post = temp + post; cArray[j] = '\0'; chCounter++; } counter++; } for (int h = 0; h &lt; cArray.length; h++) { if (cArray[h] != '\0') pre = pre + cArray[h]; } finalString = pre + post; for (int l = 0; l &lt; finalString.length(); l++) { cArray[l] = finalString.charAt(l); } } System.out.println(finalString); } } Kindly point out what I am doing wrong here.

http://stackoverflow.com/a/23012818
has body: You forgot to add body tag ,Try This : label1 = new JLabel(); label1.setText(" Welcome , Hussein ");
answers question: http://stackoverflow.com/q/23012795
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35151566

http://stackoverflow.com/comment/98150514
comment on: http://stackoverflow.com/a/23130406
type: AnswerComment
score: 0
has text: Thank you @Puce! I just needed the key part, so `myMap.entrySet().stream().filter(entry -> entry.getKey().contains("someName")).collect(Collectors.toList());` was enough
type: Comment

http://stackoverflow.com/q/23093757
tagged with: serialization
tagged with: arraylist
score: 0
has body: The title may be a little be confusing or even missleading but im trying to save to disk an object that as a property contains a list of objects (ArrayList). The thing is this object wont be able to do anything without the list. I have tried serialization of both the object and the list. When i tried serializing the object alone there was nothing in it, the list was empty. When i tried serializing the list i could access the list, change it but at the cost of many thrown exceptions. public class AdressBook implements Serializable { /** * */ private static final long serialVersionUID = 6399534374362987383L; static Reader reader = new KeyboardReader(); static ArrayList&lt;Contact&gt; AdressBook = new ArrayList&lt;Contact&gt;(); public AdressBook(){ } public static void AddContact(){ AdressBook.add(new Contact()); } public static void EditContact(){ System.out.println("Which contact you desire to edit?"); Libreta.Display(); System.out.println("Type in the number of the contact."); int i = (reader.readint() - 1); System.out.println("Choose the change 1.Name 2.Last Name 3.Nickname 4.Phone number 5.Emails"); int j = reader.readint(); switch(j){ case 1: AdressBook.get(i).setName(); break; case 2: AdressBook.get(i).setLastName(); break; case 3: AdressBook.get(i).setNick(); break; case 4: AdressBook.get(i).AddPhoneNumber(); break; case 5: AdressBook.get(i).AddEmail(); break; default : System.out.println("Not a valid option"); } I have to be able to edit the list of the object and being able to somehow save it again. I have been trying many ways but im lacking in knowledge or it just doesnt work for me.
linked to: http://stackoverflow.com/q/1387954
accepted answer: http://stackoverflow.com/a/23093976
tagged with: save
has title: Saving an object that contains a list of objects to the disk
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35298694
has answer: http://stackoverflow.com/a/23094056
answer count: 2
has answer: http://stackoverflow.com/a/23093976
tagged with: deserialization
possible better answer: http://stackoverflow.com/a/23094056
has comment: http://stackoverflow.com/comment/35298705

http://stackoverflow.com/a/23105754
type: Answer
accepted answer of: http://stackoverflow.com/q/23095908
answers question: http://stackoverflow.com/q/23095908
has comment: http://stackoverflow.com/comment/35320133
has comment: http://stackoverflow.com/comment/35324781
has body: Its working now!!! I have to explicitly mention the subfolder as a new resource folder. By default maven classpath will point to src/main/resources. If we want to have a property files and XML files in specific sub folder, it should be mentioned explicitly in the pom.xml as a separate "build" tag as follows. src/main/resources/config *.xml *.properties
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/35328960

http://stackoverflow.com/q/23117885
score: 0
answer count: 1
has body: I am sending an XML input to one of the external system and that doesnt have an XSD.Now to make this valid, does the external system (team) needs to define the XSD or do I need to come up with one? Assuming I need to create one, what is the right approach to do this in Java Can someone clarify please?
has answer: http://stackoverflow.com/a/23118043
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
has title: how to create valid XMLs
accepted answer: http://stackoverflow.com/a/23118043
type: Question

http://stackoverflow.com/a/22976543
type: Answer
has comment: http://stackoverflow.com/comment/35086163
has comment: http://stackoverflow.com/comment/35086208
has body: If you're trying to get a String, then all R.string.itemTag is to the compiler is an int. If you look in the R class, you will find something like the following... public static class string { public static int itemTag = 0x30000; } Along with all the other ids that you use. What you want to do is the following... getResources().getString(R.string.itemTag); You should also try cleaning your project by going to Project > Clean...
has comment: http://stackoverflow.com/comment/35086130
has comment: http://stackoverflow.com/comment/35086224
has comment: http://stackoverflow.com/comment/35086193
has comment: http://stackoverflow.com/comment/35086122
score: 0
answers question: http://stackoverflow.com/q/22976498

http://stackoverflow.com/a/23037033
downvote count: 0
has comment: http://stackoverflow.com/comment/35206563
has comment: http://stackoverflow.com/comment/35206943
has comment: http://stackoverflow.com/comment/35206841
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35206988
has comment: http://stackoverflow.com/comment/35207014
upvote count: 2
has comment: http://stackoverflow.com/comment/35206945
has comment: http://stackoverflow.com/comment/35207068
has comment: http://stackoverflow.com/comment/35207006
has comment: http://stackoverflow.com/comment/35207055
has comment: http://stackoverflow.com/comment/35206950
accepted answer of: http://stackoverflow.com/q/23035591
answers question: http://stackoverflow.com/q/23035591
has body: You need to provide a mousePressed also to get the initial point of the click. Then use that point to do some calculations. Try something like this, where pX and pY are class fields (and assuming listeners are added in the panel constructor addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent me) { // Get x,y and store them pX = me.getX(); pY = me.getY(); } }); addMouseMotionListener(new MouseMotionAdapter() { public void mouseDragged(MouseEvent me) { parent.setLocation(parent.getLocation().x + me.getX() - pX, parent.getLocation().y + me.getY() - pY); } }); Here's a full example import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.LineBorder; public class UndecoratedExample { private JFrame frame = new JFrame(); class MainPanel extends JPanel { public MainPanel() { setBackground(Color.gray); } @Override public Dimension getPreferredSize() { return new Dimension(400, 400); } } class BorderPanel extends JPanel { private JLabel label; int pX, pY; public BorderPanel() { label = new JLabel(" X "); label.setOpaque(true); label.setBackground(Color.RED); label.setForeground(Color.WHITE); setBackground(Color.black); setLayout(new FlowLayout(FlowLayout.RIGHT)); add(label); label.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { System.exit(0); } }); addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent me) { // Get x,y and store them pX = me.getX(); pY = me.getY(); } }); addMouseMotionListener(new MouseMotionAdapter() { public void mouseDragged(MouseEvent me) { frame.setLocation(frame.getLocation().x + me.getX() - pX, frame.getLocation().y + me.getY() - pY); } }); } } class OutsidePanel extends JPanel { public OutsidePanel() { setLayout(new BorderLayout()); add(new MainPanel(), BorderLayout.CENTER); add(new BorderPanel(), BorderLayout.PAGE_START); setBorder(new LineBorder(Color.BLACK, 5)); } } private void createAnsShowGui() { frame.setUndecorated(true); frame.add(new…
type: AcceptedAnswer

http://stackoverflow.com/q/23048245
type: UnansweredQuestion
upvote count: 4
answer count: 0
downvote count: 0
tagged with: ios
has body: I'm trying to run my libGDX app with roboVM. However, when I either try running it on the ios simulator or on a provisioned ios device, I get the following fatal error: [INFO] Building RoboVM app for: ios (thumbv7) [INFO] Compiling RoboVM app, this could take a while, especially the first time round # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x000000012d10221a, pid=243, tid=6403 # # JRE version: Java(TM) SE Runtime Environment (7.0_51-b13) (build 1.7.0_51-b13) # Java VM: Java HotSpot(TM) 64-Bit Server VM (24.51-b03 mixed mode bsd-amd64 compressed oops) # Problematic frame: # C [librobovm-llvm4029610622620581913.dylib+0x30b21a] _ZL16getCopyFromPartsRN4llvm12SelectionDAGENS_5SDLocEPKNS_7SDValueEjNS_3MVTENS_3EVTEPKNS_5ValueENS_3ISD8NodeTypeE+0x161a # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # An error report file with more information is saved as: # /Users/<user>/ /hs_err_pid243.log # # If you would like to submit a bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # Abort trap: 6 In case it's important, the error file with more information mentioned in the error is this. I'm using the robovm maven plugin, and am using this maven command: mvn clean integration-test -Pios My pom.xml looks like this: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 [parent groupid] [parent artifactid] [parent version] [artifactid] jar [Main Class] [core groupid] [core artifactid] ${project.version} com.badlogicgames.gdx gdx 1.0-SNAPSHOT com.badlogicgames.gdx gdx-backend-robovm 1.0-SNAPSHOT ../assets org.apache.maven.plugins maven-surefire-plugin 2.16 once -Djava.library.path=${project.build.directory}/natives/ org.robovm robovm-maven-plugin 0.0.11.1 ${mainClass} ios x86 iphone-sim integration-test iphon…
type: Question
tagged with: robovm
favorite count: 0
score: 4
has title: Fatal error when running roboVM with libGDX app
tagged with: maven
tagged with: libgdx
tagged with: java

http://stackoverflow.com/a/23085634
type: Answer
answers question: http://stackoverflow.com/q/23085245
has body: that because you have a duplicated library file. you may remove the duplicated library from your libs folder
has comment: http://stackoverflow.com/comment/35285105
score: 0
has comment: http://stackoverflow.com/comment/35283644
has comment: http://stackoverflow.com/comment/35285205
has comment: http://stackoverflow.com/comment/35285451

http://stackoverflow.com/comment/35306776
type: QuestionComment
comment on: http://stackoverflow.com/q/23098301
has text: Step 1) Attempt to accomplish this on your own. Step 2) Post a question about problems you encounter along the way.
score: 0
type: Comment

http://stackoverflow.com/comment/35316353
score: 0
has text: Did you give auto generated while creating table
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23104274

http://stackoverflow.com/comment/35080417
score: 0
type: Comment
type: QuestionComment
has text: You don't want an absolute path, but have you tried a relative path? Something like "../../resources/com.tester.stackoverflow/Testing.txt" should do the trick.
comment on: http://stackoverflow.com/q/22973135

http://stackoverflow.com/comment/35186760
has text: Its just job.waitForCompletion. The sample probably uses that. Have you looked at the source?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23031339
score: 1

http://stackoverflow.com/q/22988056
favorite count: 0
accepted answer: http://stackoverflow.com/a/22988478
type: Question
upvote count: 1
tagged with: spring
answer count: 1
tagged with: spring-mvc
has body: I have a question, how to save multiple identical entities from one form in Spring Controller? If I have the following code in html: ... BEGIN jsp foreach function ... ... END jsp foreach function ... In JSP listing can be till 50 entities. How to save its all in one request?
tagged with: java
has title: How to save multiple identical entities from one form in Spring Controller?
has answer: http://stackoverflow.com/a/22988478
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/35152862
type: QuestionComment
comment on: http://stackoverflow.com/q/23011934
has text: no stacktaces nothing just plain blank page
score: 0
type: Comment

http://stackoverflow.com/comment/35337736
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23094149
has text: I've a question. With relationship jpa, how I do create the ComboBox with values of relations ? Example relationship: ManyToOne ...Using JPAContainer
score: 0

http://stackoverflow.com/a/23037839
type: Answer
has body: The normal way to upload your APK to Google Play is as follows: Go to Eclipse and right click on your app root Select Android Tools -> Export Signed Application Package Save the APK in a different folder (I have a release folder) Upload the APK to google. For more details, you should have a look at [Google docs](http://developer.android.com/tools/publishing/app-signing.html"Information about signing and publishing APK") for publishing. You also will have to sign the package, hence you have to get a key.
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/35201321
downvote count: 1
has comment: http://stackoverflow.com/comment/35198408
answers question: http://stackoverflow.com/q/23037787

http://stackoverflow.com/comment/35165742
type: QuestionComment
has text: i have checked it... it is useUnicode=true or useUnicode=yes? I have read different things... so it should work with mysql 5.1?
comment on: http://stackoverflow.com/q/23019969
score: 0
type: Comment

http://stackoverflow.com/a/23064590
has body: Somewhere there is a directory or jar that holds that 'com' directory that is the root of your application's package structure (com/myCompany). That directory or jar needs to be added to the classpath through the -cp flag you are already using. So say as an example that the class is in: /workspaces/myproject/bin/com/myCompany/MyTests.class then you need to add the /workspaces/myproject/bin directory to the classpath.
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23064396
accepted answer of: http://stackoverflow.com/q/23064396
has comment: http://stackoverflow.com/comment/35245718
has comment: http://stackoverflow.com/comment/35270599
has comment: http://stackoverflow.com/comment/35246111

http://stackoverflow.com/comment/35277774
score: 0
type: QuestionComment
type: Comment
has text: You cannot safely create a `boolean` primitive array reflexively. You need a wrapper. See: [Using GSON to parse a JSON array](http://stackoverflow.com/questions/18421674/using-gson-to-parse-a-json-array)
comment on: http://stackoverflow.com/q/23082431

http://stackoverflow.com/comment/35300573
type: Comment
comment on: http://stackoverflow.com/q/23094602
score: 0
type: QuestionComment
has text: I tried to change the statement but I get a nullpointerexception.

http://stackoverflow.com/a/23038217
has comment: http://stackoverflow.com/comment/35198173
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35198115
has body: That's a lot of code. I'm not very clear on what you are asking about ArrayLists. In general this is how you put data in an ArrayList List&lt;String&gt; aList = new ArrayList&lt;String&gt;(); aList.add("Hello World"); If you are not familiar with generics and don't recognize the &lt;String&gt; part, you can just leave it off. The ArrayList a list will only have scope in the method or class you create it in. So if you declare it inside a method you can only add stuff to it / get stuff out of it in that method.
type: Answer
has comment: http://stackoverflow.com/comment/35198087
answers question: http://stackoverflow.com/q/23038024

http://stackoverflow.com/comment/35284840
type: AnswerComment
score: 0
type: Comment
has text: I see. I tried without the this and that complained that id can't be accessed in a static context.
comment on: http://stackoverflow.com/a/23085890

http://stackoverflow.com/q/23041691
tagged with: random
has body: For Java class I have to make a simple Guess the letter game, I wanted to set the letter to be random using a string, but for the class this needs to be a final variable. How do I do this? Also the word needs to be orange Text. Any ideas how I can achieve this? import java.util.Scanner; import java.awt.Color; import java.util.Random; public class PracTestRand{ public static void main(String[] args){ Random r = new Random(); String secret = ""; secret = (secret + (char) (r.nextInt(26) + 'a')); String stop = "go"; Scanner sc = new Scanner(System.in); System.out.print("Guess the secret letter!\n"); while (stop.equalsIgnoreCase("go")){ System.out.print("Enter a word ('stop' to end): "); String word = sc.nextLine(); if (word.contains(secret)){ System.out.println("That contains the secret letter!"); } else { System.out.println("Your word does not contain the secret letter!"); } if (word.equals(secret)){ System.out.println("You guessed the secret letter!\nThanks!"); stop = "stop"; } if (word.equals("stop")){ stop = "stop"; System.out.println("Thanks!"); } } }
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/23042129
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35204031
has title: How to change text color and final random variable?
tagged with: java
type: Question

http://stackoverflow.com/comment/35184340
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23030696
has text: If you are using same browser for simulating two users, It will be counted as one user based on sessionid cookie.
type: Comment

http://stackoverflow.com/q/22990348
has comment: http://stackoverflow.com/comment/35110953
tagged with: java
has answer: http://stackoverflow.com/a/23012294
has title: get word document count and number of slides count in PPT
has comment: http://stackoverflow.com/comment/35110496
tagged with: com
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35111432
has comment: http://stackoverflow.com/comment/35110477
has comment: http://stackoverflow.com/comment/35111503
has comment: http://stackoverflow.com/comment/35111522
has comment: http://stackoverflow.com/comment/35110692
has body: Is it possible to get the number of pages in word document or number of slides in a ppt? I have done a lot of research on it and I am desperately looking for solution. I saw that it is very difficult to get it done in PHP on linux server. I would be ok with Java also, but is it possible. I checked the apache POI library, but would it work for both ppt, pptx, doc and docx? I am rigorously searching for some solution but I am unable to get one. Any help would be really really appreciated.
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/35111049
has comment: http://stackoverflow.com/comment/35110840
accepted answer: http://stackoverflow.com/a/23012294
tagged with: php
has comment: http://stackoverflow.com/comment/35111360
linked to: http://stackoverflow.com/q/22834697
type: Question
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/23004062
type: Answer
has body: They are incompatible because your get methods are of type String and int, and you are asking these methods to return an array.
score: 0
answers question: http://stackoverflow.com/q/23003874

http://stackoverflow.com/comment/35346299
score: 0
has text: It looks like you're trying to reimplement Thread.join(), or CountDownLatch. Read their javadoc.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23120587

http://stackoverflow.com/comment/35268225
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23076173
type: Comment
has text: @Jackl56 Your code should ALWAYS depend on implementations, never on concrete classes. Otherwise you will end up having tightly coupled code that will not be testable. Take a look here: http://williamdurand.fr/2013/07/30/from-stupid-to-solid-code

http://stackoverflow.com/comment/35343702
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23091386
has text: Vince, it compiles fine on my machine and that is all the code I have so I don't know what you mean... Hovercraft, The problem I have is with the repaint method, I want it to update the graphic that I have but I'm not sure I've got everything in the right place. camickr, I'll change the JButton thing. And I have tried starting small and working up...just doing it wrong apparently :P
score: 0

http://stackoverflow.com/a/23090560
score: -1
has body: I think that your code is working the problem is that you are not seeing anything cause what you are writing are not understandable symbols. Change for (int i = 0; i &lt;=10; i++) { output.write(i); } for for (int i = 66; i &lt;=127; i++) { output.write(i); } and tell how it goes. I hope it helps
type: Answer
has comment: http://stackoverflow.com/comment/35292468
upvote count: 0
downvote count: 1
answers question: http://stackoverflow.com/q/23090263

http://stackoverflow.com/q/23122370
has body: I'm writing a program taken from the TV show, THE OFFICE, when they're sitting in the conference room and watching the bouncing DVD logo on the screen try to hit the corner. The square is supposed to change color when it hits an edge. However, I'm running into a few issues. Issue one: The Square sometimes bounces off an edge. Other times it sinks, and I can't figure out why. Issue two: I'm not sure how to change the color of the square when it hits the edge. Issue three: I'm trying to learn how to make a JFRAME fullscreen. And not just fullscreen on my screen but on anyone's. THE CODE HAS BEEN POSTED TO AN ONLINE IDE FOR EASIER READING. That can be found HERE Otherwise if you're too busy for that link. Here it is posted below. import java.util.Random; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class BouncingMischievousSquare extends JPanel implements ActionListener { private static final int SQUARE_SIZE = 40; private static final int SPEED_OF_SQUARE = 6; private int xPosit, yPosit; private int xSpeed, ySpeed; BouncingMischievousSquare(){ //speed direction xSpeed = SPEED_OF_SQUARE; ySpeed = -SPEED_OF_SQUARE; //a timer for repaint //http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html Timer timer = new Timer(100, this); timer.start(); } public void actionPerformed(ActionEvent e){ //Screensize int width = getWidth(); int height = getHeight(); xPosit += xSpeed; yPosit += ySpeed; //test xAxis if(xPosit &lt; 0){ xPosit = 0; xSpeed = SPEED_OF_SQUARE; } else if(xPosit &gt; width - SQUARE_SIZE){ xPosit = width - SQUARE_SIZE; xSpeed = -SPEED_OF_SQUARE; } if(yPosit &lt; 0){ yPosit = 0; ySpeed = SPEED_OF_SQUARE; } else if(yPosit &gt; height - SQUARE_SIZE){ xPosit = height - SQUARE_SIZE; xSpeed = -SPEED_OF_SQUARE; } //ask the computer gods to redraw the square repaint(); } public void paintComponent(Graphics g){ super.paintComponent(g); g.fillRect(xPosit, yPosit, SQUARE_SIZE, SQUARE_SIZE ); } } MAIN CLASS import javax.swing.*; public class…
tagged with: jtable
has answer: http://stackoverflow.com/a/23122460
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: jframe
has title: Bouncing Cube Program from The Office
accepted answer: http://stackoverflow.com/a/23122460
tagged with: java
upvote count: 1
tagged with: swing
answer count: 1
tagged with: jpanel

http://stackoverflow.com/comment/35382118
type: Comment
comment on: http://stackoverflow.com/a/23117955
score: 0
type: AnswerComment
has text: Hi Angelo, Could it be something with spring version 3.0.7 as previously it was working with spring 3.1.1. But as now I am converting the project into maven so there was some conflict with spring 3.1.1 and spring security so I have to downgrade my spring version

http://stackoverflow.com/comment/35277215
has text: It depends a bit on how the controller is installed. Is it a USB HID device? or some closed protocol? Are you using windows/macos/linux? And why do you don't want to use JInput?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23081485

http://stackoverflow.com/comment/35120955
type: Comment
has text: @natez0r :) now we're getting somewhere - i'm now getting "Google Play services is not supported by your device..." I guess it now has to do with my emulator
score: 0
comment on: http://stackoverflow.com/q/22995106
type: QuestionComment

http://stackoverflow.com/q/23013892
has title: X509CertificateHolder VerifyError
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35155103
score: 0
has body: Why is this very simple code throwing java.lang.VerifyError on Android? It works perfectly fine on desktop. Security.addProvider(new BouncyCastleProvider()); X509Certificate intermediateCa = loadCert(); new X509CertificateHolder(intermediateCa.getEncoded()); I tried different Android versions. If it makes any difference, this is the code I use to read the certificate (I tried also reading from PKCS12 KeyStore). I used the same certificate for tests on Android and desktop machines. CertificateFactory factory = CertificateFactory.getInstance("X.509", "BC"); InputStream is = mRes.openRawResource(R.raw.sign_cert); X509Certificate intermediateCa = (X509Certificate) factory.generateCertificate(is); is.close();
has comment: http://stackoverflow.com/comment/35154548
tagged with: bouncycastle
type: UnansweredQuestion
tagged with: android
tagged with: x509certificate

http://stackoverflow.com/a/22993067
has body: public static void main(String[] args) { playerGUI GUI = new playerGUI(); GUI.Frame.setVisible(true); Client newclient = new Client(GUI); }
score: 0
has comment: http://stackoverflow.com/comment/35116727
answers question: http://stackoverflow.com/q/22993009
type: Answer
has comment: http://stackoverflow.com/comment/35116657

http://stackoverflow.com/a/23045692
has body: You want to use a selector as the background for the button. Basically you can define the the different shape you want for each state of the button and the shape consists of color, corner radius, and other cool things. XML file saved at res/drawable/button.xml: <?xml version="1.0" encoding="utf-8"?> <solid android:color="@color/blue" /> <solid android:color="@color/red" /> This layout XML applies the state list drawable to a Button:
has comment: http://stackoverflow.com/comment/35211104
answers question: http://stackoverflow.com/q/23045626
score: 0
type: Answer

http://stackoverflow.com/a/23050047
upvote count: 1
answers question: http://stackoverflow.com/q/23049832
score: 1
downvote count: 0
has body: At the end of the makeDeductions (int age, double amount) method you have this: } } - error That first } closes the method body, and the following } closes the class body, so that leaves you with a - error outside class body, illegal syntax in Java. Also, there's a while after that, also illegal outside method body (and of course illegal outside class body) If you delete both of those lines (numbers 100 and 101, copypasting your code) that problem is resolved (though that - error probably does something, even if I can't figure out what, so be careful when deleting it). But there's one more: In what now would be part of the makeDeductions (int age, double amount) method body you now have references to variable accountNumber which is declared in the main(String[] args) method and thus doesn't exist in this context You call for calcSenior() when that overload doesn't exist, the only one you have declared is calcSenior (double amt, double intest) (notice the two parameters) Same for calcTax(), you have only declared calcTax(double amot, double inc) And yet the same for makeDeductions (), with only makeDeductions (int age, double amount) having been declared. Careful here though, remember that I'm asuming you deleted those likes I specified at the beginning, so this code is INSIDE THE makeDeductions (int age, double amount) BODY, meaning that if you call makeDeductions with int and double parameters, you are in fact calling this very method, which can cause an infinite loop if you don't have a stopping condition to avoid the method to call itself infinitely (causing a stack overflow) And that's all I could find. I hope this is useful to you :)
type: Answer

http://stackoverflow.com/comment/35359705
comment on: http://stackoverflow.com/q/23126587
score: 0
type: Comment
type: QuestionComment
has text: Action and result code are fine. Are you sure the file is not 0 bytes inside the action ? Can you print `bos.toByteArray().length` before quitting the method ?

http://stackoverflow.com/q/23003452
tagged with: java
type: Question
tagged with: bytebuffer
has answer: http://stackoverflow.com/a/23003488
score: 0
tagged with: filechannel
answer count: 2
has title: End of file using ByteBuffer and FileChannel
type: UnansweredQuestion
has body: I write a small code, say ByteBuffer buffer = ByteBuffer.allocate(10); int w= fc.read(buffer); System.out.println(w); w= fc.read(buffer); System.out.println(w); w= fc.read(buffer); System.out.println(w); say the file contains 10 bytes, the result appeared on the screen is 10, 0, 0, but no -1 appers as the end of the file, why?
has answer: http://stackoverflow.com/a/23003593

http://stackoverflow.com/comment/35359661
has text: How about restarting PC ?
comment on: http://stackoverflow.com/q/23128411
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23039744
has answer: http://stackoverflow.com/a/23302682
downvote count: 1
accepted answer: http://stackoverflow.com/a/23039863
type: Question
linked to: http://stackoverflow.com/q/2784514
tagged with: sorting
has comment: http://stackoverflow.com/comment/35200788
upvote count: 4
tagged with: arraylist
has title: How to sort an arraylist of objects?
has comment: http://stackoverflow.com/comment/35673090
has answer: http://stackoverflow.com/a/23039790
favorite count: 0
has comment: http://stackoverflow.com/comment/35200747
has answer: http://stackoverflow.com/a/23039863
has body: I have a class public class SMS { public String addr; public String body; public String type; public String timestamp; } Now I have made an arrayList of objects ArrayList&lt;SMS&gt; temp = new ArrayList&lt;SMS&gt;(); I have added the values. Now I want to sort the arrayList with respect to the timestamp. How do I sort the arrayList in ascending/descending order with respect to the timestamp?
answer count: 4
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/35200699
possible better answer: http://stackoverflow.com/a/23039753
has comment: http://stackoverflow.com/comment/35200713
tagged with: java
has answer: http://stackoverflow.com/a/23039753

http://stackoverflow.com/comment/35217487
comment on: http://stackoverflow.com/q/23049088
type: Comment
score: 1
has text: What is your question?
type: QuestionComment

http://stackoverflow.com/a/23007867
score: 0
type: Answer
has body: Thanks to @ajb's quick response and a good night's (... well, a few hours') sleep, I got exactly what I wanted. The fix wasn't quite as simple as changing Scanner sca to a, but it was exactly the problem that I failed to notice. And I failed to notice it because of sloppy coding. I had too many global variables, especially sca and scb. Had they been local to main, I'd've caught the problem last night. Here's the method that calls itself. The '--------------------' lines are the changes relative to the error in logic that ajb pointed out. private static int read_untilGE_(Scanner a, String sa, long ma, Scanner b, String sb, long mb){ String indent; boolean shouldPrint; if (ma == mapa){indent = inda; shouldPrint = showa;} else {indent = indb; shouldPrint = showb;} if(shouldPrint) System.out.println(indent + sa); // -------------------- while(a.hasNext()){ // -------------------- sa = a.next(); // -------------------- if(sa.equals(sb)) return 0; // a = b if(sa.compareTo(sb) &gt; 0) break; // a &gt; b if(shouldPrint) System.out.println(indent + sa); } read_untilGE_(b, sb, mb, a, sa, ma); return 0; } And here's the rest of the program: package filecomparison; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Scanner; public class BinaryCompare { static long mapa, mapb; static String inda, indb; static Boolean showa = true, showb = true; private static void drain(String msg, Scanner sc){ int k = 0; System.out.println("\n\nDraining " + msg); String s; while(sc.hasNext()){ s = sc.next(); System.out.println(s); ++k; } System.out.println("\nExtras at end: " + k); } public static void main(String[] args) throws IOException { Scanner sca, scb; String reca, recb; Path a = Paths.get("C:\\newdic.txt"); Path b = Paths.get("C:\\WordHelp.dick"); sca = new Scanner(a); scb = new Scanner(b); mapa = a.hashCode( ); mapb = b.hashCode(); inda = ""; indb = "\t\t\t"; System.out.println("Extra words in:\n" + inda + " " + a + "\n" + indb + b ); w…
has comment: http://stackoverflow.com/comment/35142234
answers question: http://stackoverflow.com/q/22999931

http://stackoverflow.com/q/23098668
tagged with: java
downvote count: 1
type: Question
score: -1
has title: Error Message when compiling
has answer: http://stackoverflow.com/a/23098750
answer count: 2
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23100059
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35307442
has comment: http://stackoverflow.com/comment/35307454
has body: import java.util.*; import java.lang.*; import java.io.*; import java.util.Scanner; import java.lang.String; public class ProgramData8 { public static void main(String[] args)throws IOException { StackClass stack = new StackClass(); QueueClass queue = new QueueClass(); IntElement x = new IntElement(0); int num; StringTokenizer tokenizer; BufferedReader keyboard = new BufferedReader (new InputStreamReader(System.in)); System.out.print("Please enter the numbers."); tokenizer = new StringTokenizer(keyboard.readLine()); stack.push(x); queue.addQueue(x); num = Integer.parseInt(tokenizer.nextToken()); while(num != -999) { x.setNum(num); switch(num%4) { case 0: stack.push(x); break; case 1: if(!stack.isEmptyStack()) { System.out.println("Stack Element = " + stack.top()); stack.pop(); } else System.out.println("Sorry, the stack is empty."); break; case 2: queue.addQueue(x); break; case 3: if(!queue.isEmptyQueue()) { System.out.println("Queue Element = " + queue.front()); queue.deleteQueue(); } else System.out.println("Sorry, the queue is empty."); break; } num = Integer.parseInt(tokenizer.nextToken()); } System.out.println("Stack Elements: " ); while(!stack.isEmptyStack()) { System.out.print(stack.top() + " " ); stack.pop(); } System.out.println(); System.out.print("Queue Elements: " ); while(!queue.isEmptyQueue()) { System.out.print(queue.front() + " " ); queue.deleteQueue(); } System.out.println(); } } I keep getting the following errors. ProgramData8.java:13: error: cannot find symbol StackClass stack = new StackClass(); ^ symbol: class StackClass location: class ProgramData8 ProgramData8.java:13: error: cannot find symbol StackClass stack = new StackClass(); ^ symbol: class StackClass location: class ProgramData8 ProgramData8.java:14: error: cannot find symbol QueueClass queue = new QueueClass(); ^ symbol: class QueueClass location: class ProgramData8 ProgramData8.java:14: error: cannot find symbol QueueClass queue = new QueueClass(); ^ symbol: class QueueClass location…
has comment: http://stackoverflow.com/comment/35307455

http://stackoverflow.com/a/23089260
type: Answer
has body: One thing to keep in mind with recursion is that it creates multiple copies of the parameters and local variables. Suppose your main calls sampleFunction(4). Then sampleFunction(4) calls sampleFunction(3), which calls sampleFunction(2), which calls sampleFunction(1), which calls sampleFunction(0). At that point, there are 5 versions of sampleFunction on the stack, that are all active at the same time; and each one has its own size parameter. Also, if you had a local variable: public void sampleFunction(int size) { int x = size * 100; ... } each of the 5 versions would also have its own x variable. So the five methods that are now all active look something like this: sampleFunction(4) size=4 x=400 calls: sampleFunction(3) size=3 x=300 which calls: sampleFunction(2) size=2 x=200 which calls: sampleFunction(1) size=1 x=100 which calls: sampleFunction(0) size=0 x=0 There are now five sizes, and five xs, in your program. This should help you see why if, say, sampleFunction(0) changes size or x, that only affects its own size or x; it doesn't touch any of the others. Also, when sampleFunction(4) calls sampleFunction(3), the effect is that a new size variable (parameter) is created whose value is 3, but this does not affect sampleFunction(4)'s size at all--its value will be 4. And if sampleFunction(4) doesn't do anything to assign to size, its own size will be 4 forever, which is why you're getting an infinite loop. This applies to variables whose type is a primitive type, like int, and also to variables whose type is a reference to an object. But note that it doesn't apply to objects themselves. If you have a recursive method like: public void recursiveMethod(MyClass c, int n) { ... recursiveMethod(c, n-1); ... } then if there are five recursiveMethod's on the stack, there will be five different c parameters, but they will all refer to the same object, unless one of the recursiveMethod methods reassigns its own c to something else.
answers question: http://stackoverflow.com/q/23087889
score: 0

http://stackoverflow.com/comment/98022430
type: Comment
has text: I had this issue with micronaut when I forgot to change `packages-to-scan` in my `application.yml` config file.
comment on: http://stackoverflow.com/a/50440869
score: 0
type: AnswerComment

http://stackoverflow.com/q/23118048
score: 1
upvote count: 1
has title: Topology awareness of Cassandra Drivers in php, java, python, node.js
has body: I'm just being curious. Are Cassandra drivers aware of the topology? Meaning that the driver knows which rack is the closest one and which node is most likely to hold the data and has a low latency to reduce response time of requests? Or is every driver aware of this? Which libraries would you recommend? I really appreciate your help.
type: Question
has comment: http://stackoverflow.com/comment/35671075
has comment: http://stackoverflow.com/comment/35343136
tagged with: java
has answer: http://stackoverflow.com/a/23120161
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23120161
favorite count: 0
tagged with: cassandra
has comment: http://stackoverflow.com/comment/35343012
tagged with: python
tagged with: php
tagged with: node.js
type: AnsweredQuestion

http://stackoverflow.com/q/23029966
type: UnansweredQuestion
tagged with: java
has title: How to check List contains the particular element null or not in Struts 2 using <s:if> Tags?
type: Question
tagged with: ognl
tagged with: jsp
tagged with: struts2
score: 0
has answer: http://stackoverflow.com/a/23030249
upvote count: 1
has body: I have an action in Struts 2, I want to test whether email ID is empty or null using &lt;s:if&gt; test condition in JSP. class EmailAction extends ActionSupport { private ArrayList&lt;Email&gt; emailList; //setter and getters } class Email { private String username; Private String password; private String emailId; //getters and setters }
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/q/23107050
has comment: http://stackoverflow.com/comment/35322466
has comment: http://stackoverflow.com/comment/35320940
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35320889
has comment: http://stackoverflow.com/comment/35322578
has comment: http://stackoverflow.com/comment/35321036
upvote count: 1
has comment: http://stackoverflow.com/comment/35321227
has comment: http://stackoverflow.com/comment/35321311
type: Question
has comment: http://stackoverflow.com/comment/35321359
has comment: http://stackoverflow.com/comment/35321595
has body: This is the sample code public class HelloWorldBuilder extends Builder { private final String name; private final List<Object> logCollection = new ArrayList<Object>(); // Fields in config.jelly must match the parameter names in the "DataBoundConstructor" @DataBoundConstructor public HelloWorldBuilder(String name) { this.name = name; } /** * We'll use this from the config.jelly . */ public String getName() { return name; } @Override public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) { listener.getLogger().println("These are items in the collection!"); String value = "Logging" + name + "(" + new Date() + ")"; listener.getLogger().println(value); this.logCollection.add(value); for(Iterator<Object> i = this.logCollection.iterator(); i.hasNext(); ) { Object item = i.next(); listener.getLogger().println(item); } return true; } ... } Below is the error I got from Jenkins. FATAL: null java.lang.NullPointerException at demo.cd.statlogger.HelloWorldBuilder.perform(HelloWorldBuilder.java:71) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785) at hudson.model.Build$BuildExecution.build(Build.java:199) at hudson.model.Build$BuildExecution.doRun(Build.java:160) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:566) at hudson.model.Run.execute(Run.java:1665) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:246) I don't understand why logCollection can be null since it's initialized. Update Line 71 is this.logCollection.add(value);
has comment: http://stackoverflow.com/comment/35321139
has comment: http://stackoverflow.com/comment/35320797
has comment: http://stackoverflow.com/comment/35321363
has comment: http://stackoverflow.com/comment/35320844
has comment: http://stackoverflow.com/comment/35322682
has comment: http://stackoverflow.com/comment/35322082
downvote count: 0
tagged with: generics
has comment: http://stackoverflow.com/comment/35322201
has comment: http://stackoverflow.com/comment/35322085
favorite count: 0
has title: Jenkins Bulder plugin: final List<String> is null after initialization
has comment: http://stackoverflow.com/comment/35322998
has comment: http://stackoverflow.com/comment/35321079
tagged with: jenkins
has comment: http://stackoverflow.com/comment/35320683
has comment: http://stackoverflow.com/comment/35321109
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35321169
has comment: http://stackoverflow.com/comment/35320997
has comment: http://stackoverflow.com/comment/35321164

http://stackoverflow.com/a/22987033
type: Answer
answers question: http://stackoverflow.com/q/22977931
has comment: http://stackoverflow.com/comment/35118837
has comment: http://stackoverflow.com/comment/35109649
has body: You have to add mysql jar to the lib directory in your solr home folder. Once you do that it will work.
score: 0
has comment: http://stackoverflow.com/comment/35131682

http://stackoverflow.com/q/23121860
answer count: 1
tagged with: directory
has comment: http://stackoverflow.com/comment/35349574
has body: I'm trying to get the current user directory, where all of the users on the computer are saved, so I can save some details to this folder so it will apply to the whole computer instead of just the user area of the current user. For example System.getProperty("user.home") returns C:\Users\CURRENT_USER How can I get the "C:\Users" Probably using substring or something using the index of the last slash? But help would be appreciated, can't seem to get it
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23121923
tagged with: java
has title: How can I get the user directory of a computer in Java? Not the current working directory
type: Question
accepted answer: http://stackoverflow.com/a/23121923
score: 0

http://stackoverflow.com/q/23046087
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35267208
type: Question
has comment: http://stackoverflow.com/comment/35260018
has title: How to create an ImageButton in java and pass in a picture for it
has body: I am trying to create an ImageButton in the java based off of user interaction, but when I pass in null it quits the application. ImageButton ib = new ImageButton(null); How can I create an ImageButton in the java. I know how to do it in xml, but want to add x amount of buttons.
upvote count: 1
tagged with: imagebutton
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35212086
answer count: 0

http://stackoverflow.com/comment/35284004
has text: @user14900 If your `Grid` class has a getter for the backing array, substitute that for `getArray()`. If it doesn't , you need to tell use how you access elements of the grid.
comment on: http://stackoverflow.com/a/23085797
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35116844
type: Comment
type: QuestionComment
has text: Formatted .... again.
comment on: http://stackoverflow.com/q/22993657
score: 0

http://stackoverflow.com/comment/35206933
type: AnswerComment
has text: You're welcome, I just added that part.
type: Comment
comment on: http://stackoverflow.com/a/23043480
score: 0

http://stackoverflow.com/comment/35350239
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23122991
type: Comment
has text: Use `instanceof` sure, but maybe not _instead of_ `isSomeType()`. If `isSomeType()` contains important business logic, it is entirely appropriate to have it in `equals()`. Your example is correct.

http://stackoverflow.com/a/23057939
answers question: http://stackoverflow.com/q/23057813
has body: You have incorrect syntax. Try something like this: public class DERstring{ public enum Fertigkeit { UEBER("Überreden"), HEIML("Heimlichkeit"), SUCHE("Suchen"); private String name; private Fertigkeit(String name){ this.name=name; } public String getName() { return name; } } .....other enums classes... }
accepted answer of: http://stackoverflow.com/q/23057813
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/23041998
type: Answer
answers question: http://stackoverflow.com/q/23041904
has comment: http://stackoverflow.com/comment/35204112
score: 0
has body: Wait, if you read a file in this format: A B C D E F Why not just read it and save in the same time? Something like: BufferedReader bufferedReader = new BufferedReader(new FileReader("test.txt")); List&lt;String&gt; lines = new ArrayList&lt;String&gt;(); for (String line; (line = bufferedReader.readLine()) != null; ) { lines.add(line); } System.out.println(lines); And you will have [A, B, C, D, E, F, G] in your lines List.
has comment: http://stackoverflow.com/comment/35204128

http://stackoverflow.com/a/23034357
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23034202
answers question: http://stackoverflow.com/q/23034202
type: Answer
has body: Your code is correct. But, keep in mind that rollover is not enabled by default. So, you have to do this first: button.setRolloverEnabled(true);

http://stackoverflow.com/q/23017557
has comment: http://stackoverflow.com/comment/35160785
score: 4
has comment: http://stackoverflow.com/comment/35160835
accepted answer: http://stackoverflow.com/a/23017727
has answer: http://stackoverflow.com/a/23017837
linked to: http://stackoverflow.com/q/37628
downvote count: 1
has comment: http://stackoverflow.com/comment/35160213
linked to: http://stackoverflow.com/q/924394
favorite count: 0
has answer: http://stackoverflow.com/a/23017727
upvote count: 5
has answer: http://stackoverflow.com/a/23017743
has comment: http://stackoverflow.com/comment/35160929
has comment: http://stackoverflow.com/comment/35160326
has comment: http://stackoverflow.com/comment/35160323
answer count: 4
has title: How to get class name of any java file
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35160892
tagged with: java
has answer: http://stackoverflow.com/a/40488118
has body: Does java offer a simple way to do this? I know how to get this using Foo.class.getName()) But how would I be able to do this for any object I may be passing in through some method? Say public String getClass(File file){ // Get file class } Where file is some java file with a .java extension. I know it works if I directly hard code the name of the java class into Foo.class.getName(), but my approach at this includes java files not found in the current directory or package. Anyone guide me in the right direction? Thanks in advance.
type: Question
possible better answer: http://stackoverflow.com/a/40488118
has comment: http://stackoverflow.com/comment/35161013

http://stackoverflow.com/comment/64571040
score: 0
type: AnswerComment
has text: Wow, this is a coding challenge I wrote for hiring, randomly chosen names and all (Mahesh was my favourite Maths teacher in high school). I just used this again and got a bunch of near-identical solutions, googled some of the code, and found this. Yes, this is a great algorithm you've described here, up-vote for that :). That's the end of the road for this challenge!
type: Comment
comment on: http://stackoverflow.com/a/23010486

http://stackoverflow.com/comment/35086982
type: Comment
comment on: http://stackoverflow.com/q/22976087
score: 0
type: QuestionComment
has text: I have already defined the Parser (`org.hl7.fhir.instance.formats.JsonParser`) in my question which I am using. This question is specific to FHIR (Hl7) Standards. I have the data objects ready but the HL7 specific JSON parsor is not mapping it with the defined set. I Request you to please answer or provide comments only if you have worked in this technology and just do not answer for sake of answering. Obviously, I had a valid JSON string which I am trying to parse. This is not my first time with JSON.

http://stackoverflow.com/comment/35331953
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22985846
has text: @CodeChimp Just found out that the URL from where i was reading the document isnt opening. So, i'll try with another URL.

http://stackoverflow.com/comment/35169401
score: 0
type: Comment
has text: Thank you, got exactly what I wanted. Appreciate your help @Oya
type: AnswerComment
comment on: http://stackoverflow.com/a/23008167

http://stackoverflow.com/q/23033916
has comment: http://stackoverflow.com/comment/35215235
score: 0
has comment: http://stackoverflow.com/comment/35190083
tagged with: polymorphism
linked to: http://stackoverflow.com/q/1396166
favorite count: 0
has title: Java Refactoring - Replace Conditional with Polymorphism
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/38613466
has body: I made some research about refactoring my college code. I used JDeodorant plugin for Eclipse and it throws me away, that something like that: if (object instanceof Class1) { do_something1(); } else if (object instanceof Class2) { do_something2(); } else if (object instanceof Class3) { do_something3(); } should be replaced by Polymorphism. Everything will be fine, except that all methods do_something() refer to operations not related with object. So for me polymorphism will not work. Is there any other way to avoid using instanceof , which seems to be unprofessional. Thank You very much.
has comment: http://stackoverflow.com/comment/35190282
tagged with: refactoring
tagged with: java
has comment: http://stackoverflow.com/comment/35191723
has comment: http://stackoverflow.com/comment/35197318
downvote count: 1
type: Question

http://stackoverflow.com/q/22988792
linked to: http://stackoverflow.com/q/177506
score: 0
has comment: http://stackoverflow.com/comment/35107550
has comment: http://stackoverflow.com/comment/35107854
has body: There's a great discussion on SO about why floating-point should not be used for currency operations and a lovely example is given here from Bloch's Effective Java. I was playing around with this and noticed something weird. If the numbers are doubles: System.out.println(1.03d - .42d); //prints out 0.6100000000000001. But, if the numbers are floats: System.out.println(1.03f - .42f); //prints out 0.61. Why does this not fail in the same way for floats also? Both types are susceptible to the same problem, but what causes the difference in behaviour?
has title: Why does this precision fail example show up with doubles but not with floats?
linked to: http://stackoverflow.com/q/3730019
has comment: http://stackoverflow.com/comment/35107484
accepted answer: http://stackoverflow.com/a/22989016
tagged with: double
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35107725
has comment: http://stackoverflow.com/comment/35107552
tagged with: java
tagged with: floating-point
type: Question
linked to: http://stackoverflow.com/q/618535
answer count: 1
has answer: http://stackoverflow.com/a/22989016
tagged with: floating-point-precision
has comment: http://stackoverflow.com/comment/35107744

http://stackoverflow.com/q/23088401
score: 11
type: AnsweredQuestion
tagged with: runtime-compilation
has answer: http://stackoverflow.com/a/38154874
accepted answer: http://stackoverflow.com/a/23120553
tagged with: java
linked to: http://stackoverflow.com/q/27451058
has answer: http://stackoverflow.com/a/23120499
type: Question
has body: I am successfully able to compile Groovy in Java at runtime and store it in a database and pull it out. I can't compile a Groovy class if it has inner classes or an inner enum. Has anyone successfully compiled Groovy code like this and included inner classes/enums and able to pull the script out by classname? For example, I want to load the "Test" script shown below that contains inner classes and run the script at run time. Compiler code: public byte[] compileGroovyScript(final String className, final String script) { byte[] compiledScriptBytes = null; CompilationUnit compileUnit = new CompilationUnit(); compileUnit.addSource(className, script); compileUnit.compile(Phases.CLASS_GENERATION); for (Object compileClass : compileUnit.getClasses()) { GroovyClass groovyClass = (GroovyClass) compileClass; compiledScriptBytes = groovyClass.getBytes(); } return compiledScriptBytes; } Code to pull script out: public Class getGroovyScript(final String className, final byte[] script) { Class clazz = null; try (GroovyClassLoader classLoader = new GroovyClassLoader(this.getClass().getClassLoader())) { clazz = classLoader.defineClass(className, script); } catch (IOException e) { } catch (Exception e) { } return clazz; } Code to run the script: Class groovyClass = app.getGroovyScript(className, compiledScript); TestScript script = (TestScript) groovyClass.newInstance(); System.out.println(script.getMessage()); Groovy script: import com.groovy.groovy.TestScript class Test implements TestScript { String getMessage() { [1..10].each(){ println it } return "Jello" } }
has comment: http://stackoverflow.com/comment/35302119
downvote count: 0
has answer: http://stackoverflow.com/a/23120358
has title: Compile Groovy class at runtime in Java
tagged with: groovy
possible better answer: http://stackoverflow.com/a/38155250
has answer: http://stackoverflow.com/a/23120553
has answer: http://stackoverflow.com/a/38155250
favorite count: 0
upvote count: 11
answer count: 5
has comment: http://stackoverflow.com/comment/35320516

http://stackoverflow.com/comment/35289582
comment on: http://stackoverflow.com/a/23088062
score: 0
type: Comment
has text: Thank you for the answer. I previously checked your blog. I thought of adding the StreamSource. But I couldn't figure out how to. It didn't think of creating a StreamSource from the string.
type: AnswerComment

http://stackoverflow.com/q/23101112
favorite count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: jboss
type: Question
has body: Am not able to profile my remote server . This remote server has to be connected through a global server , so i have to use tunnel for connecting to my server . Whenever am connecting to my remote server , jprofiler is showing the following message Another application is listening on port 12345 . Please check your port configuration Initially i was able to connect to this jboss for profiling through the same configurarion , Can some body figure me out what can be the reason for above case?
tagged with: remote-server
downvote count: 0
answer count: 1
tagged with: jprofiler
tagged with: tunneling
has title: JProfiler - Unable to profile remote jboss through tunneling
has answer: http://stackoverflow.com/a/23293250

http://stackoverflow.com/comment/35100489
comment on: http://stackoverflow.com/a/22983538
type: AnswerComment
has text: how does rest client tracks a request, it is used to make the HTTP requests.
score: 0
type: Comment

http://stackoverflow.com/comment/35232515
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23057207
type: AnswerComment
has text: Did you try the solution for JDK 6 using Apache VFS? That is meant for distributed/network file system.

http://stackoverflow.com/comment/35173366
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23024280
score: 0
has text: Maybe it would be helpful if you provided the file contents that you are trying to read. Also, i don't understand when exactly do you remove the line (like while it is read or manually). if you try to do it while reading the file, then i would guess it is `scanner.hasNextLine()` throwing the exeption.

http://stackoverflow.com/a/23050339
answers question: http://stackoverflow.com/q/23050331
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: When you create an array of objects, all you get is an array with the correct size but full of nulls. You need to create each object by saying new Account() and assigning it to the array. You can even do it in the same loop.

http://stackoverflow.com/comment/35278863
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23082184
type: AnswerComment
has text: actually, i want to clarify that, when i read a txt file i want to assign it to a num1 arraylist, and do it for the rest of the txt files seperately. Is there any way to do this ?

http://stackoverflow.com/comment/35659769
type: AnswerComment
comment on: http://stackoverflow.com/a/23115257
score: 0
type: Comment
has text: I have checked out the link and posted a possible solution.

http://stackoverflow.com/comment/35094936
comment on: http://stackoverflow.com/q/22981619
score: 0
has text: check this out http://stackoverflow.com/questions/3182282/how-to-install-jdbc-and-how-to-use-it-to-connect-to-mysql and this as well http://stackoverflow.com/questions/2839321/java-connectivity-with-mysql/2840358#2840358
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35112532
type: Comment
type: QuestionComment
has text: Removed groovy tag, as this seems to be Java
comment on: http://stackoverflow.com/q/22991437
score: 0

http://stackoverflow.com/q/22994058
answer count: 1
has title: Can I use CDI to @Inject a class in Jersey 1.x?
favorite count: 0
tagged with: cdi
linked to: http://stackoverflow.com/q/16216759
linked to: http://stackoverflow.com/q/7456755
accepted answer: http://stackoverflow.com/a/22995780
tagged with: jersey-1.0
type: Question
type: AnsweredQuestion
tagged with: glassfish-3
upvote count: 5
tagged with: java
has body: I think I'm asking this question but for Jersey 1.x: Dependency injection with Jersey 2.0 I'm using Glassfish 3, CDI and Jersey 1.x. I have a @WebService that is injecting a class like this: @Inject Foo foo; I've tested this in the @WebService and it works. But the same line of code in my Jersey resource throws a NPE when it tries to use foo. I think Jersey 1.x is ignoring the CDI annotations. How can I get dependency injection working like it does in my @WebService? Foo is a pojo and my web.xml is using the ServletContainer: <servlet> JerseyServlet com.sun.jersey.spi.container.servlet.ServletContainer I've found some help here. The problem is my Foo @Injects its own beans (they're actually EJBs that come from a class with @Provides in it). resourceContext.getResource(Foo.class); returns an instance of Foo, but foo's @Injected fields are null.
score: 5
has answer: http://stackoverflow.com/a/22995780
tagged with: jersey
downvote count: 0

http://stackoverflow.com/comment/35222829
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23029357
has text: Mainly I need to disable the cell based on the value in another cell .I created EditorGrid using GXt 2.2.3.AnyOne Please Help.
score: 0

http://stackoverflow.com/q/23046264
has comment: http://stackoverflow.com/comment/35212301
has comment: http://stackoverflow.com/comment/35212537
tagged with: jbutton
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35212402
has answer: http://stackoverflow.com/a/23046456
tagged with: java
has comment: http://stackoverflow.com/comment/35212525
has comment: http://stackoverflow.com/comment/35212590
answer count: 2
has comment: http://stackoverflow.com/comment/35212705
possible better answer: http://stackoverflow.com/a/23046588
score: 0
accepted answer: http://stackoverflow.com/a/23046456
has answer: http://stackoverflow.com/a/23046588
has comment: http://stackoverflow.com/comment/35212622
has title: Many jbuttons with the same onkeypress function
has body: I have many jbuttons (around 50+) which can be clicked. After clicking one the program will check for key inputs and set the button text as the pressed key. Instead of copy pasting 50 codeblocks to each onkeypressed and onclick event of one button i wanted to use a function in each event. My code so far (reduced): private JButton attackMoveBtn = new JButton(); private boolean isAlreadyClicked = false; private void attackMoveBtnKeyPressed(java.awt.event.KeyEvent evt) { if(attackMoveBtn.getText().equals(Strings.setHotkey)){ isAlreadyClicked = false; attackMoveBtn.setText(String.valueOf(evt.getKeyChar())); } } private void attackMoveBtnMouseClicked(java.awt.event.MouseEvent evt) { if(evt.getButton() == 3){ isAlreadyClicked = false; attackMoveBtn.setText(""); }else{ if(!isAlreadyClicked){ isAlreadyClicked = true; attackMoveBtn.setText(Strings.setHotkey); }else{ isAlreadyClicked = false; attackMoveBtn.setText("Mouse "+evt.getButton()); } } } The only thing that would change for the next button is the JButton itself (attackMoveBtn would become moveBtn for example) I tried to use String compName = evt.getComponent().getName(); to retrieve the name of the button i pressed but i cannot use "attackMoveBtn".setText() because dynamic var names are not really supported by java. Is there a way to get which button was pressed? I could then call a function with the buttonObject as a parameter like myOnKeyPressFunction(JButton myButton) My question would be how i can do dynamic variable names or if my approach is wrong and i should use a different pattern.

http://stackoverflow.com/a/22979566
has comment: http://stackoverflow.com/comment/35094592
has comment: http://stackoverflow.com/comment/35091347
has comment: http://stackoverflow.com/comment/35273834
has comment: http://stackoverflow.com/comment/35273365
has comment: http://stackoverflow.com/comment/35272032
has comment: http://stackoverflow.com/comment/35091950
score: 0
has body: The Integer.parseInt(String str) method will fail if the string contains anything other than numbers. In your case, your substring starts with a white space, so to fix it you would need to use the .trim() method to remove any leading/trailing white spaces like so: int datedifference=Integer.parseInt(line2.substring(8,10).trim())-Integer.parseInt(line1.substring(8,10).trim()); EDIT: As per your comment, you could do something like so: int datedifference=Integer.parseInt(line2.substring(8,10).trim())-Integer.parseInt(line1.substring(8,10).trim()); int returnVal = Math.abs(dateDifference); //This will return the absolute value of an integer, so -50 will yield 50, while 50 will still yield 50.
has comment: http://stackoverflow.com/comment/35273129
has comment: http://stackoverflow.com/comment/35091316
answers question: http://stackoverflow.com/q/22979534
type: Answer

execution
tags question: http://stackoverflow.com/q/23082011
type: Tag
tag name: execution
tags question: http://stackoverflow.com/q/23109332

http://stackoverflow.com/comment/35187273
comment on: http://stackoverflow.com/q/23032173
score: 0
has text: I know but its not my fault that json look like that ... ofc it would be better and more logic that vars was in array but they are not, thats why I asking how to solve it
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23017162
has comment: http://stackoverflow.com/comment/35159593
downvote count: 0
has answer: http://stackoverflow.com/a/23017292
possible better answer: http://stackoverflow.com/a/23017306
accepted answer: http://stackoverflow.com/a/23017292
favorite count: 0
has title: java object comparison and inheritance
upvote count: 1
has comment: http://stackoverflow.com/comment/35159775
tagged with: object
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35159631
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23017306
type: Question
tagged with: inheritance
tagged with: comparison
has comment: http://stackoverflow.com/comment/35159743
has comment: http://stackoverflow.com/comment/35160305
has body: Need your help with a practice question how can i modify the below Bar class so that o.equals(0) returns false, you're not allowed to override equals() inherited from the superclass? public class Scratchpad { public static void main(String[] args) { Bar o = new Bar(); System.out.println(o.equals(o)); } } class Foo { public boolean equals(Object o) { return this == o; } } class Bar extends Foo{ }
answer count: 2

http://stackoverflow.com/a/23049353
has body: Hue is used by hundred of organizations and is available in the main Hadoop distributions. The root cause of the crash could be caused by an underlying Hadoop service. Could you check the Hue logs in order to know more? (default is /var/log/hue normally). Which Hue version are you using? The latest one as today is 3.5. You should also post your logs / questions on the Hue user list which is pretty active.
has comment: http://stackoverflow.com/comment/35220148
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23005509
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23005509

http://stackoverflow.com/comment/35356296
has text: On my computer, I still could not get BitSet q = BitSet.valueOf(test); run why?
type: Comment
comment on: http://stackoverflow.com/a/23125240
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35222843
type: QuestionComment
has text: Mainly I need to disable the cell based on the value in another cell .I created EditorGrid using GXt 2.2.3.AnyOne Please Help.
comment on: http://stackoverflow.com/q/23025115
score: 0
type: Comment

http://stackoverflow.com/q/22997137
has comment: http://stackoverflow.com/comment/35165145
has answer: http://stackoverflow.com/a/43824906
type: UnansweredQuestion
tagged with: filewriter
upvote count: 24
type: Question
has answer: http://stackoverflow.com/a/23020225
tagged with: java
has comment: http://stackoverflow.com/comment/44772208
score: 24
has comment: http://stackoverflow.com/comment/35137195
tagged with: hadoop
has answer: http://stackoverflow.com/a/30482241
downvote count: 0
tagged with: hdfs
has body: I'm having trouble to append data to an existing file in HDFS. I want that if the file exists then append a line, if not, create a new file with the name given. Here's my method to write into HDFS. if (!file.exists(path)){ file.createNewFile(path); } FSDataOutputStream fileOutputStream = file.append(path); BufferedWriter br = new BufferedWriter(new OutputStreamWriter(fileOutputStream)); br.append("Content: " + content + "\n"); br.close(); Actually this method writes into HDFS and create a file but as I mention is not appending. This is how I test my method: RunTimeCalculationHdfsWrite.hdfsWriteFile("RunTimeParserLoaderMapperTest2", "Error message test 2.2", context, null); The first param is the name of the file, the second the message and the other two params are not important. So anyone have an idea what I'm missing or doing wrong?
answer count: 3
has title: Append data to existing file in HDFS Java
favorite count: 0

http://stackoverflow.com/comment/35286083
has text: Works here: http://pastebin.com/6NJDWU8u
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23087082

http://stackoverflow.com/a/23073608
answers question: http://stackoverflow.com/q/23073562
downvote count: 0
has body: The reason is: p1.get(128) returns an Integer object, while p2.get(128) returns another Integer object. These objects have the same value but they are not same objects. Therefore, p1.get(128) == p2.get(128); // is false But, p1.get(128).equals(p2.get(128)); // is true
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35264372
score: 1

http://stackoverflow.com/a/22970221
score: 0
has body: Use \r\n instead of \n. That should fix the problem.
type: Answer
answers question: http://stackoverflow.com/q/22970174

http://stackoverflow.com/comment/35137212
score: 0
has text: your code remind me that if I put these two fonts to the private member variables of the class, then I only create two fonts, I guess I don't need to dispose it since there are only two objects. is that right?
type: AnswerComment
comment on: http://stackoverflow.com/a/23004417
type: Comment

http://stackoverflow.com/a/23047850
answers question: http://stackoverflow.com/q/23047758
type: Answer
upvote count: 4
has body: Maven and Gradle can do many things that Eclipse doesn't. However, the most important thing they do, is to decouple the bulding and testing processes from the IDE you choose (i.e. Eclipse). When you work on a large environment, with many programmers, usually you can not control the IDE they use. So, it's better to use a tool like Maven and Gradle to standardize these tasks. The same happens with the code examples of a book: instead of the authors having to provide the instructions for configuring any IDE to execute them, they provide the Maven or Gradle files, so the reader can build and test them on any IDE he's using. Another very important feature that Maven and Gradle give you, is the fact that dependencies are managed without the need of having the executable code under source version control. Instead of having the executable code you depend on as part of the project, you declare the dependencies on a text file (which is under source version control), and then get them from a repository. However, you may only see the real advantages of using tools like Maven or Gradle (and even Jenkins or Hudson), when you think in large scale projects, developed along many months by teams composed of many developers).
downvote count: 0
score: 4

http://stackoverflow.com/comment/35346186
type: Comment
has text: I am trying to get the test to pass, but the GoogleDistanceMatrixConnection class is written to make the connection and save it as a url string if that makes much sense. The parsing and tests is all very new to me.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23119628

http://stackoverflow.com/comment/35122371
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22996725
type: Comment
has text: @ShreyosAdikari It will generate a random number based on the seed you give it. If you use the same seed in multiple instances of `Random` it will always produce the same result.

http://stackoverflow.com/comment/35110755
type: Comment
type: QuestionComment
score: 0
has text: It seems that your dependent jars are missing when you run stuff throough command prompt
comment on: http://stackoverflow.com/q/22990475

http://stackoverflow.com/q/23060994
has title: chat in java not synchronized (sockets, threads)
has comment: http://stackoverflow.com/comment/35239175
tagged with: sockets
has body: I'm trying to figure out a way to get an instance of a server to negotiate between two clients by creating a chat thread between them. I created this project, and it "almost" works... but it seems like there is a buffer of synch problem. when writing a line in one side (i.e Client#1), it doesn't pass to the other side (i.e Client#2), but only after Client#2 trys to pass a line too. I know there might be better ways to implement this, but I'd like to understand what's wrong with my code. your help would be great! the code: server import java.io.*; import java.net.*; public class Server { public static void main(String[] args) { int id = 1; System.out.println(); System.out.println("Server"); try { ServerSocket serverSocket = new ServerSocket(4321); while (true) { Socket client1Socket = serverSocket.accept(); Socket client2Socket = serverSocket.accept(); System.out.println("clients connected from ports: \n" + client1Socket.getPort() + ", " + client2Socket.getPort()); Thread client1Thread = new ServerThread(client1Socket, client2Socket, id); client1Thread.start(); id++; Thread client2Thread = new ServerThread(client2Socket, client1Socket, id); client2Thread.start(); id++; } } catch (IOException ioe) { ioe.printStackTrace(); } } } server thread import java.io.*; import java.net.*; import java.util.*; public class ServerThread extends Thread { Socket sourceSocket; Socket destSocket; int id; public ServerThread(Socket src, Socket dst, int n) { sourceSocket = src; destSocket = dst; id = n; } public void run() { try { Scanner clientInput = new Scanner(sourceSocket.getInputStream()); PrintStream destOutput = new PrintStream(destSocket.getOutputStream()); destOutput.println("You are chatting with Client " + id); boolean more = true; while (more) { String input = clientInput.nextLine(); destOutput.println(input); if (input.equals("Q")) { more = false; } } sourceSocket.close(); destSocket.close(); } catch (IOException ex) { ex.printStackTrace(); } } } client import java.io.*; im…
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/35275916
tagged with: java
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/23063165
type: Question
has comment: http://stackoverflow.com/comment/35240859
has comment: http://stackoverflow.com/comment/35275789
has answer: http://stackoverflow.com/a/23063165
tagged with: chat
upvote count: 3
has comment: http://stackoverflow.com/comment/35240385
has comment: http://stackoverflow.com/comment/35286716
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35240329
favorite count: 0
has comment: http://stackoverflow.com/comment/35275864

http://stackoverflow.com/comment/35186812
type: Comment
comment on: http://stackoverflow.com/a/23024911
score: 0
type: AnswerComment
has text: @pokeairguy, `So theres not much I can do about that` - I already suggested what you can do about that. You should better structure your program to add components to the content pane of the frame and not the frame directly. Read the Swing tutorials and create your programs with a better structure. Another thing you are doing wrong is you are not creating your components on the Event Dispatch Thread.

http://stackoverflow.com/comment/35197318
comment on: http://stackoverflow.com/q/23033916
score: 0
has text: Then put the method in the sub classes.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23018104
answers question: http://stackoverflow.com/q/23018046
accepted answer of: http://stackoverflow.com/q/23018046
type: AcceptedAnswer
has body: There is no error in the code: when n is 1, you do n /= 10 after adding n%10 to the running total (i.e. num). This makes num equal 1, which is what you want. By the time your loop prints zero, num is already equal to 1.
score: 0
type: Answer

maven
tags question: http://stackoverflow.com/q/23052300
tags question: http://stackoverflow.com/q/23102399
tags question: http://stackoverflow.com/q/22986898
tags question: http://stackoverflow.com/q/23047290
tags question: http://stackoverflow.com/q/23078262
tags question: http://stackoverflow.com/q/23018862
tags question: http://stackoverflow.com/q/23122561
tags question: http://stackoverflow.com/q/23095026
tags question: http://stackoverflow.com/q/23013941
tags question: http://stackoverflow.com/q/23118772
tags question: http://stackoverflow.com/q/23009868
tags question: http://stackoverflow.com/q/22990475
tags question: http://stackoverflow.com/q/22988070
type: Tag
tags question: http://stackoverflow.com/q/23047196
tags question: http://stackoverflow.com/q/23099992
tags question: http://stackoverflow.com/q/22995385
tags question: http://stackoverflow.com/q/23058273
tags question: http://stackoverflow.com/q/23029657
tags question: http://stackoverflow.com/q/23113871
tags question: http://stackoverflow.com/q/23030279
tags question: http://stackoverflow.com/q/22999865
tags question: http://stackoverflow.com/q/22981434
tags question: http://stackoverflow.com/q/23044889
tags question: http://stackoverflow.com/q/22997636
tags question: http://stackoverflow.com/q/23000536
tags question: http://stackoverflow.com/q/23129586
tags question: http://stackoverflow.com/q/23005866
tags question: http://stackoverflow.com/q/23078500
tags question: http://stackoverflow.com/q/23053576
tags question: http://stackoverflow.com/q/23004186
tags question: http://stackoverflow.com/q/23025461
tags question: http://stackoverflow.com/q/23048040
tags question: http://stackoverflow.com/q/22996446
tags question: http://stackoverflow.com/q/22994142
tags question: http://stackoverflow.com/q/23003570
tags question: http://stackoverflow.com/q/23107586
tags question: http://stackoverflow.com/q/23069456
tags question: http://stackoverflow.com/q/23040620
tags question: http://stackoverflow.com/q/22970677
tags question: http://stackoverflow.com/q/22984534
tags question: http://stackoverflow.com/q/23037802
tags question: http://stackoverflow.com/q/23105066
tags question: http://stackoverflow.com/q/23019214
tags question: http://stackoverflow.com/q/23034085
tags question: http://stackoverflow.com/q/22968893
tags question: http://stackoverflow.com/q/23059688
tags question: http://stackoverflow.com/q/23047758
tags question: http://stackoverflow.com/q/23095908
tags question: http://stackoverflow.com/q/23063255
tags question: http://stackoverflow.com/q/23109095
tags question: http://stackoverflow.com/q/22980193
tags question: http://stackoverflow.com/q/23093712
tags question: http://stackoverflow.com/q/23079316
tags question: http://stackoverflow.com/q/23114155
tags question: http://stackoverflow.com/q/23059376
tags question: http://stackoverflow.com/q/23086491
tags question: http://stackoverflow.com/q/23097106
tags question: http://stackoverflow.com/q/22970634
tags question: http://stackoverflow.com/q/23083940
tags question: http://stackoverflow.com/q/23079263
tags question: http://stackoverflow.com/q/23089854
tags question: http://stackoverflow.com/q/23090350
tags question: http://stackoverflow.com/q/22980564
tags question: http://stackoverflow.com/q/22972094
tags question: http://stackoverflow.com/q/23048245
tags question: http://stackoverflow.com/q/22981028
tags question: http://stackoverflow.com/q/23090769
tags question: http://stackoverflow.com/q/23079506
tags question: http://stackoverflow.com/q/23000068
tags question: http://stackoverflow.com/q/23104927
tags question: http://stackoverflow.com/q/22996542
tags question: http://stackoverflow.com/q/23082104
tags question: http://stackoverflow.com/q/23087598
tags question: http://stackoverflow.com/q/23081082
tags question: http://stackoverflow.com/q/23010370
tags question: http://stackoverflow.com/q/22981967
tags question: http://stackoverflow.com/q/22989655
tags question: http://stackoverflow.com/q/22986061
tags question: http://stackoverflow.com/q/23101945

http://stackoverflow.com/q/23062012
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23062048
accepted answer: http://stackoverflow.com/a/23062048
has title: Java version of OCaml underscore
score: 0
has comment: http://stackoverflow.com/comment/35240787
answer count: 1
tagged with: ocaml
type: AnsweredQuestion
tagged with: syntax
has body: If I'm testing something like Corrector c = new FileCorrector("fileNotFound.txt"); and I know that this code will fail, and thus c will never be used, is there a way I can write this code with something like the OCaml _ symbol? Corrector _ = new FileCorrector("fileNotFound.txt");

http://stackoverflow.com/q/22988935
has answer: http://stackoverflow.com/a/23012924
downvote count: 0
answer count: 1
favorite count: 0
tagged with: cdi
tagged with: rest
accepted answer: http://stackoverflow.com/a/23012924
has body: My app is an Java REST app, and i need to send e-mails. The e-mail has the URL for the related action... How can i get the real server address???? I can get the Session instance, but it has only the contextPath... http://xxxxxx/&lt;contextPath&gt; I need the fully context... like this &lt;protocol&gt;://&lt;domain&gt;/&lt;contextPath&gt;
has title: How to get the url of the server with java cdi without JSF
upvote count: 1
tagged with: jakarta-ee
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35139925
type: Question

http://stackoverflow.com/comment/35231985
comment on: http://stackoverflow.com/q/23055718
score: 0
type: Comment
type: QuestionComment
has text: Can you post you line of code that uses the XPath?

http://stackoverflow.com/comment/35116358
type: QuestionComment
score: 1
has text: I wouldn't expect there to be much of a performance difference -- the runtime cost of deciding which method to invoke would probably be about the same as the cost of a null check.
comment on: http://stackoverflow.com/q/22992757
type: Comment

http://stackoverflow.com/q/23127603
has body: I am creating a new project and I have some doubts about the spring + hibernate management. First of all I want to say that I've been reading a lot and I tried to document myself, but after weeks I am still a bit lost on this topic. Project configuration My architecture follows this structure: JSF Beans --> Facade layer --> Service Layer --> DAO Layer My hibernate handles all DAOS and is fully integrated with Spring. The whole Datasource and Hibernate configuration is done in Spring configuration files, so spring manages everything. I use Spring Security to handle the project security. Everything seems to be well integrated but I still can't find a solid solution to manage Hibernate Sessions. My first approach was to use OSIV using JSF PhaseListeners, but then I integrated Spring and started using @Transactional annotations on my Service layer. Here are my questions: I think everytime @Transactional method is invoked an Hibernate session is opened and closed right? Or am I wrong? With @Transactional I am sure I am going to run in trouble because Hibernate's Lazy instantiation on the Render response phase, and I don't want to do EAGER fetch. So ... Is it safe to use OSIV? Or is it really vulnerable to DOS attacks? Is there a better way to handle Lazy fetching problem than OSIV pattern? I am sure I am missing better patterns, can you throw a little bit of light to the topic? I didn't post any code because all my questions are basically conceptual on architecture, but if you need any of my code to understand me (I know I am a mess explaining myself), you just have to ask me and I'll post it as soon as I can. Thank you all!
favorite count: 0
has answer: http://stackoverflow.com/a/23128772
upvote count: 1
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
tagged with: myfaces
type: Question
accepted answer: http://stackoverflow.com/a/23128772
answer count: 1
downvote count: 0
tagged with: jsf-2.2
linked to: http://stackoverflow.com/q/1847040
has title: Which pattern to use to open and close hibernate sessions (MyFaces 2.2.2 + Spring 4.0.3 + Hibernate 4.3.2)

http://stackoverflow.com/comment/35111888
type: AnswerComment
score: 0
has text: Please look at the edition I have made to the question
type: Comment
comment on: http://stackoverflow.com/a/22986081

http://stackoverflow.com/a/23102038
type: Answer
has body: Just use ERROR_HOLDER in request scope, if its state is not required later. Do not keep values in session if its value is not required over multiple requests. Unnecessary usages will make things messy and memory overhead will become high
answers question: http://stackoverflow.com/q/23101133
score: 0

continuations
tag name: continuations
tags question: http://stackoverflow.com/q/23040835
type: Tag

http://stackoverflow.com/q/23049498
has title: Hibernate: Could not deserialize - invalid stream header
has answer: http://stackoverflow.com/a/61623751
score: 54
has answer: http://stackoverflow.com/a/56051452
has answer: http://stackoverflow.com/a/55069537
has answer: http://stackoverflow.com/a/57552938
has comment: http://stackoverflow.com/comment/35219107
has answer: http://stackoverflow.com/a/69691761
upvote count: 54
has comment: http://stackoverflow.com/comment/35218587
answer count: 18
has comment: http://stackoverflow.com/comment/35218430
tagged with: spring
has body: Any ideas as to how I could resolve this error? I am using Spring JPA with Hibernate. Necessary details below. Entity class 1: @Entity @Table(name = "ways") @TypeDef(name = "hstore", typeClass = HstoreUserType.class) @Cacheable public class Way { /** * Primary key for the row in table. */ @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Long id; /** * The ID to represent it across the system. * Used for preserving historical information. */ @Column(name = "way_id") private Long wayId; /** * The version of the way this Object represents. */ @Column(name = "version") private Integer version; /** * The {@link User} that edited this version. */ @OneToOne @PrimaryKeyJoinColumn(name = "user_id") private User user; /** * Timestamp when this version of the Way was edited. */ @Column(name = "tstamp") @Temporal(TemporalType.TIMESTAMP) private Date timestamp; /** * The changeset that this version of the way belongs to. */ @Column(name = "changeset_id") private Long changesetId; /** * All the tags this Way contains. */ @Type(type = "hstore") @Column(name = "tags", columnDefinition = "hstore") private Object2ObjectOpenHashMap&lt;String, String&gt; tags = new Object2ObjectOpenHashMap&lt;String, String&gt;(); @Column(name = "bbox") private Geometry bbox; @Column(name = "linestring") private Geometry linestring; @Column(name = "nodes") private Long[] nodes; // getters and setters } Entity class for User: @Entity @Table(name = "users") @Cacheable public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Long id; @Column(name = "name", unique = true) private String name; // getters and setters } And the stacktrace : The stacktrace is quite huge. I am pasting the whole stacktrace below for reference and a quick TL;DR here: javax.persistence.PersistenceException: org.hibernate.type.SerializationException: could not deserialize Caused by: org.hibernate.type.SerializationException: could not deserialize Caused by:…
possible better answer: http://stackoverflow.com/a/38305475
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35506683
has comment: http://stackoverflow.com/comment/35218489
has comment: http://stackoverflow.com/comment/35218326
has comment: http://stackoverflow.com/comment/93104947
has comment: http://stackoverflow.com/comment/35228047
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23110865
has answer: http://stackoverflow.com/a/58027879
has answer: http://stackoverflow.com/a/38639712
has answer: http://stackoverflow.com/a/64786889
type: Question
has comment: http://stackoverflow.com/comment/35328823
has answer: http://stackoverflow.com/a/31572712
has comment: http://stackoverflow.com/comment/35219735
has comment: http://stackoverflow.com/comment/35538758
has answer: http://stackoverflow.com/a/23111027
has comment: http://stackoverflow.com/comment/101250604
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/79167302
has answer: http://stackoverflow.com/a/57754905
accepted answer: http://stackoverflow.com/a/23111027
has answer: http://stackoverflow.com/a/45337997
has comment: http://stackoverflow.com/comment/35225467
has comment: http://stackoverflow.com/comment/35219871
favorite count: 0
has answer: http://stackoverflow.com/a/53957581
has answer: http://stackoverflow.com/a/45372891
has answer: http://stackoverflow.com/a/48332310
has comment: http://stackoverflow.com/comment/35231540
has answer: http://stackoverflow.com/a/38305475

http://stackoverflow.com/comment/35228425
type: AnswerComment
score: 0
type: Comment
has text: YOU ARE A LEGEND AWESOME WORK it WORKS!!! thank you for all your help i will give you good credit you have been huge help and i will tick this question for you when i can i dont have enough rep ;-( thanks so much for your help
comment on: http://stackoverflow.com/a/23053083

http://stackoverflow.com/comment/35228198
type: QuestionComment
comment on: http://stackoverflow.com/q/23055094
has text: you check proper path provided for resulting jsps(fail and success)
score: 0
type: Comment

rfid
tag name: rfid
type: Tag
tags question: http://stackoverflow.com/q/23118213

http://stackoverflow.com/q/23113927
type: AnsweredQuestion
tagged with: java
tagged with: xmlworker
type: Question
has answer: http://stackoverflow.com/a/23114599
answer count: 1
has title: Generating PDF from a third-party HTML on java
tagged with: flying-saucer
accepted answer: http://stackoverflow.com/a/23114599
has comment: http://stackoverflow.com/comment/35333772
has body: I'm trying to generate a PDF version of a third-party HTML (actually it is an HTM file). This HTML may change in future and I have absolutely no control over it. All I wanna do is convert it to a PDF. I already tried 2 solutions: iText (with XmlWorker) and Flying-Saucer, but no success so far. My problem is that the HTML file is very out of default patterns. Examples: &lt;link rel=File-List href="040602_inds_files/filelist.xml"&gt; &lt;meta http-equiv=Content-Type content="text/html; charset=windows-1252"&gt; The first one has no close tag (iText crashes) and the second one has no double quotes on 'http-equiv' value (Flying-Saucer crashes). I have found a lot of posts about this issue, but all of them are handling their own HTML, so they can fix it and try again. But i can't do this. This is the page I'm trying to convert. Here is my iText convert method: public static void convert(PdfWriter writer, Document document, String siteUrl) throws MalformedURLException, IOException { XMLWorkerHelper.getInstance().parseXHtml(writer, document, new BufferedReader(new InputStreamReader(new URL(siteUrl).openStream()))); } And here is my Flying-Saucer convert method: public static void convertFS(String siteUrl, String fileName) throws com.lowagie.text.DocumentException, IOException { OutputStream os = new FileOutputStream(fileName); ITextRenderer renderer = new ITextRenderer(); renderer.setDocument(siteUrl); renderer.layout(); renderer.createPDF(os); os.close(); } Any tips? I accept other libs if they are decently usable. Thx in advance.
score: 0
tagged with: itext

http://stackoverflow.com/comment/35210890
type: Comment
has text: Yes, that's to be expected. Your ear's interpretation of "quiet", "medium" and "loud" will actually follow a log scale. In terms of energy, "medium" is much much more energetic than "quiet". That's why we typically use a log scale for visualising sound levels.
score: 0
comment on: http://stackoverflow.com/q/23045299
type: QuestionComment

http://stackoverflow.com/a/23083323
has comment: http://stackoverflow.com/comment/35280716
has comment: http://stackoverflow.com/comment/35280326
has comment: http://stackoverflow.com/comment/35293928
score: 0
answers question: http://stackoverflow.com/q/23081544
has comment: http://stackoverflow.com/comment/35293862
has body: Here is a simple way to perform this. webView.post(new Runnable() { @Override public void run() { // TODO Auto-generated method stub webView.getHeight(); } });
type: Answer
has comment: http://stackoverflow.com/comment/35288184

http://stackoverflow.com/a/23081264
accepted answer of: http://stackoverflow.com/q/23010218
answers question: http://stackoverflow.com/q/23010218
upvote count: 2
type: AcceptedAnswer
has body: We have found out this is a bug in ojdbc driver 11.2.0.4 and onwards. We will create a bugreport at oracle. workaround would be to use tnsaliases without dots in their name.
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/44332848

http://stackoverflow.com/comment/35437992
comment on: http://stackoverflow.com/a/23127340
has text: Depends on if you want to preserve whitespace: if you do not, just have a mode of the parser (could be a separate method) that takes begins on just past the brace (the last token that was received from the tokenizer) and proceeds to concatenate all received tokens up to the closing brace (take note to recursively call this method if you want sub-braces). If you need to preserve white space, you're in a world of hurt and you will need to implement back-and forth between String and StringTokenizer...
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23005218
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: Whether the garbage collector runs or not is JVM-specific behavior, but in most cases it will not (and I'll explain why when I talk about the OS). If you want to execute some operation on exit (such as a call to System.gc() to suggest that the garbage collector should run) then you can use the Runtime.addShutdownHook API. Note that this is a suggestion, and may not actually run the GC in all cases. At the end of System.exit(), Java will make an exit() syscall to Mac OS. When this happens, all threads in the Java process will be halted by the operating system and the pages of memory it was using will be deallocated by the OS. This is different than the deallocation that Java would run on an object, which frees up a (usually very small) piece of memory for the Java process to reuse, but Java still has total control over the memory and the OS cannot give it to another process. When the OS deallocates a page of memory, it means that there is now a physical region of memory that can be allocated by another process or the OS itself (for i.e. filesystem caching). Since the OS only allocates and deallocates memory by multiples of a page of memory (usually around 4k bytes) it can deallocate memory somewhat more quickly than Java (which may have many objects to process inside of a single page). The reason it doesn't make sense for Java to deallocate all the memory it's using before exiting (by running the GC on exit) is that once the program exits, it doesn't matter what was in those pages because nobody cares what data was last held in the Java process. The OS will ensure that any pages it allocates to a new process are scrubbed clean of the old data beforehand.
accepted answer of: http://stackoverflow.com/q/22988233
answers question: http://stackoverflow.com/q/22988233

http://stackoverflow.com/comment/35077845
has text: You are not comparing the words from file. All you are doing is comparing the first line only. you are not reading word like w = file.next(); or i may be mis understood your qustion
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22971519

http://stackoverflow.com/comment/35106809
type: QuestionComment
comment on: http://stackoverflow.com/q/22988325
score: 1
has text: Eh, I have a solution, though experimental and requiring Java 7, see [here](https://github.com/fge/java7-fs-ftp). You can create a `.newDirectoryStream()` and filter on `BasicFileAttributes`' `.lastModifiedTime()`.
type: Comment

http://stackoverflow.com/q/22996689
has comment: http://stackoverflow.com/comment/35122335
tagged with: java
has comment: http://stackoverflow.com/comment/35122275
has comment: http://stackoverflow.com/comment/35122236
accepted answer: http://stackoverflow.com/a/22996767
has comment: http://stackoverflow.com/comment/35122368
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22996725
has answer: http://stackoverflow.com/a/22996725
favorite count: 0
has body: Can anybody please explain why the below code gives output 0 1 2 3 4 5 6 7 8 9. Random random = new Random(-6732303926L); for(int i=0;i&lt;10;i++) System.out.println(random.nextInt(10)+" "); From Java API Random I can see constructor Random(long seed) creates a new random number generator using a single long seed. So, this will be random again, why this gves a fixed output every time?
has answer: http://stackoverflow.com/a/22996997
tagged with: random
type: Question
has comment: http://stackoverflow.com/comment/56206501
score: -1
has answer: http://stackoverflow.com/a/22996767
downvote count: 2
answer count: 3
upvote count: 1
has title: Why random is behaving differently here?
has comment: http://stackoverflow.com/comment/42533619

http://stackoverflow.com/comment/35139338
has text: and add jQuery external Link reference ?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22983163

http://stackoverflow.com/comment/35126509
has text: I get that you are trying to implement a smooth/sleek interface with a unique design, but wouldn't this be tons easier with an edit text field and a button that just says call?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22998562
score: 0

http://stackoverflow.com/comment/35140458
type: Comment
type: QuestionComment
has text: Show us the code you have written so far.
comment on: http://stackoverflow.com/q/23006962
score: 7

http://stackoverflow.com/a/23122905
has comment: http://stackoverflow.com/comment/35350147
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23122665
has comment: http://stackoverflow.com/comment/35350979
answers question: http://stackoverflow.com/q/23122665
score: 1
has comment: http://stackoverflow.com/comment/35372362
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35350094
has comment: http://stackoverflow.com/comment/35350110
has body: Look at this code from dna_ini: for(int j = 0;j &lt; (a.length()+1); j++) { ini[j][0] = gap_score(j,0,a,b); ... And this from gap_score public int gap_score(int a, int b,String k, String l) { int penscore = 0; if(k.charAt(a) != l.charAt(b)) ... You're looping with j from 0 to a.length()+1. That should probably be a.length(). The way you have it now, let's say a = "hi". a.length() is 2 so you're looping from 0 to 3. The first 2 iterations when j is 0 and 1 will be fine. But on the next iteration when j is 2, in gap_score() you do k.charAt(2) (k is a now, terrible variable names). Since k (nee a) is only length 2 this blows up. Please, please, please avoid non-meaningful variable names. You may save a few keystrokes but you'll spend way more time trying to figure out what is going on. EDIT: I think I know more what you're trying to do now. for(int j = 1;j &lt; (a.length()+1); j++) { ini[j][1] = gap_score(j-1,0,a,b); } for(int i = 1; i &lt; (b.length() + 1);i++) { ini[1][i]= gap_score(0,i-1,a,b); ... This will end up with ini[][] looking something like: 0 0 0 0 0 0 0 0 0 ? ? ? ? ? ? ? 0 ? ? ? ? ? ? ? 0 ? ? ? ? ? ? ? 0 ? ? ? ? ? ? ? 0 ? ? ? ? ? ? ? 0 ? ? ? ? ? ? ? 0 ? ? ? ? ? ? ? where the ?s are values from gap_score(). Try that and see if you get the results you want.
type: Answer

http://stackoverflow.com/a/23109609
has body: replace startTime - endTime; with endTime- startTime ;
answers question: http://stackoverflow.com/q/23109547
score: 0
type: Answer

http://stackoverflow.com/q/23006962
has comment: http://stackoverflow.com/comment/35140867
has answer: http://stackoverflow.com/a/23007277
score: 0
linked to: http://stackoverflow.com/q/9995432
has answer: http://stackoverflow.com/a/23007063
has answer: http://stackoverflow.com/a/23007153
has comment: http://stackoverflow.com/comment/35140498
answer count: 10
tagged with: reverse
linked to: http://stackoverflow.com/q/2137755
has answer: http://stackoverflow.com/a/23007111
linked to: http://stackoverflow.com/q/8095045
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35140482
has answer: http://stackoverflow.com/a/23007616
possible better answer: http://stackoverflow.com/a/23007063
tagged with: java
has answer: http://stackoverflow.com/a/23007156
has comment: http://stackoverflow.com/comment/35143548
tagged with: methods
has comment: http://stackoverflow.com/comment/35141974
type: Question
has answer: http://stackoverflow.com/a/23007328
has answer: http://stackoverflow.com/a/23007316
accepted answer: http://stackoverflow.com/a/23007153
tagged with: arrays
duplicate of: http://stackoverflow.com/q/2137755
has answer: http://stackoverflow.com/a/23007122
has title: Array in the reverse order
has answer: http://stackoverflow.com/a/23007120
has comment: http://stackoverflow.com/comment/35140458
has body: I have an array of n elements and these methods: last() return the last int of the array first() return the first int of the array size() return the length of the array replaceFirst(num) that add the int at the beginning and returns its position remove(pos) that delete the int at the pos I have to create a new method that gives me the array at the reverse order. I need to use those method. Now, I can't understand why my method doesn't work. so for (int i = 1; i The remove will remove the element at the position i, and return the number that it is in that position, and then with replaceFirst will move the number (returned by remove) of the array. I made a try with a simple array with {2,4,6,8,10,12} My output is: 12 12 12 8 6 10 so if I have an array with 1,2,3,4,5 for i = 1; I'm gonna have : 2,1,3,4,5 for i=2 >3,2,1,4,5 etc But it doesn't seem to work.

http://stackoverflow.com/comment/35167971
has text: It's very possible that it's due to an extra space or newline. Check what the website says to see.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23021409
score: 0

http://stackoverflow.com/a/23068945
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35254025
has body: Remove commas (,) before the closing brackets, and remove ending semicolons (;) in the execSQL() methods.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23068713
answers question: http://stackoverflow.com/q/23068713

array-initialization
type: Tag
tags question: http://stackoverflow.com/q/22998005
tag name: array-initialization

http://stackoverflow.com/comment/35202736
comment on: http://stackoverflow.com/q/23041088
type: Comment
type: QuestionComment
has text: Based on "http://stackoverflow.com/a/983458/860721" : **"You can send a request body with GET but it should not have any meaning. If you give it meaning by parsing it on the server and changing your response based on its contents you're violating the HTTP/1.1 spec."**
score: 0

http://stackoverflow.com/a/23042139
answers question: http://stackoverflow.com/q/23042014
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: If this JDK is sufficient for all the project you run on your local machine, you can set the JAVA_HOME variable as Windows environment variable. For this right clic on Computeur > Properties > Advanced system settings; go to the Advanced tab and in the bottom you will have a Environment Variables button. Clic on it, and here you can manage environment variable. Add a System variable, with JAVA_HOME as key, and the jdk directory as value (C:\...)
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23042014
score: 1

http://stackoverflow.com/a/23035351
has body: As I wrote in comment - in general building your own application on top of the third party www service is not a good idea. If you want to do it anyway you have 2 options: Use jSoup (or any other html parser if exists) and parse third party content on the device Set up some middleware server to parse content and serve it in some more convenient way. The second option has a little advantages - you can fix application without forcing users to update it and probably you'll save a bit of device's bandwidth. Of course disadvantage is that you have to pay for server. General problem with applications like that is that every single change with layout, skin, server configuration can cause your application to stop working, as well as parsing html needs much more work that just connect to existing API. More over - publishing your application can cause some legal issues (copyright) and is against Google Play's policy: Do not post an app where the primary functionality is to: Drive affiliate traffic to a website or Provide a webview of a website not owned or administered by you (unless you have permission from the website owner/administrator to do so)
type: Answer
answers question: http://stackoverflow.com/q/23034375
accepted answer of: http://stackoverflow.com/q/23034375
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23068938
has title: Adding image to JPanel in Eclipse
tagged with: jpanel
tagged with: image
answer count: 1
has body: I have this in my main class: panel.setBackground(Color.green); ImagePanel background = new ImagePanel("Images/background.png"); panel.add(background); But when I run it I only see the green background and get the exception: "javax.imageio.IIOException: Can't read input file!" This is the ImagePanel class: public class ImagePanel extends JPanel { private BufferedImage img; public ImagePanel(String path) { // load the background image try { img = ImageIO.read(new File(path)); } catch(IOException e) { e.printStackTrace(); } } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); // paint the background image and scale it to fill the entire space g.drawImage(img, 0, 0, getWidth(), getHeight(), this); } } I'm using Eclipse and this is where my image is: src/Images/background.png Ok, now i have: ImagePanel background = new ImagePanel("src/Images/background.png"); and it don't show the exception anymore, but i still don't see the image, only the green background... Here is the full method: private void createAndShowGUI() { frame = new JFrame("Java 2048 By Xandru"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setLayout(null); panel = new JPanel(); panel.setLayout(null); panel.setBounds(0, 0, HEIGHT, WIDTH); panel.setBackground(Color.green); frame.add(panel); //Add the background ImagePanel background = new ImagePanel("src/Images/background.png"); panel.add(background); //Create the main Frame frame.pack(); //Set dimensions frame.setSize(WIDTH, HEIGHT); //Center it Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) ((screen.getWidth() - frame.getWidth()) /2); int y = (int) ((screen.getHeight() - frame.getHeight()) /2); frame.setLocation(x, y); //Set visible frame.setVisible(true); }
linked to: http://stackoverflow.com/q/2451252
linked to: http://stackoverflow.com/q/22722777
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23068983
score: 0
tagged with: java
tagged with: swing
tagged with: background
type: Question
accepted answer: http://stackoverflow.com/a/23068983
has comment: http://stackoverflow.com/comment/35270560

http://stackoverflow.com/comment/139089995
type: AnswerComment
type: Comment
has text: The 2nd example `final long epoch = localDateTime.toEpochSecond(ZoneId.systemDefault());` is incorrect. ZoneId.systemDefault() returns a ZoneId, but toEpochSeconds takes a ZoneOffset
comment on: http://stackoverflow.com/a/74632212
score: 0

http://stackoverflow.com/q/22996192
has answer: http://stackoverflow.com/a/22996514
answer count: 2
upvote count: 1
tagged with: opencv
has comment: http://stackoverflow.com/comment/35121306
tagged with: java
tagged with: collision-detection
has title: Object tracking, avoid collision and current velocity of two objects
downvote count: 0
type: UnansweredQuestion
favorite count: 0
has body: I need an image taken by Kinect camera to be evaluated in order to detect whether two moving objects will collide. The shape, size and colour of the moving objects are known in advance. My task is: The current position of the two objects Current velocity of each of the two objects I am doing this project on Opencv and Java, and I am able to track two coloured objects from laptop web camera and Kinect. How can I find current position and velocity of two objects?
type: Question
has answer: http://stackoverflow.com/a/23009290
score: 1

http://stackoverflow.com/a/22982514
accepted answer of: http://stackoverflow.com/q/22981849
has comment: http://stackoverflow.com/comment/35099068
has comment: http://stackoverflow.com/comment/35099803
score: 0
has body: ... is there a way I get it to check if the number exists in the field already and only add it if it is not already there? You can do it using JAVA, but leave that checking to MySQL as it has such search features. Using MySQL, you can use FIND_IN_SET function on comma separated values in the column. This will solve your problem to not reprocess in JAVA to find if such id exists. select FIND_IN_SET( value_to_find, column_with_cs_values ) &gt; 0 as bool_matched from table_name Add where condition and others if any required. And in the JAVA code you can just read the resultset for getBoolean. boolean idMatched = rs.getBoolean( "bool_matched" ); if( idMatched ) { // dont update table } else { // update table } Alternatively, you can directly update the table column. Example: UPDATE table_name SET column_name_with_cs_values = CASE WHEN FIND_IN_SET( value_to_find, column_name_with_cs_values ) &gt; 0 THEN column_name_with_cs_values ELSE CONCAT( column_name_with_cs_values, ',', value_to_find ) END -- add where etc here ; In JAVA, you can use the above query like the following with PreparedStatement. String query = "UPDATE word SET urlid = CASE WHEN FIND_IN_SET( ?, urlid ) &gt; 0 THEN urlid ELSE CONCAT( urlid, ',', ? ) END WHERE word = ? "; PreparedStatement pst = con.prepareStatement( query ); pst.setString( 1, urlid ); pst.setString( 2, urlid ); pst.setString( 3, item); int result = pst.executeUpdate();
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35099354
has comment: http://stackoverflow.com/comment/35097319
has comment: http://stackoverflow.com/comment/35100950
has comment: http://stackoverflow.com/comment/35098958
has comment: http://stackoverflow.com/comment/35099991
type: Answer
has comment: http://stackoverflow.com/comment/35097654
has comment: http://stackoverflow.com/comment/35099647
has comment: http://stackoverflow.com/comment/35100525
has comment: http://stackoverflow.com/comment/35097708
has comment: http://stackoverflow.com/comment/35099003
has comment: http://stackoverflow.com/comment/35098736
has comment: http://stackoverflow.com/comment/35099950
answers question: http://stackoverflow.com/q/22981849
has comment: http://stackoverflow.com/comment/35101043
has comment: http://stackoverflow.com/comment/35098276
has comment: http://stackoverflow.com/comment/35098029

http://stackoverflow.com/comment/35321139
has text: Which Jenkins versions are you running in?
comment on: http://stackoverflow.com/q/23107050
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22974333
has body: I have a requirement in my project to keep some configuration properties in a .properties file (server_config.properties) so that it can be altered without hard coding key-value pairs e.g server_url = http://www.mydomain.com server_port : 5000 ....etc and there can be 100's of properties in this file. I am thinking why not keep the key-value pair configuration in database table and read it from there. Can you guys please share your experiences of using both approaches and mention what are the advantages and disadvantages of both? In my opinion , I think keeping in a database table should be better approach, in that way I can change the values in database and they can be loaded dynamically into server via JMX calls , and could be shared by multiple instances of my application. Please share.
answer count: 1
has answer: http://stackoverflow.com/a/22974461
downvote count: 0
tagged with: web
has comment: http://stackoverflow.com/comment/35082586
favorite count: 0
has comment: http://stackoverflow.com/comment/35082698
has title: What should be preferred way to keep configuration properties.. .properties file or storing configuration in a database table?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35083093
has comment: http://stackoverflow.com/comment/35082681
score: 2
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35082472
tagged with: jakarta-ee
tagged with: configuration
tagged with: .net
has comment: http://stackoverflow.com/comment/35082561

http://stackoverflow.com/q/23076523
answer count: 2
upvote count: 1
tagged with: java
type: UnansweredQuestion
has body: I'm integrating Google Ads in Android application. I'm implementing example of google ad mob, which I have getting example from the net. And also I have add external jar file of google-play-service_lib.jar and add the element of And when I run the app the application is crashes. I'm getting error like this: = 04-15 12:16:33.713: W/Ads(545): Invalid unknown request error: Cannot determine request type. Is your ad unit id correct? There was a problem getting an ad response. ErrorCode: 1 Failed to load ad: 1 04-15 12:16:04.713: W/GooglePlayServicesUtil(545): Google Play services is missing. Here is my code. The code of BannerAdListener public class BannerAdListener extends Activity { /** Your ad unit id*/ private static final String AD_UNIT_ID = "INSERT_YOUR_AD_UNIT_ID_HERE"; /** The log tag. */ private static final String LOG_TAG = "BannerAdListener"; /** The view to show the ad. */ private AdView adView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Create an ad. adView = new AdView(this); adView.setAdSize(AdSize.BANNER); adView.setAdUnitId(AD_UNIT_ID); // Set the AdListener. adView.setAdListener(new AdListener() { /** Called when an ad is clicked and about to return to the application. */ @Override public void onAdClosed() { Log.d(LOG_TAG, "onAdClosed"); Toast.makeText(BannerAdListener.this, "onAdClosed", Toast.LENGTH_SHORT).show(); } /** Called when an ad failed to load. */ @Override public void onAdFailedToLoad(int error) { String message = "onAdFailedToLoad: " + getErrorReason(error); Log.d(LOG_TAG, message); Toast.makeText(BannerAdListener.this, message, Toast.LENGTH_SHORT).show(); } /** * Called when an ad is clicked and going to start a new Activity that will * leave the application (e.g. breaking out to the Browser or Maps * application). */ @Override public void onAdLeftApplication() { Log.d(LOG_TAG, "onAdLeftApplication"); To…
tagged with: admob
downvote count: 0
score: 1
has title: How to integrate Google Ads in Android application?
favorite count: 0
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/25613280
has answer: http://stackoverflow.com/a/23100696

http://stackoverflow.com/q/23031905
tagged with: numbers
has comment: http://stackoverflow.com/comment/35187947
tagged with: java
has comment: http://stackoverflow.com/comment/35186856
accepted answer: http://stackoverflow.com/a/23034473
has comment: http://stackoverflow.com/comment/35186792
has comment: http://stackoverflow.com/comment/35186546
answer count: 1
has answer: http://stackoverflow.com/a/23034473
score: 0
has comment: http://stackoverflow.com/comment/35186596
has title: Java - Subtract 32 from a number in a specific amount of time
has comment: http://stackoverflow.com/comment/35186765
has comment: http://stackoverflow.com/comment/35186503
has body: I was wondering... Is there a way that I could subtract 32 from a number in a specific amount of time? Such as 500 mils? If you could help out, it would be great! Thanks! public void update() { x += dx; if(this.y % 32 == 0) { this.tileY = this.y / 32; } if(this.x % 32 == 0) { this.tileX = this.x / 32; } System.out.println(tileX); } public void moveLeft () { // subtract 32 dx in 500 ms }
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/35214435
has text: can u just code it for me because using break at default is getting me back to start of code enter name
comment on: http://stackoverflow.com/a/23047358
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23005656
type: Question
has body: I've been playing around with SVG support in Android and came up with this library which claims that it supports SVG just as it they were native. Since I took great pains in discovering that this is not really possible, I went to see how this dude actually managed it. So I came upon his Resources derivative in which he declares a method (loadDrawable) that has default visibility in base Resources class. The funny thing is, normally lint would just report that you can't write this method since it would hide base method, but in this particular case (note the absense of @Override directive) this method gets to be called as if it were written in the base class. All the methods invoking this method will invoke the override instead of original method. For me coming from classic compilers such as C++ or Pascal, this is totally beyond comprehension. Based on this, I managed to get my SVG support working completely with one single use of reflection and am super-happy about this, but: Why does this work?
tagged with: java
has comment: http://stackoverflow.com/comment/35297026
has comment: http://stackoverflow.com/comment/35297937
has comment: http://stackoverflow.com/comment/35267530
has comment: http://stackoverflow.com/comment/35295472
has title: Android method with default (package) visibility overriding (shouldn't work, but does - why?)
has comment: http://stackoverflow.com/comment/35281250
has comment: http://stackoverflow.com/comment/35297420
answer count: 1
has comment: http://stackoverflow.com/comment/35268933
tagged with: inheritance
favorite count: 0
tagged with: android-resources
tagged with: android
has comment: http://stackoverflow.com/comment/35282180
has comment: http://stackoverflow.com/comment/35283839
has comment: http://stackoverflow.com/comment/35258201
score: 8
has comment: http://stackoverflow.com/comment/35267674
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/svg
downvote count: 0
has answer: http://stackoverflow.com/a/23094051
accepted answer: http://stackoverflow.com/a/23094051
upvote count: 8

http://stackoverflow.com/comment/35314833
score: 0
has text: have a look at my updated post for method `getUsers()`.
type: Comment
comment on: http://stackoverflow.com/a/23103059
type: AnswerComment

http://stackoverflow.com/q/23094931
tagged with: java
tagged with: classpath
tagged with: resources
type: Question
possible better answer: http://stackoverflow.com/a/23097197
answer count: 2
has answer: http://stackoverflow.com/a/23097197
has comment: http://stackoverflow.com/comment/35301697
has answer: http://stackoverflow.com/a/23132283
accepted answer: http://stackoverflow.com/a/23132283
has body: NOTE: As per the accepted solution below, this appears to be realated only to the fact that Spring's DefaultResourceLoader does not use the classloader to create URL instances for resources, thus custom classloaders are ignored https://jira.spring.io/browse/SPR-8176 I have a standard Maven project, it looks something like this $ tree . ├── pom.xml └── src ├── main │ ├── java │ │ │ └── resources │ └── application.properties └── test └── java I will have more resource files shortly in a directory tree under the resources directory, and I would like to loop over them. Following several other posts, I am using the PathMatchingResourcePatternResolver from the Spring Framework. The function I have written to grab all file names is as follows public static List&lt;File&gt; getAllResourceFiles() { PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource[] resources; try { resources = resolver.getResources("classpath*:.*"); System.out.println(JsonUtils.objectToJson(resources)); } catch (IOException e) { e.printStackTrace(); } return null; } Where objectToJson is a function that simply uses Jackson to serialize an object. Now when I compile and run this application, I do not get any results. In particular, I do not see application.properties. How do I make this work? $ java -jar target/MyApp.one-jar.jar [] UPDATE: As noted in the comment below, this is using Simon Tuffs' one jar maven plugin. However, the usual way of reading files from the classpath works. Namely MyClass.class.getResourceAsStream("/application.properties"); UPDATE 2: I tried the following: resources = resolver.getResources("classpath:**/*.*"); And get this stack trace java.io.FileNotFoundException: class path resource [] cannot be resolved to URL because it does not exist at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:178) at org.springframework.core.io.support.PathMatchingResourcePatternResolver.isJarResource(PathMatchingResourcePatte…
upvote count: 1
favorite count: 0
tagged with: maven
tagged with: spring
has title: Unable to get file list from standard resource dir in Maven project with Spring PathMatchingResourcePatternResolver
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/35301400
has comment: http://stackoverflow.com/comment/35301644
score: 1

http://stackoverflow.com/comment/35196928
has text: It's important to know that regex syntax varies in different contexts. The biggest difference about Java vs other places (perl, JavaScript) is that you often have to use a second backslash to escape backslashes. This is because you're first escaping a special character within the string, then need to escape it again for the regex compiler. My apologies for clearly being too harsh in my initial comments.
comment on: http://stackoverflow.com/q/23035427
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23027203
has answer: http://stackoverflow.com/a/23027327
has comment: http://stackoverflow.com/comment/35178399
has title: Can't load image into buffered image 2D array
accepted answer: http://stackoverflow.com/a/23027327
has answer: http://stackoverflow.com/a/23027384
score: 0
has body: File newFile = null; BufferedImage oldImage = null; BufferedImage newImage = null; String fileName = new String((args[0])); String newFileName = new String(fileName.replaceFirst(".png", "-tiled.png")); try{ oldImage = ImageIO.read(new File(fileName)); System.out.println("Reading Complete"); } catch(IOException e) { System.out.println("Error: "+ e); } int width = oldImage.getWidth(); int height = oldImage.getHeight(); newImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); int imagePixels [][] = new int [height][width]; for (int i = 0; i &lt; height -1; ++i) { for (int j = 0; j &lt; width - 1; ++j) { imagePixels[i][j] = oldImage.getRGB(i,j); //error here } } It compiles fine, however when I run the program, it will run perfectly for a 10x10 image, however when I try and use a 800x600 image it will not work, and error occurs on the commented line saying that "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds! at sun.awt.image.ByteInterleavedRaster.getDataElements(Unknown Source) at java.awt.image.BufferedImage.getRGB(Unknown Source) at imagery.ImageTiler.main(ImageTiler.java:35) Can anyone spot this irritating error? A little side info: The program gets a file name from command line and then loads the RGB pixels into a 2D Array. Any help is appreciated. Cheers.
tagged with: bufferedimage
possible better answer: http://stackoverflow.com/a/23027384
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
tagged with: arrays

http://stackoverflow.com/q/23025376
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23025418
linked to: http://stackoverflow.com/q/1481178
tagged with: java
has comment: http://stackoverflow.com/comment/35175270
has answer: http://stackoverflow.com/a/23025388
duplicate of: http://stackoverflow.com/q/1481178
answer count: 2
downvote count: 0
score: 1
possible better answer: http://stackoverflow.com/a/23025388
linked to: http://stackoverflow.com/q/2414105
favorite count: 0
has answer: http://stackoverflow.com/a/23025418
has comment: http://stackoverflow.com/comment/35175269
has title: How can I delete a specific object?
tagged with: garbage-collection
upvote count: 1
has body: How can I manually delete a specific object before the garbage collector would ever collect it ? For example I want to delete requestToken object. How can I do that ?
tagged with: garbage
type: Question
tagged with: object

http://stackoverflow.com/comment/35255439
has text: @tieTYT That doesn't compile because you are using a `void` as return type here, while the `Callable<Void>` expects a `Void` as return type.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23068007
type: Comment

http://stackoverflow.com/comment/35227048
has text: @JanDvorak it is not specified, may be you're right
comment on: http://stackoverflow.com/a/23054497
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23006239
has comment: http://stackoverflow.com/comment/35139496
accepted answer of: http://stackoverflow.com/q/23005735
score: 1
answers question: http://stackoverflow.com/q/23005735
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: I think you are performing bubble sort. As others have pointed out, performing get() and set() operations are expensive with linked lists. I am not conversant with Java, but it appears that you can use ListIterators to carry out bubble sort in O(N^2) ListIterator listIterator(int index) Returns a list-iterator of the elements in this list (in proper sequence), starting at the specified position in the list. Throws IndexOutOfBoundsException if the specified index is is out of range (index &lt; 0 || index >= size()). For bubble sort, you just need to swap the adjacent elements, so you can iterate through the list like an array and keep swapping if needed. Moreover, you can skip the section of the list that is already sorted. Take a look at a good bubble sort algorithm. http://en.wikipedia.org/wiki/Bubble_sort

http://stackoverflow.com/comment/35238426
has text: Works fine when I try that input. (Also, "its working fine for all cases"? Weird thing to say when the very next line is a case where it apparently doesn't work.)
comment on: http://stackoverflow.com/q/23060693
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35184596
comment on: http://stackoverflow.com/q/23016047
score: 0
type: Comment
type: QuestionComment
has text: And suddenly my r file goes missing.. I did clean and build several times. . No change..

http://stackoverflow.com/q/23048216
accepted answer: http://stackoverflow.com/a/23048574
tagged with: logic
score: 0
has title: Check for adjacent cells in a 5x6 matrix
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23048574
favorite count: 0
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
has body: I have a 5x6 matrix which I have created using individual buttons in Java Swing. I have named them similar to a chess board, as A1 to F5 from top left to bottom right. Now, I want to allow the user to click only a given number of adjacent buttons, either horizontally or vertically. Say, the value is 4. So, the user must be able to select only 4 buttons anywhere in the matrix which are next to each other vertically or horizontally. For eg. D2, C2, B2, A2 if chosen vertically. Or, maybe D1, D2, D3, D4 if chosen horizontally. What would be the algorithmic way of achieving this functionality for any set of buttons in the matrix?
type: Question
upvote count: 1

http://stackoverflow.com/comment/35130433
score: 0
type: Comment
type: QuestionComment
has text: I have done the following: `int decimal = Integer.parseInt(binary, 2); //gives 36`, `String hexadecimal = Integer.toHexString(decimal); //gives 24` but then when I do `temp = Byte.parseByte(hexadecimal,16); //it gives me 36 not 24`. I do not understand why it is converting back to decimal.
comment on: http://stackoverflow.com/q/23001085

http://stackoverflow.com/comment/35107692
score: 0
type: QuestionComment
type: Comment
has text: @Girl it is 2D but the declaration has nothing in the second dimension.
comment on: http://stackoverflow.com/q/22988694

http://stackoverflow.com/comment/35349238
comment on: http://stackoverflow.com/q/23122409
has text: http://www2.sys-con.com/itsg/virtualcd_spring05/java/archives/0508/barnabee/index.html
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35338495
has text: @OliBlogger The question says `Why don't they use the import statements like the following?` and this is the answer to that question.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23040085

http://stackoverflow.com/q/23121235
has answer: http://stackoverflow.com/a/23146296
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23146296
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23161581
has answer: http://stackoverflow.com/a/44634233
tagged with: apache-camel
type: Question
has body: I have following test programs using http://camel.apache.org/bindy.html Problem is code is able to marshal pojo structure into flat CSV file, but it is not able to unmarshal the file data back to pojo. apache-camel-bindy: 2.13.0 Order Java File: package test.bindy.model; import java.util.ArrayList; import java.util.Date; import java.util.List; import org.apache.camel.dataformat.bindy.annotation.CsvRecord; import org.apache.camel.dataformat.bindy.annotation.DataField; import org.apache.camel.dataformat.bindy.annotation.OneToMany; @CsvRecord(separator = ",") public class Order { @DataField(pos = 1) private String clOrdID; @DataField(pos = 2) private String handlInstId; @DataField(pos = 3) private int orderQty; @DataField(pos = 4) private String ordType; @DataField(pos = 5) private String rule80A; @DataField(pos = 6, pattern = "yyyyMMdd-HH:mm:ss") private Date sendingTime; @DataField(pos = 7) private String side; @DataField(pos = 8) private String symbol; @DataField(pos = 9) private String timeInForce; @DataField(pos = 10, pattern = "yyyyMMdd-HH:mm:ss") private Date transactTime; @DataField(pos = 11) private String message; @DataField(pos = 12) private String OnBehalfOfCompID; @DataField(pos = 13) private String securityExchange; @OneToMany(mappedTo = "test.bindy.model.Item") private List&lt;Item&gt; items; public void addItem(Item item) { if (null == items) { items = new ArrayList&lt;Item&gt;(); } items.add(item); } public String getClOrdID() { return clOrdID; } public void setClOrdID(String clOrdID) { this.clOrdID = clOrdID; } public String getHandlInstId() { return handlInstId; } public void setHandlInstId(String handlInstId) { this.handlInstId = handlInstId; } public int getOrderQty() { return orderQty; } public void setOrderQty(int orderQty) { this.orderQty = orderQty; } public String getOrdType() { return ordType; } public void setOrdType(String ordType) { this.ordType = ordType; } public String getRule80A() { return rule80A; } public void setRule80A(String rule8…
tagged with: file-io
tagged with: bindy
answer count: 3
has answer: http://stackoverflow.com/a/23161581
has title: Flat file to Pojo w/ oneToMany unmarshal doesn't work

http://stackoverflow.com/comment/35204279
comment on: http://stackoverflow.com/a/23041843
type: Comment
has text: Interesting link to the 'getThis trick' . . also +1 on down-vote explanation.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23005149
upvote count: 0
has title: How to store and retrieve image in java?
has answer: http://stackoverflow.com/a/23005227
favorite count: 0
has body: I want to store image (upload) in database and retrieve it to jsp page. i am using JAVA and SQL SERVER 2012. My table is imgtbl(name nvarchar(500),photo image) Please help me
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23005224
tagged with: java
downvote count: 2
type: Question
score: -2
tagged with: servlets
tagged with: sql-server
answer count: 2

http://stackoverflow.com/comment/40795210
type: AnswerComment
score: 0
type: Comment
has text: @KisHanSarsecHaGajjar I think OOM is no different from any other error/exception. The only way the finally block will __not__ execute is if you call [`System.exit()` or the whole JVM has already crashed](http://stackoverflow.com/questions/65035/does-finally-always-execute-in-java), which in all fairness could happen when OOM happens on some platforms. However, I have seen JVMs resiliently surviving OOM, although they would behave unpredictably.
comment on: http://stackoverflow.com/a/22969148

http://stackoverflow.com/a/23047388
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23047192
answers question: http://stackoverflow.com/q/23047192
type: Answer
score: 1
has body: Looks like the problem is: boolean[] collapsed = new boolean[3]; which should have a dimension of 4, not 3.
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/35346741
type: QuestionComment
has text: i know how to get ride of this with synchronized block or volatile but i was want to know if the 64 bit machine architectural guarantee atomicity for me
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23120811

http://stackoverflow.com/comment/35249890
comment on: http://stackoverflow.com/q/23066586
type: Comment
type: QuestionComment
has text: What happens if you use the constructor [`JTextField(String text, int columns)`](http://docs.oracle.com/javase/7/docs/api/javax/swing/JTextField.html#JTextField%28java.lang.String,%20int%29) with non-zero value for `columns`? Could be an issue with it defaulting to 0 columns with the current constructor.
score: 0

http://stackoverflow.com/comment/35236664
type: QuestionComment
has text: Exception in thread "main" java.lang.NullPointerException at Words.fillInTheBlanks.solveWord(fillInTheBlanks.java:175) at Words.Crossword.setVerticals(Crossword.java:139) at Words.Crossword.solve(Crossword.java:48) at Words.tester.main(tester.java:10)
comment on: http://stackoverflow.com/q/23059509
score: 0
type: Comment

http://stackoverflow.com/q/23064385
has comment: http://stackoverflow.com/comment/35245457
has title: Java.sql.SQLException doing a SELECT
score: 0
answer count: 3
tagged with: sql
accepted answer: http://stackoverflow.com/a/23064584
has answer: http://stackoverflow.com/a/23064487
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35245504
has body: When I try to execute this code: try { pstm = connection.prepareStatement("SELECT * FROM Menu WHERE (menuName LIKE '?%')"); pstm.setString(1,searchedMenu.getMenuName()); rs = pstm.executeQuery(); while (rs.next()) { Menu menu=new Menu(); menu.setMenuId(rs.getInt("menuId")); menu.setMenuName(rs.getString("menuName")); temp.add(menu); } I get the error in the subject, why? My purpose is to search a string or a part of it. Thank you. Edit: the error is: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0). And it is referred to this line: pstm.setString(1,searchedMenu.getMenuName());
tagged with: java
has comment: http://stackoverflow.com/comment/35245896
has comment: http://stackoverflow.com/comment/35245439
type: Question
possible better answer: http://stackoverflow.com/a/23064461
has answer: http://stackoverflow.com/a/23064584
has answer: http://stackoverflow.com/a/23064461
tagged with: sqlexception

http://stackoverflow.com/q/22990587
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35111313
tagged with: java
tagged with: eclipse
type: Question
has title: eclipse smart auto complete
tagged with: eclipse-plugin
score: 0
has comment: http://stackoverflow.com/comment/35111250
has comment: http://stackoverflow.com/comment/35111749
has body: I am in many of this situations before public Class A { public A (C c, D d){ ......... } method F (G g, H h, I i){ ......... } } Then I want to reference Object A and its method in other places Class W{ public static void main(String args[]){ //A a = new A(); //line 1 A a = new A(c, d); // line 2 C c = new C(); //line 3 D d = new D(); //line 4 } } My question is: When I do ctrl+space on the second opening bracket in line1, and choose the right method signature from the drop down list, it does auto complete by fill in a variable which makes it look like line 2. In a normal scenario I have to hand type line 3 and 4, which indeed eclipse should create it for me automatically, because the choice is obvious(without new C and D, the auto completed code in line 2, would not work). Is there any plug-in in eclipse I can use, which NOT JUST fill in those variables in line 2 but Also creating the line 3 and 4 automatically?

http://stackoverflow.com/q/23109360
has body: Consider the following class: public class Deck { private final Queue&lt;Card&gt; queue = new LinkedList&lt;&gt;(); public Deck() { } public Deck(final Collection&lt;Card&gt; cards) { Objects.requireNonNull(cards); queue.addAll(cards); } public void add(final Card card) { Objects.requireNonNull(card); queue.add(card); } public void addAll(final Collection&lt;Card&gt; cards) { Objects.requireNonNull(cards); queue.addAll(cards); } public void shuffle() { Collections.shuffle((List&lt;Card&gt;)queue); } public Card take() { return queue.remove(); } } How would I unit test the shuffle() method? I am using JUnit 4 for testing. I have the following options: Test shuffle() to see that it does not generate an exception. Test shuffle() and check if the deck actually gets shuffled. Example pseudocode of option 2: while notShuffled create new Deck take cards and check if they are shuffled The only culprit here is that when executing a test written for option 2 (which also inheritly includes option 1), if the shuffling does not work as intended, then the code execution will never stop. How would I solve this issue? Is it possibly to limit the execution time in JUnit tests?
favorite count: 0
has comment: http://stackoverflow.com/comment/35326732
has comment: http://stackoverflow.com/comment/35324868
upvote count: 6
answer count: 4
has comment: http://stackoverflow.com/comment/35324911
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23109743
has comment: http://stackoverflow.com/comment/35328317
linked to: http://stackoverflow.com/q/1492856
has answer: http://stackoverflow.com/a/23109743
has answer: http://stackoverflow.com/a/23111628
score: 6
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/35326832
type: Question
has answer: http://stackoverflow.com/a/67124053
has answer: http://stackoverflow.com/a/23109658
tagged with: java
has comment: http://stackoverflow.com/comment/35324994
has comment: http://stackoverflow.com/comment/35326645
accepted answer: http://stackoverflow.com/a/23111628
tagged with: junit
downvote count: 0
has comment: http://stackoverflow.com/comment/35325207
has comment: http://stackoverflow.com/comment/35324955
has title: Unit testing of a shuffle method on a list

http://stackoverflow.com/q/23065842
type: AnsweredQuestion
has title: Cannot resolve symbol 'R' in android Studio
linked to: http://stackoverflow.com/q/17054000
accepted answer: http://stackoverflow.com/a/23066011
linked to: http://stackoverflow.com/q/17111480
type: Question
has comment: http://stackoverflow.com/comment/35248262
tagged with: java
possible better answer: http://stackoverflow.com/a/25717554
has answer: http://stackoverflow.com/a/25717554
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23066011
has body: I know this may sound like a duplicate, but I have read and tried avery answer posted here. It is just not working for me. What do I need to do to fix this? only android.R is working , I can't use R directly. I have been hunting the solution for few days. I didn't really wanted to go back to eclipse but I wasted a lot of time already trying to resolve this. any idea? Things I tried: clean gradle Sync gradle Checked for xml errors Answer below and more....
tagged with: android
has comment: http://stackoverflow.com/comment/35248682
tagged with: android-studio

http://stackoverflow.com/comment/84230280
comment on: http://stackoverflow.com/a/24401795
has text: Line of code - client.setSslSocketFactory(sslContext.getSocketFactory()); will not be compiled. Reason - setSslSocketFactory is not available in ok http client. Is is avaialable in builder of ok http client - Replace above line as - builder.sslSocketFactory(sslContext.getSocketFactory()); where OkHttpClient client = new OkHttpClient(); OkHttpClient.Builder builder = client.newBuilder(); Reference - https://github.com/square/okhttp/blob/3f7a3344a4c85aa3bbb879dabac5ee625ab987f3/samples/guide/src/main/java/okhttp3/recipes/CustomTrust.java#L54
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/22987139
has comment: http://stackoverflow.com/comment/35106855
has comment: http://stackoverflow.com/comment/35105012
has body: As per the developer documents requestSingleUpdate() method "Register for a single location update using a named provider and pending intent." You need to use requestLocationUpdates() method instead. The second parameter of this method minimum time interval between location updates, in milliseconds will allow you to fetch location again &amp; again.
type: Answer
answers question: http://stackoverflow.com/q/22987062
has comment: http://stackoverflow.com/comment/35106555
has comment: http://stackoverflow.com/comment/35104770
has comment: http://stackoverflow.com/comment/35105936
has comment: http://stackoverflow.com/comment/35106880
has comment: http://stackoverflow.com/comment/35105657
score: 0
has comment: http://stackoverflow.com/comment/35104674

http://stackoverflow.com/comment/35237709
has text: In this case it is because the gargabe collector didn't do anything yet. Try to add a call to `System.gc()` after you `setScreen(new ...)` and see if it still has this effect. It shouldn't. In your real application there are other resources somewhere which you do not dispose. But without showing that code, I can't help you.
type: Comment
comment on: http://stackoverflow.com/a/23057647
type: AnswerComment
score: 0

http://stackoverflow.com/a/23098689
answers question: http://stackoverflow.com/q/23098634
score: 0
type: Answer
has body: IsHidden is not defined as a variable. It is a method. You should it call as .isHidden().

http://stackoverflow.com/a/23038297
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23038274
has body: Try Eclipse WindowBuilder ( https://www.eclipse.org/windowbuilder/ ). It can build any swing layout for you, featuring a pretty smart code parser / generator, all swing components and layouts, and an easy to use drag and drop / property based editor. I think it will suit your needs.
has comment: http://stackoverflow.com/comment/35198328
has comment: http://stackoverflow.com/comment/35207502

http://stackoverflow.com/comment/35264620
comment on: http://stackoverflow.com/q/23074381
score: 0
type: Comment
type: QuestionComment
has text: Tried to disable maven nature, used android "fix project", made a project clean and the problem is still happening.

http://stackoverflow.com/comment/35083994
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22975203
has text: You say "text inside the `JProgressBar`", but are you just looking to get your hands on the value, or are you looking to create a string of text that says "000/100"?
type: Comment

http://stackoverflow.com/comment/35208660
type: Comment
type: QuestionComment
has text: @PatriciaShanahan: Hi, You mean HashMap?
comment on: http://stackoverflow.com/q/23044406
score: 0

http://stackoverflow.com/q/23127163
answer count: 2
has body: I am trying to store SoapObject or Envelope in a file but thought it is not Serializable, it is not stored in file. My goal is to store SoapObject or Envelope one time in file and next time instead of building a new SoapObject or Envelope, fetch that object from stored file. I have created all the methods using easywsdl.com site. It has its custom ExtendedSoapSerializationEnvelope having following definition. public class ExtendedSoapSerializationEnvelope extends SoapSerializationEnvelope { //Envelop code } I make that envelope Serializable using following pattern. public class ExtendedSoapSerializationEnvelope extends SoapSerializationEnvelope implements Serializable { /** * */ private static final long serialVersionUID = 1L; } And write using following code in file. public static void writeEnvelope(Object object) throws IOException { File file = new File(Environment.getExternalStorageDirectory() .getAbsoluteFile() + File.separator + "envelope.txt"); FileOutputStream fos = new FileOutputStream(file); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(object); oos.close(); fos.close(); } It successfully write Envelope but when I tried to read that object from file using following code, public static Object readEnvelope() throws IOException, ClassNotFoundException { File file = new File(Environment.getExternalStorageDirectory() .getAbsoluteFile() + File.separator + "envelope.txt"); FileInputStream fis = new FileInputStream(file); ObjectInputStream ois = new ObjectInputStream(fis); Object object = ois.readObject(); return object; } it fires following exception, java.io.InvalidClassException: org.ksoap2.serialization.SoapSerializationEnvelope; IllegalAccessException Do any one has idea hot to achieve that? Is there any other way to do so?
has comment: http://stackoverflow.com/comment/46984834
tagged with: java
tagged with: ksoap2
type: UnansweredQuestion
score: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/57193831
type: Question
tagged with: android
has title: How to store a SoapObject or Envelope in a File
tagged with: serialization
has answer: http://stackoverflow.com/a/35914040
upvote count: 2

http://stackoverflow.com/comment/35093639
has text: so u want to convert solr response into javabin, am i right?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22978729
score: 0

http://stackoverflow.com/comment/35300193
type: Comment
comment on: http://stackoverflow.com/q/23092996
score: 0
type: QuestionComment
has text: @SavannahC123 If you check my answer and paste it into your IDE I am sure you will find it will work exactly as you wanted. Feel free to comment on it if you want me to explain it further.

http://stackoverflow.com/q/22974444
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/1714297
has body: At least I believe that is the problem. From the API documentation: inflate(int resource, ViewGroup root) Inflate a new view hierarchy from the specified xml resource. I've been fighting with an orientation change bug for some time now, and I think I have isolated the origin of the problem. The following code does not behave as I would expect: SeekBarTestActivity.java public class SeekBarTestActivity extends Activity { private LinearLayout layout; private InflateSeekBar bar1; private InflateSeekBar bar2; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); setContentView(layout); bar1 = new InflateSeekBar(this, layout); bar2 = new InflateSeekBar(this, layout); } } InflateSeekBar.java public class InflateSeekBar { private SeekBar seekBar; public InflateSeekBar(Context ctx, ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(ctx); View view = inflater.inflate(R.layout.seekbar_layout, null); seekBar = (SeekBar) view.findViewById(R.id.seekBar); seekBar.setMax(300); parent.addView(view); } } The .xml resource file is just as one would expect, a SeekBar inside a LinearLayout. What I am expecting is two objects each containing a new SeekBar, not tied to one another in any way. Furthermore, I would not expect the SeekBars to retain their progress on an orientation change, instead they should be destroyed and recreated with the activity. However, not only does the second SeekBar retain it's progress, but the first SeekBars progress matches the second. I'm hoping that someone could explain to me why the seekbars are behaving this way so that I can use this knowledge to fix the bugs in my program. Thank you for any knowledge in advance. Edit - Solved: Just to be clear, my problem was the fact that I was not giving unique ID's to the SeekBars after they were inflated, causing the JVM to treat them as the same object in some respects. Thank you …
has answer: http://stackoverflow.com/a/22975170
accepted answer: http://stackoverflow.com/a/22975170
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35083126
has comment: http://stackoverflow.com/comment/35082957
tagged with: android
has title: LayoutInflater not returning a new object
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: layout-inflater

http://stackoverflow.com/q/23003849
has answer: http://stackoverflow.com/a/23003882
has comment: http://stackoverflow.com/comment/35135120
has comment: http://stackoverflow.com/comment/35135281
accepted answer: http://stackoverflow.com/a/23003972
has comment: http://stackoverflow.com/comment/35135089
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23004066
tagged with: constructor
has comment: http://stackoverflow.com/comment/35135113
has comment: http://stackoverflow.com/comment/35135163
downvote count: 2
upvote count: 1
type: Question
has body: In my program, I want to be able to access certain methods based on the constructor I initialize and nothing else. For example: public class A { int paramOne; float paramTwo; public A(int paramOne) { // Constructor One } public A(float paramTwo) { // Constructor Two } public void ConstructorOneMethodOnly(int paramOne) { // Only used when Constructor One is initialized } public void ConstructorTwoMethodOnly(float paramTwo) { // Only used when Constructor Two is initialized } } In the code given, is there a way of achieving what I have described in the comments and in my question? If so, can you describe how to do so?
tagged with: java
score: -1
has title: Access methods based on constructor provided
has answer: http://stackoverflow.com/a/23003972
answer count: 3
possible better answer: http://stackoverflow.com/a/23003882
favorite count: 0

http://stackoverflow.com/q/23116379
has body: I have implemented a code to construct pattern count tree. How do i find its time and space complexity? class PCTree { public static void main(String args[])throws IOException { BufferedReader input=new BufferedReader(new InputStreamReader(System.in)); int n;//No of Patterns int f;//No of Features float initial_no_of_nodes=0;//No of Nodes in Input Patterns float final_no_of_nodes=0;//No of Nodes in PC Tree(Output) float compression_rate;//percentage compression System.out.println("Enter No of Patterns:"); n=Integer.parseInt(input.readLine()); //2-D array to store Features int pattern[][]= new int[n][20]; //No of Features for each Pattern for(int i=0;i&lt;n;i++)//NO of Features for each Pattern { System.out.println("Enter No of Features for Pattern "+(i+1)+" : "); f=Integer.parseInt(input.readLine()); pattern[i]=new int[f]; } //Features of each pattern for(int i=0;i&lt;n;i++) { System.out.println("Enter Features for Pattern "+(i+1)+" : "); for(int j=0;j&lt;pattern[i].length;j++) { pattern[i][j]=Integer.parseInt(input.readLine()); } } System.out.println("=============="); System.out.println("INPUT "); System.out.println("=============="); //Print Features of each pattern for(int i=0;i&lt;n;i++) { for(int j=0;j&lt;pattern[i].length;j++) { System.out.print(" "+pattern[i][j]+" "); initial_no_of_nodes++; } System.out.println(); } System.out.println("\nNODES: "+initial_no_of_nodes);//Print Initial No of Nodes System.out.println(); System.out.println(); System.out.println("=============="); System.out.println("PC TREE "); System.out.println("=============="); //Construction of PC Tree //Print First Pattern as it is for(int j=0;j&lt;pattern[0].length;j++) { System.out.print(" "+pattern[0][j]+" "); final_no_of_nodes++; } System.out.println(); int i=0;//processing pattern int k=0;//processing features int j=1;//processing pattern while((i&lt;=(n-1))&amp;&amp;(j&lt;n))//Loop works till last pattern is processed { inner: //performs matching of Features while(k&lt;pattern[j].leng…
favorite count: 0
type: UnansweredQuestion
tagged with: space-complexity
score: 4
tagged with: java
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/23117939
has answer: http://stackoverflow.com/a/23117557
has answer: http://stackoverflow.com/a/23117237
has title: How to find time and space complexity for this code?
answer count: 3
tagged with: time-complexity
downvote count: 0

http://stackoverflow.com/comment/35214431
score: 0
type: Comment
has text: `getTime()` returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.
type: AnswerComment
comment on: http://stackoverflow.com/a/23047233

http://stackoverflow.com/a/23000371
has comment: http://stackoverflow.com/comment/35129592
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35131577
has comment: http://stackoverflow.com/comment/35199582
has body: An instance field is attached to an instance. It doesn't exist on its own. The Field#get(Object) method javadoc states Returns the value of the field represented by this Field, on the specified object. The value is automatically wrapped in an object if it has a primitive type. In other words, you need to call get by passing the object (the instance) on which to get the field value (or null if the field is static). You're passing the Class object for the class that the field is declared in.
accepted answer of: http://stackoverflow.com/q/23000288
answers question: http://stackoverflow.com/q/23000288
has comment: http://stackoverflow.com/comment/35131772
has comment: http://stackoverflow.com/comment/35131631
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35131758
has comment: http://stackoverflow.com/comment/35129551
type: Answer

http://stackoverflow.com/q/23044996
tagged with: jfreechart
has comment: http://stackoverflow.com/comment/35209974
tagged with: java
has body: I have problem with display data correctly. I am creating two series: XYSeries series = new XYSeries("Accumulated result"); XYSeries series1 = new XYSeries("Index chart"); then in loop im adding data to each series: series.add series1.add XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series); dataset.addSeries(series1); JFreeChart chart = ChartFactory.createXYLineChart("Simulation", // Title "Days", // x-axis Label "Cumulative results", // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation true, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); And the result of creating chart is not satisfactorily, as it looks like: https://i.sstatic.net/w6gBF.jpg Do You see blue line? The second series will never have values more than 100 and in the chart looks like a straight line. Moreover i would like to have a legend for second series on the right side. Is any way to fix it?
type: Question
has comment: http://stackoverflow.com/comment/35210462
has comment: http://stackoverflow.com/comment/35210138
score: 0
answer count: 0
type: UnansweredQuestion
has title: XYSeriesCollection with two lines

http://stackoverflow.com/q/23036298
has comment: http://stackoverflow.com/comment/35194395
has comment: http://stackoverflow.com/comment/105590301
accepted answer: http://stackoverflow.com/a/23036349
upvote count: 1
tagged with: design-patterns
type: AnsweredQuestion
tagged with: java
tagged with: methods
possible better answer: http://stackoverflow.com/a/23036365
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23036365
answer count: 2
has body: I've just discovered about the existence of the Method class in Java. Is an instance of this class equivalent to an instance of a Command class in the context of the Command design pattern? If not, what are this class' practical uses?
has answer: http://stackoverflow.com/a/23036349
score: 0
has title: Is the Method object equivalent to the Command object in the Command design pattern?
favorite count: 0

http://stackoverflow.com/a/23037686
type: Answer
answers question: http://stackoverflow.com/q/23037304
score: 0
has body: Just use Java's List class as part of the Collections framework. Its much more efficient, reliable, and usable than making your own sort of implementation of a sorted list like you have here. To add all your data into a list if it was part of an array: java.util.Array#AsList(T[] t) (returns a List if type T is int) To sort this array, because int is a primitive type its sorted using &lt; and > java.util.Collections#sort(yourList) To learn about all the methods that List has or can be used on a List, just read those 2 links.

http://stackoverflow.com/q/23016949
downvote count: 1
favorite count: 0
tagged with: out-of-memory
type: UnansweredQuestion
has title: android spoledge aacdecoder outofmemory
has answer: http://stackoverflow.com/a/23017096
upvote count: 0
tagged with: java
score: -1
type: Question
has body: I need to know what that error means, what memory is it about : E/dalvikvm-heap(31086): Out of memory on a 123496-byte allocation. FATAL EXCEPTION: Thread-1269 java.lang.OutOfMemoryError at com.spoledge.aacdecoder.AACPlayer.createDecodeBuffers(AACPlayer.java:518) at com.spoledge.aacdecoder.AACPlayer.playImpl(AACPlayer.java:438) at com.spoledge.aacdecoder.AACPlayer.play(AACPlayer.java:386) at com.spoledge.aacdecoder.AACPlayer.play(AACPlayer.java:338) at com.spoledge.aacdecoder.AACPlayer$1.run(AACPlayer.java:296) at java.lang.Thread.run(Thread.java:841) (I also use universalimageloader)
tagged with: android
answer count: 1

inheritance
tags question: http://stackoverflow.com/q/23069022
tags question: http://stackoverflow.com/q/23087174
tags question: http://stackoverflow.com/q/23041693
tags question: http://stackoverflow.com/q/23001314
tags question: http://stackoverflow.com/q/23051945
tags question: http://stackoverflow.com/q/23019950
tags question: http://stackoverflow.com/q/23098385
tags question: http://stackoverflow.com/q/23116287
tags question: http://stackoverflow.com/q/23005656
tag name: inheritance
tags question: http://stackoverflow.com/q/23090905
tags question: http://stackoverflow.com/q/23050833
tags question: http://stackoverflow.com/q/23098155
tags question: http://stackoverflow.com/q/22968423
tags question: http://stackoverflow.com/q/23067143
tags question: http://stackoverflow.com/q/23108727
tags question: http://stackoverflow.com/q/23050299
tags question: http://stackoverflow.com/q/22983715
tags question: http://stackoverflow.com/q/23087212
tags question: http://stackoverflow.com/q/23017162
tags question: http://stackoverflow.com/q/23069154
tags question: http://stackoverflow.com/q/23064558
type: Tag
tags question: http://stackoverflow.com/q/23032008
tags question: http://stackoverflow.com/q/23022495
tags question: http://stackoverflow.com/q/23025248
tags question: http://stackoverflow.com/q/23002754
tags question: http://stackoverflow.com/q/23103901
tags question: http://stackoverflow.com/q/23046449
tags question: http://stackoverflow.com/q/23082520
tags question: http://stackoverflow.com/q/23066476
tags question: http://stackoverflow.com/q/23088804
tags question: http://stackoverflow.com/q/23035218
tags question: http://stackoverflow.com/q/23126247
tags question: http://stackoverflow.com/q/23042236
tags question: http://stackoverflow.com/q/23128728
tags question: http://stackoverflow.com/q/23103498
tags question: http://stackoverflow.com/q/23096031
tags question: http://stackoverflow.com/q/22976140
tags question: http://stackoverflow.com/q/23049583
tags question: http://stackoverflow.com/q/23081671
tags question: http://stackoverflow.com/q/23015807
tags question: http://stackoverflow.com/q/23096305
tags question: http://stackoverflow.com/q/23040661
tags question: http://stackoverflow.com/q/23124861
tags question: http://stackoverflow.com/q/23055354

http://stackoverflow.com/a/23048133
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23047857
has body: 1- I'm a native Portuguese speaker and please follow my advice: "Write code in English." It is easier for the world to read and when you get to conventions your methods will have names like getSomething() or setSomething(something). 2- About your problem. Try: for (int i = 0 ; i &lt; 60; i++){ System.out.println(i + " " + factorial(i)); } You will see that around 12 you start getting strange values because an int in java is limited to 2^31-1 and you are getting overflows: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html You can try a long. But that will also overflow long before 51. You will have to use the BigInteger class that handles arbitrary values. public static BigInteger factorial(BigInteger number) { if ((number.compareTo(BigInteger.ZERO) == 0) || (number.compareTo(BigInteger.ONE) == 0)) { return BigInteger.ONE; } else { return number.multiply(factorial(number.subtract(BigInteger.ONE))); } }
downvote count: 0

http://stackoverflow.com/q/23052480
has comment: http://stackoverflow.com/comment/35270676
has comment: http://stackoverflow.com/comment/35223695
has answer: http://stackoverflow.com/a/23054424
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35225537
accepted answer: http://stackoverflow.com/a/23054424
linked to: http://stackoverflow.com/q/12293158
upvote count: 2
has title: Movement of scroll bar in drop down using mouse movements in Selenium Webdriver
has comment: http://stackoverflow.com/comment/35270820
tagged with: selenium-webdriver
score: 2
type: AnsweredQuestion
has body: I am new to Selenium and I have been working on Selenium Webdriver. I have a huge list in a drop down and I want to move the scroll bar down using the click of a mouse. So, my question is "How to move scroll bar in drop down using mouse click in Selenium Webdriver?" . Any help would be great. Thank you in advance.
tagged with: java
tagged with: selenium
tagged with: webdriver
type: Question

http://stackoverflow.com/comment/35268546
type: AnswerComment
type: Comment
has text: Didn't it throw an error? If not, can you please share the website where I can try and let you know answer if I can?
comment on: http://stackoverflow.com/a/23075087
score: 1

http://stackoverflow.com/a/23098591
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35333447
upvote count: 1
answers question: http://stackoverflow.com/q/23098312
downvote count: 0
has body: This is not a Eclipse issue, it is a Java feature. The Java Language Specification makes the following restrictions The members of a package are its subpackages and all the top level class types (§7.6, §8 (Classes)) and top level interface types (§9 (Interfaces)) declared in all the compilation units (§7.3) of the package. and A package may not contain two members of the same name, or a compile-time error results. In your example, org.a is a package. You want it to have two members: the type org.a.a and the package org.a.a. The Java Language does not allow this. Java conventions state that your package names should start with a lowecase letter while your type names should start with an uppercase letter. If you follow these conventions, such problems will never arise.
has comment: http://stackoverflow.com/comment/35310352

http://stackoverflow.com/comment/35201394
type: AnswerComment
comment on: http://stackoverflow.com/a/23040261
type: Comment
score: 1
has text: @Noname I answered that in my comment. The one containing the question that you're ignoring.

http://stackoverflow.com/comment/35304141
type: AnswerComment
score: 0
type: Comment
has text: please run the sample code I have in the top part of my answer in order to show you that there is a different in size.
comment on: http://stackoverflow.com/a/23096761

http://stackoverflow.com/q/23126587
has comment: http://stackoverflow.com/comment/35357119
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
answer count: 1
tagged with: jsp
favorite count: 0
accepted answer: http://stackoverflow.com/a/23129426
has body: I am trying to download a PDF file with Struts2. For generating the PDF I am using PDFBox. I am able to download the PDF file, but the problem is that its size is 0 bytes. Action Class public class BarcodeAction extends ActionSupport { private InputStream inputStream; //getter and setter public String getPdf() { System.out.println("Get Pdf"); PDDocument document = null; try { document = new PDDocument(); PDPage page = new PDPage(); document.addPage(page); PDFont headingFont = PDType1Font.TIMES_ROMAN; PDPageContentStream contentStream = new PDPageContentStream(document, page, false, true); contentStream.beginText(); contentStream.setFont(headingFont, 26); contentStream.moveTextPositionByAmount(250, 700); contentStream.drawString("Hello World !"); contentStream.endText(); contentStream.close(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); document.save(bos); setInputStream(new ByteArrayInputStream(bos.toByteArray())); document.close(); } catch (IOException e) { e.printStackTrace(); } catch (COSVisitorException e) { e.printStackTrace(); } return SUCCESS; } } struts.xml attachment;filename=test.pdf application/pdf inputStream 1024 /pages/ExpNImp/Export.jsp /pages/login.jsp How to download the PDF file properly ?
type: AnsweredQuestion
has title: Pdf file is not downloading with content
has comment: http://stackoverflow.com/comment/35361286
has comment: http://stackoverflow.com/comment/35359705
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35358373
tagged with: pdfbox
tagged with: struts2
has answer: http://stackoverflow.com/a/23129426

http://stackoverflow.com/a/23010155
has comment: http://stackoverflow.com/comment/35146732
type: Answer
accepted answer of: http://stackoverflow.com/q/23010101
answers question: http://stackoverflow.com/q/23010101
has body: Use (\w{4}_)FILE(_\w{2}) instead and replace with $1DOCUMENT$2.
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/35190806
has text: edited the code to replace == with .equals() but the issue doesn't get resolved by this quick fix.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23034212
score: 1

http://stackoverflow.com/a/23137729
upvote count: 7
answers question: http://stackoverflow.com/q/23052300
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23052300
has body: The problem is caused by the jersey-media-multipart lib which is included in your WAR file. This lib is already included in Glassfish 4, but it is loaded with a different classloader then the web application and can't be seen by the web application's classloader, therefore the error. You have to exclude it from packaging by setting the scope to provided like this: org.glassfish.jersey.media jersey-media-multipart 2.7 provided I guess you also don't need to add the MultiPartFeature.class in ApplicationConfig.java, but this shouldn't cause this error. Make sure to clean and build your project before redeploying it.
type: Answer
score: 7

nodelist
type: Tag
tags question: http://stackoverflow.com/q/23113261
tag name: nodelist

spring
tags question: http://stackoverflow.com/q/23125397
tags question: http://stackoverflow.com/q/23014761
tags question: http://stackoverflow.com/q/22974901
tags question: http://stackoverflow.com/q/23020532
tags question: http://stackoverflow.com/q/22974568
tags question: http://stackoverflow.com/q/23038261
tags question: http://stackoverflow.com/q/23094415
tags question: http://stackoverflow.com/q/23103706
tags question: http://stackoverflow.com/q/23056601
tags question: http://stackoverflow.com/q/23011589
tags question: http://stackoverflow.com/q/23014644
tags question: http://stackoverflow.com/q/23118478
tags question: http://stackoverflow.com/q/22984276
tags question: http://stackoverflow.com/q/22985846
tags question: http://stackoverflow.com/q/23025067
tags question: http://stackoverflow.com/q/22998776
tags question: http://stackoverflow.com/q/23080102
tags question: http://stackoverflow.com/q/23095908
tags question: http://stackoverflow.com/q/23029328
tags question: http://stackoverflow.com/q/22984415
tags question: http://stackoverflow.com/q/23023732
tags question: http://stackoverflow.com/q/23026408
tags question: http://stackoverflow.com/q/23080668
tags question: http://stackoverflow.com/q/23035030
tags question: http://stackoverflow.com/q/23088597
tags question: http://stackoverflow.com/q/23055906
tags question: http://stackoverflow.com/q/23069495
tags question: http://stackoverflow.com/q/23077222
tags question: http://stackoverflow.com/q/22999070
tags question: http://stackoverflow.com/q/23128660
tags question: http://stackoverflow.com/q/23049498
tags question: http://stackoverflow.com/q/23086866
tags question: http://stackoverflow.com/q/23019052
tags question: http://stackoverflow.com/q/23050177
tags question: http://stackoverflow.com/q/23030872
tags question: http://stackoverflow.com/q/23114050
tags question: http://stackoverflow.com/q/23121805
tags question: http://stackoverflow.com/q/23110337
tags question: http://stackoverflow.com/q/23064443
tags question: http://stackoverflow.com/q/23009030
tags question: http://stackoverflow.com/q/23017900
tags question: http://stackoverflow.com/q/23104510
tags question: http://stackoverflow.com/q/23087136
tags question: http://stackoverflow.com/q/23125641
tags question: http://stackoverflow.com/q/23074676
tags question: http://stackoverflow.com/q/23009458
tags question: http://stackoverflow.com/q/23020497
tags question: http://stackoverflow.com/q/23096350
tags question: http://stackoverflow.com/q/22988056
tags question: http://stackoverflow.com/q/23047585
tags question: http://stackoverflow.com/q/23107235
tags question: http://stackoverflow.com/q/23022331
type: Tag
tags question: http://stackoverflow.com/q/23096078
tags question: http://stackoverflow.com/q/23126121
tags question: http://stackoverflow.com/q/23077573
tags question: http://stackoverflow.com/q/23098132
tags question: http://stackoverflow.com/q/23081699
tags question: http://stackoverflow.com/q/22972762
tags question: http://stackoverflow.com/q/23111402
tags question: http://stackoverflow.com/q/23001589
tags question: http://stackoverflow.com/q/22971831
tags question: http://stackoverflow.com/q/23078660
tags question: http://stackoverflow.com/q/23061528
tags question: http://stackoverflow.com/q/23030646
tags question: http://stackoverflow.com/q/22999540
tags question: http://stackoverflow.com/q/22987656
tags question: http://stackoverflow.com/q/23052155
tags question: http://stackoverflow.com/q/23094638
tags question: http://stackoverflow.com/q/23055745
tags question: http://stackoverflow.com/q/23017419
tags question: http://stackoverflow.com/q/23062293
tags question: http://stackoverflow.com/q/23041164
tags question: http://stackoverflow.com/q/23008810
tags question: http://stackoverflow.com/q/23064024
tags question: http://stackoverflow.com/q/23077139
tags question: http://stackoverflow.com/q/23029458
tags question: http://stackoverflow.com/q/23001609
tags question: http://stackoverflow.com/q/23113674
tags question: http://stackoverflow.com/q/22999278

http://stackoverflow.com/q/23080757
linked to: http://stackoverflow.com/q/14886232
type: UnansweredQuestion
answer count: 0
tagged with: java
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/35275039
has comment: http://stackoverflow.com/comment/35274675
score: 0
has comment: http://stackoverflow.com/comment/35274727
has title: Stop clearing graphics on repaint();?
has body: I'm creating a simple Breakout game and I've encountered a couple of problems. First off, I need to render the bricks, the paddle, etc... I need to generally render everything on the screen that's needed. However, I don't want, for example, the bricks to continuously render; you can see where the render is occurring as it happens. There's a flash of white. So, my question is: is it possible to render only certain objects, or more specifically, only render what needs to be rendered? Every time I call repaint(); I don't want the whole screen to clear and repaint.
tagged with: buffering
has comment: http://stackoverflow.com/comment/35274965

http://stackoverflow.com/comment/35300229
type: QuestionComment
has text: You put them in a group. That's *exactly* what that does.
comment on: http://stackoverflow.com/q/23094484
score: 0
type: Comment

http://stackoverflow.com/comment/35145098
type: QuestionComment
has text: web.xml and indeed your servlet.xml...
type: Comment
comment on: http://stackoverflow.com/q/23008900
score: 0

http://stackoverflow.com/a/23014612
has comment: http://stackoverflow.com/comment/35155011
answers question: http://stackoverflow.com/q/23014455
has comment: http://stackoverflow.com/comment/35162111
has comment: http://stackoverflow.com/comment/35162168
type: Answer
has comment: http://stackoverflow.com/comment/35161528
score: 1
has comment: http://stackoverflow.com/comment/35162084
upvote count: 1
downvote count: 0
has body: Any variables you declare within an ActionListener won't be visible to the rest of your code. Either you need to set a variable (from within the listener) that has wider scope: public class Listen { String usefulResult = null; public Listen() { final JTextField textOperand = new JTextField(); textOperand.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Listen.this.usefulResult = textOperand.getText(); } }); } } Here we use the "OuterClass.this" trick to access the surrounding scope without needing a final variable. or you need to perform all the necessary work from within the listener itself (i.e. you don't "retrieve" the value, you just use the value): public void doSomethingUseful(String usefulValue) { /* add code here */ } textOperand.addActionListener( new ActionListener () { public void actionPerformed(ActionEvent e) { doSomethingUseful(textOperand.getText()); } }); Or you could use this second technique to call a setter method that changes the value of a variable, avoiding the problems of accessing final variables within event listeners: public class Listen { String usefulResult = null; public void setUseful(String usefulValue){ usefulResult = usefulValue; } public Listen() { final JTextField textOperand = new JTextField(); textOperand.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setUseful(textOperand.getText()); } }); } } It depends what you want to do with the value from the TextField.

http://stackoverflow.com/a/22973589
score: -2
answers question: http://stackoverflow.com/q/22973505
has body: public String getcountervalue() { String Return_string = Integer.toString(value); while(Return_string.length &lt; 3){ Return_string = '0'+Return_string; } return (Return_string); }
has comment: http://stackoverflow.com/comment/35081205
type: Answer
has comment: http://stackoverflow.com/comment/35081079
upvote count: 0
has comment: http://stackoverflow.com/comment/35081106
has comment: http://stackoverflow.com/comment/35081163
downvote count: 2

http://stackoverflow.com/a/23062588
answers question: http://stackoverflow.com/q/23051903
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23051903
type: Answer
has body: This is part of a more direct JEE problem of sharing objects between servlets. When I do this (including for Jena models), I tend to not take a pure JEE method for solving this. My approaches would tend to be: (Recommended) Use an EE dependency injection framework like Spring to inject a bean into the servlet. This can be done without spring using J2EE facilities as well (link). (hack) Use a central factory/registry that I've defined in the web app that allows servlets to retrieve that singleton. The hack is quick and dirty and doesn't require you to learn an EE framework in order to keep moving. Somewhere in your code, define a factory for returning that instance: public class MyFactory { private static final Model THE_INSTANCE = ModelFactory.createDefaultModel(); static { // Use this static initializer for any other model setup stuff. } public static Model getModel() { return THE_INSTANCE; } } Then within your servlet, you would retrieve the instance simply by calling MyFactory.getModel(). You'll need to deal with Jena concurrency on your own, in either approach, mind you. EDIT: an important assumption of this is that the external jar is available on your classpath. This is managed when packaging and deploying your WAR. If you do not have the jar on your classpath already, then there is other work that needs to be done.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35291247
has comment: http://stackoverflow.com/comment/35291472
has comment: http://stackoverflow.com/comment/35292286
has comment: http://stackoverflow.com/comment/35289018
has comment: http://stackoverflow.com/comment/35286571

http://stackoverflow.com/q/23092548
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/35296392
type: Question
tagged with: try-catch
has body: I wrote this statement in the main method the Exception will be in the (GuaranteeYears) so i put it in the try block. First in the main I make a Store object and pass number 4 in parameter, in the Store class I will have a array called arrProduct that will have the length 4: boolean flag1 = true; while (flag1) { try { System.out.println("Ente GuaranteeYears"); int GuaranteeYears=read.nextInt(); StrongDevice s = new StrongDevice(code,type,price,Model,Capacity,GuaranteeYears); //the object flag1 = false; x.addProduct(s); } and this is my add method public boolean addProduct(Product p) { if(arrProduct.length==NumOfProduct) return false; arrProduct[NumOfProduct]=p; NumOfProduct++; return true; } My question is: when I make the object and add it to the array it gives me NullPointerException - why that happened?
has title: catch Exception with add
answer count: 1
has comment: http://stackoverflow.com/comment/35296416
favorite count: 0
tagged with: exception
downvote count: 1
has answer: http://stackoverflow.com/a/23093139
accepted answer: http://stackoverflow.com/a/23093139
upvote count: 0
duplicate of: http://stackoverflow.com/q/218384
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/218384

rtmp
tag name: rtmp
tags question: http://stackoverflow.com/q/23126842
type: Tag

opennlp
type: Tag
tags question: http://stackoverflow.com/q/22983003
tags question: http://stackoverflow.com/q/23053133
tag name: opennlp

http://stackoverflow.com/q/23118832
score: 0
tagged with: android-alarms
has comment: http://stackoverflow.com/comment/35345047
has comment: http://stackoverflow.com/comment/35344466
has comment: http://stackoverflow.com/comment/35344850
has comment: http://stackoverflow.com/comment/35345011
has title: Using/understanding Alarm manager force close [Android]
tagged with: android-logcat
type: UnansweredQuestion
tagged with: android
answer count: 0
type: Question
has body: My android app keeps force closing, due to the recent addition of Alarm manager. I am new to alarm manager and did what i did with parts of tutorials. In the code i have said where i have put my 'doing code' (not sure if this is the right place?). Pls also mention where i should put other parts of my code, that are not affected be alarm manager. Here is my logcat: 04-16 14:36:52.011: E/AndroidRuntime(1127): FATAL EXCEPTION: main 04-16 14:36:52.011: E/AndroidRuntime(1127): Process: com.knight, PID: 1127 04-16 14:36:52.011: E/AndroidRuntime(1127): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.knight./com.knight.MainActivity}: java.lang.NullPointerException 04-16 14:36:52.011: E/AndroidRuntime(1127): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121) 04-16 14:36:52.011: E/AndroidRuntime(1127): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 04-16 14:36:52.011: E/AndroidRuntime(1127): at android.app.ActivityThread.access$800(ActivityThread.java:135) 04-16 14:36:52.011: E/AndroidRuntime(1127): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 04-16 14:36:52.011: E/AndroidRuntime(1127): at android.os.Handler.dispatchMessage(Handler.java:102) 04-16 14:36:52.011: E/AndroidRuntime(1127): at android.os.Looper.loop(Looper.java:136) 04-16 14:36:52.011: E/AndroidRuntime(1127): at android.app.ActivityThread.main(ActivityThread.java:5017) 04-16 14:36:52.011: E/AndroidRuntime(1127): at java.lang.reflect.Method.invokeNative(Native Method) 04-16 14:36:52.011: E/AndroidRuntime(1127): at java.lang.reflect.Method.invoke(Method.java:515) 04-16 14:36:52.011: E/AndroidRuntime(1127): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 04-16 14:36:52.011: E/AndroidRuntime(1127): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 04-16 14:36:52.011: E/AndroidRuntime(1127): at dalvik.system.NativeStart.main(Native Method) 04-16 14:36:52.011: E…
tagged with: java
tagged with: alarmmanager

http://stackoverflow.com/a/22976727
has comment: http://stackoverflow.com/comment/35086778
accepted answer of: http://stackoverflow.com/q/22976394
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22976394
type: Answer
upvote count: 1
score: 1
has body: I'm not sure why your array would be 2 dimensional, but for a 1-dimensional array containing a series of shorts with RLE like you specify, this would be how to decompress it: public static short[] decompress(short[] input) { int outputLength = 0; /* First we need to figure out how long the output is going to be when uncompressed, so we iterate through the input like we are would normally, but write no output, instead computing the output length */ //note the += 2; we want to skip the actual output for(int i = 0; i &lt; input.length; i += 2) { outputLength += input[i]; //increment target length } /* Now that we know what the output size will be, we can create an array to store it. */ short[] output = new short[outputLength]; /* Now iterate over the input, putting every other input short into the output, duplicated the number of times of the current input AKA: decompression of RLE */ for(int i = 0, outOffset = 0; i&lt; input.length; i += 2) { for(int ii = 0; ii &lt; input[i]; ii++) output[ii + outOffset++] = input[i + 1]; } return output; } If your 2-dimensional array is simply an array of input arrays, then simply perform that procedure on each of the input arrays.

http://stackoverflow.com/comment/35347485
comment on: http://stackoverflow.com/a/23121398
has text: this assumes `printComputer()` returns a string. if not, you'll have to put the split in wherever it's printing.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35105193
comment on: http://stackoverflow.com/q/22987107
type: Comment
has text: Thank you, I was getting a bit confused as to what modulus operator actually gives.
type: QuestionComment
score: 0

http://stackoverflow.com/q/23019150
has title: Swap a 2-D array rows
type: Question
linked to: http://stackoverflow.com/q/40480
upvote count: 1
has body: I use this code for swap a 2-d array rows (A and B): public static void swapRows(int[][] array, int[] rowA, int[] rowB) { int[] tempRow; tempRow = rowA; rowA = rowB; rowB = tempRow; } But after call this method and displayed array, It not changed at all! Why?
tagged with: arrays
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35163408
has answer: http://stackoverflow.com/a/23019205
accepted answer: http://stackoverflow.com/a/23019205
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35163295
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/23025984
has answer: http://stackoverflow.com/a/23025991
has title: How to call a second method when another first method returns true?
tagged with: java
has comment: http://stackoverflow.com/comment/35176375
has body: I have two methods here. I want the void levelUp to check if the checkWin method returns true. It it does I would then like it to call the initLevel method with the parameters ++currentLevel. This is what I have so far but it is not behaving as I would like. Any suggestions? Thanks, Tim void levelUp(boolean checkWin) { if (checkWin) { initLevel(++currentLevel); return; } } public boolean checkWin () { for (int i=0; i &lt; levelData.length;i++) { for (int k=0; k &lt; levelData[i].length;k++) { if (levelData[i][k] == Contents.BOX) { return false; } } } return true; }
score: 0
accepted answer: http://stackoverflow.com/a/23025995
answer count: 2
has answer: http://stackoverflow.com/a/23025995
type: AnsweredQuestion
type: Question
possible better answer: http://stackoverflow.com/a/23025991

http://stackoverflow.com/comment/35340690
comment on: http://stackoverflow.com/q/23114050
score: 0
type: Comment
has text: Mostly Its something to do with the way LogonUtilities is used. Make sure LogonUtilities is correctly initialized in a spring way. You are using @service. so make sure component scan happens on this package.
type: QuestionComment

http://stackoverflow.com/q/23055487
linked to: http://stackoverflow.com/q/128038
type: Question
tagged with: mutex
answer count: 2
tagged with: locking
upvote count: 5
has body: I need to implement some kind of inter-process mutex in Java. I'm considering using the FileLock API as recommended in this thread. I'll basically be using a dummy file and locking it in each process. Is this the best approach? Or is something like this built in the standard API (I can't find it). For more details see below: I have written an application which reads some input files and updates some database tables according to what it finds in them (it's more complex, but business logic is irrelevant here). I need to ensure mutual exclusion between multiple database updates. I tried to implement this with LOCK TABLE, but this is unsupported by the engine I'm using. So, I want to implement the locking support in the application code.
possible better answer: http://stackoverflow.com/a/23055899
has answer: http://stackoverflow.com/a/26889762
has answer: http://stackoverflow.com/a/23055899
downvote count: 0
favorite count: 0
score: 5
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26889762
has title: Java inter-process mutex
tagged with: java

http://stackoverflow.com/q/23049489
has body: I am developing a native C library that needs bindings to Java (JNI) in both Oracle and Android NDK settings, Ruby, Python, and Perl. I have written bindings in all these environments individually. But is there any best practice wisdom for setting up such a project in Eclipse so that all the bindings compile automatically from a common C codebase? If not Eclipse, then Netbeans? I do realize that memory allocation within the library will need to be different for each language platform, but this appears manageable with macros.
answer count: 0
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/79422479
type: Question
upvote count: 2
has title: Best practice for multiple native code library binding development?
tagged with: perl
linked to: http://stackoverflow.com/q/271488
favorite count: 0
tagged with: ruby
tagged with: netbeans

http://stackoverflow.com/q/23126867
has answer: http://stackoverflow.com/a/44089383
has comment: http://stackoverflow.com/comment/35364320
tagged with: tomcat
has answer: http://stackoverflow.com/a/28127948
answer count: 3
downvote count: 0
tagged with: deployment
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/35365275
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35364285
has title: Cannot deploy java Web Application to Tomcat in Netbeans
linked to: http://stackoverflow.com/q/42084188
score: 1
has answer: http://stackoverflow.com/a/79129997
tagged with: java
has comment: http://stackoverflow.com/comment/35364218
upvote count: 1
has comment: http://stackoverflow.com/comment/35369032
has body: I am going to write several simple web apps, but I have an issue with deploying applications. I use NetBeans IDE 8.0 (Build 201403101706) with Apache Tomcat 8.0.3 (that came along with Netbeans). After I click 'deploy' on my web app, there is a new WebApplication1 run-deploy window. It contains: ant -f C:\\Users\\chechulin\\Documents\\NetBeansProjects\\WebApplication1 -Dbrowser.context=C:\\Users\\chechulin\\Documents\\NetBeansProjects\\WebApplication1 -DforceRedeploy=true -Ddirectory.deployment.supported=true -Dnb.wait.for.caches=true -Dnb.internal.action.name=redeploy run-deploy init: deps-module-jar: deps-ear-jar: deps-jar: library-inclusion-in-archive: library-inclusion-in-manifest: compile: compile-jsps: And there is a never-ending 'Deploying WebApplication1" process. Server shows that there is no apps. And I cannot expand Web Applications node that should be like on the following picture: But when I take .war file from the project /dist directory and manually deploy in to the server, it works fine! I just cannot figure where is the problem!
type: Question
has comment: http://stackoverflow.com/comment/35364891
has comment: http://stackoverflow.com/comment/35365856

http://stackoverflow.com/comment/35160455
comment on: http://stackoverflow.com/q/23017631
type: QuestionComment
type: Comment
score: 0
has text: I know it may seem trivial, but with such a lot of code you would do well to format it properly - it will make it easier for people to read and to help you. In eclipse, press ctrl, shift and f. It will format it for you.

http://stackoverflow.com/q/23017685
upvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23019310
has title: How to get how many pixels I moved on a MotionEvent.ACTION_MOVE event in Android
type: Question
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has body: I have a touch listener that watches for ACTION_DOWN, ACTION_MOVE, and ACTION_UP. I want to get the number of pixels moved, but I can't find anything in the documentation that allows this. } else if (motionEvent.getAction() == MotionEvent.ACTION_MOVE) { float x2 = motionEvent.getX(); float y2 = motionEvent.getY(); //Logging x2 and y2.... My log outputs pretty big numbers, even though I move very very slightly. I try to move 1 pixel in either direction with my mouse pointer, but I get results like 42 for x and 75 for y. I'm guessing getX() and getY() do not respond with what I think they respond with. EDIT: public boolean onTouch(View v, MotionEvent motionEvent) { float startX = 0; float startY = 0; if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { startX = motionEvent.getRawX(); startY = motionEvent.getRawY(); Log.e("resize", "action down"); } else if (motionEvent.getAction() == MotionEvent.ACTION_MOVE) { Log.e("resize", "action move"); float movedX = motionEvent.getRawX() - startX; float movedY = motionEvent.getRawY() - startY; Log.e("", " movement "+movedX+" "+movedY+"");
accepted answer: http://stackoverflow.com/a/23019310
tagged with: android

http://stackoverflow.com/comment/35072425
type: Comment
score: 0
type: AnswerComment
has text: @jan Updated with my preferred solution.
comment on: http://stackoverflow.com/a/22969021

http://stackoverflow.com/comment/35157091
type: QuestionComment
type: Comment
has text: Please see http://stackoverflow.com/help/how-to-ask. You should definitely add your exception to this question
score: 0
comment on: http://stackoverflow.com/q/23015494

storage
tag name: storage
type: Tag
tags question: http://stackoverflow.com/q/23047417

http://stackoverflow.com/q/23049694
tagged with: java
answer count: 2
has body: I'm manipulating a dataTable in order to display a List of objects. In the first 4 columns it shows attributes related to the object such as año(year),etc.., as you can see in the image below. The thing is.., in the 5th,I want to insert in a one simple column, an image that is common to all the objects in the table. Is there a way to to this with jsf ?
has answer: http://stackoverflow.com/a/23061925
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23060144
type: Question
has answer: http://stackoverflow.com/a/23060144
linked to: http://stackoverflow.com/q/3111081
accepted answer: http://stackoverflow.com/a/23061925
tagged with: datatable
has title: One common column in a jsf datatable
tagged with: jsf
score: 0

http://stackoverflow.com/q/23106416
tagged with: swing
has comment: http://stackoverflow.com/comment/35319650
tagged with: java
has body: I am reading data from csv file and displaying it on JTable.but I want to display only selected row for eg.where DesignSize=M DESIGNCOLOR,DESIGNSIZE,STARTDATE ORANGE,L,2013-06-12 00:00:00.0 ORANGE,M,2013-06-12 00:00:00.0 ORANGE,S,2013-06-12 00:00:00.0 ORANGE,XL,2013-06-12 00:00:00.0 ORANGE,XXL,2013-06-12 00:00:00.0 here is the code what I am doing public class Csv2TableModel extends JPanel { public static DefaultTableModel createTableModel( Reader in, Vector&lt;Object&gt; headers) { DefaultTableModel model = null; Scanner s = null; Vector&lt;Object&gt; c; try { Vector&lt;Vector&lt;Object&gt;&gt; rows = new Vector&lt;Vector&lt;Object&gt;&gt;(); s = new Scanner(in); while (s.hasNextLine()) { rows.add(new Vector&lt;Object&gt;( Arrays.asList(s.nextLine().split("\\s*,\\s*", -1)))); } if (headers == null) { headers = rows.remove(0); model = new DefaultTableModel(rows, headers); } else { model = new DefaultTableModel(rows, headers); } return model; } finally { s.close(); } } public static void main(String[] args) { try { String datafile = "C:\\seema\\CSV Files\\2013\\June\\12.csv"; FileReader fin = new FileReader(datafile); DefaultTableModel m = createTableModel(fin, null); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new JScrollPane(new JTable(m))); f.setSize(1000, 400); f.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } } Is there any way to filter CSV file by specific criteria?
type: Question
tagged with: jtable
has title: How to filter rows from CSV file and dispaly it on JTable using java
has comment: http://stackoverflow.com/comment/35322249
tagged with: rowfilter
score: 0
tagged with: file-io
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35206518
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23043259
type: QuestionComment
has text: Welcome to Stack Overflow! Asking people to spot errors in your code is not especially productive. You should use the debugger (or add print statements) to isolate the problem, by tracing the progress of your program, and comparing it to what you expect to happen. As soon as the two diverge, then you've found your problem. (And then if necessary, you should construct a [minimal test-case](http://stackoverflow.com/help/mcve).)

http://stackoverflow.com/comment/35366694
comment on: http://stackoverflow.com/a/23125158
type: Comment
score: 0
type: AnswerComment
has text: Actually that code is not required.ye str_date is the required format.but,when I parse it to date again the format is being changed

http://stackoverflow.com/a/23100709
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23100667
type: AcceptedAnswer
downvote count: 0
has body: Use Collections.reverse(aList); Where aList is your listview.
type: Answer
accepted answer of: http://stackoverflow.com/q/23100667

http://stackoverflow.com/comment/35281526
comment on: http://stackoverflow.com/a/23084627
score: 0
has text: @hil_20686 generally, this *is right*. But *sanity and generally* does not create super fast code. LMAX for example...
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23036337
type: Question
has comment: http://stackoverflow.com/comment/35194651
has answer: http://stackoverflow.com/a/23036702
has comment: http://stackoverflow.com/comment/35194673
answer count: 2
has comment: http://stackoverflow.com/comment/35194859
downvote count: 0
favorite count: 0
has title: Parse and save lines from text file
upvote count: 2
type: UnansweredQuestion
has body: I'm trying to scan a text file that has a format like this: reviewers: 0 open: Sunday 08:00 16:00,Monday 06:00 20:00,Tuesday 06:00 20:00,Wednesday 06:00 20:00,Thursday 06:00 20:00,Friday 06:00 20:00,Saturday 06:00 01:00 name: The Lyre of Orpheus city: San Francisco cost: $$ category: Greek,Breakfast &amp; Brunch,Seafood,Salad,Soup rank: 0 and saving each line as a string or double, but i keep getting null with the sys.out.println inside of my forloop, anything I can change? My thought is that I'm resetting my variables inside my try too early or something. public class Yulp { //instance vars ArrayList&lt;Restaurant&gt; resList = new ArrayList&lt;Restaurant&gt;(); public static void main(String args[]) { Yulp yelp = new Yulp(); yelp.scan(); for(int i = 0; i &lt; yelp.resList.size(); i++){ System.out.println(yelp.resList.get(i).getCity()); } } public void scan() { try { Restaurant tempRes = new Restaurant(); String name, city, category, cost; double rank, reviewers; Scanner scan = new Scanner(new File("randomizedList.txt")); while (scan.hasNext()) { //name = null; city = null; category = null; cost = null; rank = 0.0; reviewers = 0; String line = scan.nextLine(); String rest = omitPrefix(line, "reviewers:"); if (rest != null) { reviewers = Double.parseDouble(rest); tempRes.setReviewers(reviewers); } rest = omitPrefix(line, "rank:"); if (rest != null) { rank = Double.parseDouble(rest); } rest = omitPrefix(line, "name:"); if (rest != null) { name = rest; } rest = omitPrefix(line, "city:"); if (rest != null) { city = rest; } rest = omitPrefix(line, "category:"); if (rest != null) { category = rest; } rest = omitPrefix(line, "cost:"); if (rest != null) { cost = rest; } resList.add(tempRes); } scan.close(); } catch (FileNotFoundException e) { System.out.println("File not found"); } } private String omitPrefix(String line, String prefix) { if (line.startsWith(prefix)) return line.substring(prefix.length()); return null; } }
score: 2
tagged with: java.util.scanner
tagged with: java
has answer: http://stackoverflow.com/a/23036580

http://stackoverflow.com/q/23049583
answer count: 4
has answer: http://stackoverflow.com/a/23049665
has answer: http://stackoverflow.com/a/23049611
possible better answer: http://stackoverflow.com/a/23049607
downvote count: 0
has answer: http://stackoverflow.com/a/23049607
has answer: http://stackoverflow.com/a/23049610
tagged with: superclass
type: Question
type: AnsweredQuestion
tagged with: java
has title: Inheritance: weaker accessibility of a method in subclass
tagged with: inheritance
score: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/23049611
has body: what is the need of having a rule like this in java : "a subclass cannot weaken the accessibility of a method defined in the superclass"
tagged with: subclass
upvote count: 4

http://stackoverflow.com/q/23093712
has answer: http://stackoverflow.com/a/23101932
tagged with: tomcat
tagged with: maven-3
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/37037177
possible better answer: http://stackoverflow.com/a/23093816
has answer: http://stackoverflow.com/a/23093816
favorite count: 0
tagged with: maven
tagged with: tomcat7
type: AnsweredQuestion
score: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/23101932
tagged with: java
has title: How to deploy a WAR to Tomcat7 server using Maven?
type: Question
has body: I have a pom.xml given below. When I run mvn tomcat:deploy, I get following error: Uploading: http://AAA.BBB.CCC.DDD:8080/manager/text/deploy?path=%2Fmyapp Uploaded: http://AAA.BBB.CCC.DDD:8080/manager/text/deploy?path=%2Fmyapp (9553 KB at 137.0 KB/sec) [INFO] tomcatManager status code:403, ReasonPhrase:Forbidden [INFO] &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/h tml4/strict.dtd"&gt; [INFO] &lt;html&gt; [INFO] &lt;head&gt; [INFO] &lt;title&gt;403 Access Denied&lt;/title&gt; [INFO] &lt;style type="text/css"&gt; [INFO] &lt;!-- [INFO] BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-colo r:white;font-size:12px;} [INFO] H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color: #525D76;font-size:22px;} [INFO] PRE, TT {border: 1px dotted #525D76} [INFO] A {color : black;}A.name {color : black;} [INFO] --&gt; [INFO] &lt;/style&gt; [INFO] &lt;/head&gt; [INFO] &lt;body&gt; [INFO] &lt;h1&gt;403 Access Denied&lt;/h1&gt; [INFO] &lt;p&gt; [INFO] You are not authorized to view this page. [INFO] &lt;/p&gt; [INFO] &lt;p&gt; [INFO] If you have already configured the Manager application to allow acces s and [INFO] you have used your browsers back button, used a saved book-mark or si milar [INFO] then you may have triggered the cross-site request forgery (CSRF) pro tection [INFO] that has been enabled for the HTML interface of the Manager applicati on. You [INFO] will need to reset this protection by returning to the [INFO] &lt;a href="/manager/html"&gt;main Manager page&lt;/a&gt;. Once you [INFO] return to this page, you will be able to continue using the Manager [INFO] appliction's HTML interface normally. If you continue to see this acc ess [INFO] denied message, check that you have the necessary permissions to acce ss this [INFO] application. [INFO] &lt;/p&gt; [INFO] &lt;p&gt; [INFO] If you have not changed [INFO] any configuration files, please examine the file [INFO] &lt;tt&gt;conf/tomcat-users.xml&lt;/tt&gt; in your i…

http://stackoverflow.com/a/27145263
has body: In my case, I use Command Prompt (cmd.exe) to package the project. When maven packs the project, it will download all plugins, dependencies (Apache Maven Shade Plugin in this case). Cd to your project. Type: mvn package After packaging, it works. Hope it helps.
upvote count: 0
answers question: http://stackoverflow.com/q/22999399
downvote count: 1
score: -1
type: Answer

http://stackoverflow.com/a/23036835
upvote count: 2
type: Answer
score: 2
has body: to return two values pack it into some object and return it ;) public class ReturnedObject{ private Object val1; private Object val2; //getters setters } public ReturnedObject yourMethod(){ ReturnedObject returnedObject = new ReturnedObject(); returnedObject.setVal1("yourVal1"); returnedObject.setVal2("yourVal2"); return returnedObject; }
answers question: http://stackoverflow.com/q/23036776
downvote count: 0

http://stackoverflow.com/a/23046926
score: 0
has comment: http://stackoverflow.com/comment/35213579
has body: public class ThousandArray { public static void main (String args[]){ int MAX = 5000; int numbers[] = new int[MAX]; for (int i = 0; i &lt; MAX; i++) { numbers[i] = (int)(Math.sqrt(i) * (Math.random()*1000)); } } }
has comment: http://stackoverflow.com/comment/35213529
has comment: http://stackoverflow.com/comment/35213555
has comment: http://stackoverflow.com/comment/35213622
type: Answer
has comment: http://stackoverflow.com/comment/35213658
has comment: http://stackoverflow.com/comment/35213634
answers question: http://stackoverflow.com/q/23046821

http://stackoverflow.com/a/23043777
answers question: http://stackoverflow.com/q/23043319
score: 1
upvote count: 1
downvote count: 0
has body: I should have added the listener to myList and not to myListScrol.
type: Answer

http://stackoverflow.com/a/51048166
has body: A note for anyone who stumbles onto this page looking for how to configure this in the application.properties file, I had success escaping the parenthesis by adding two backslashes. %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M \\(%line\\) - %msg%n
type: Answer
has comment: http://stackoverflow.com/comment/93075903
upvote count: 5
has comment: http://stackoverflow.com/comment/95989406
answers question: http://stackoverflow.com/q/23123934
score: 5
downvote count: 0

http://stackoverflow.com/comment/35088886
type: QuestionComment
comment on: http://stackoverflow.com/q/22977713
type: Comment
score: 0
has text: At the top you show the contents of adjList and ufList. Your iterator is taking stuff from ufList. Calling `adjList.get(v)` asks the HashMap to find an entry in adjList whose key is the same as `v`. But v is `v: vertex: A, rep: A` and though there's an entry in adjList with vertex: A and rep: A, the "rep: A" in adjList is different than the one in ufList. The reps contain different linked lists, so they don't match. For them to match the keys must be identical. Perhaps you should use a String as the key in the adjList HashMap and use the `UFnode.getVertex ()` value for that.

http://stackoverflow.com/comment/35087442
has text: [What's the proper way to test a class with private methods using JUnit?](http://stackoverflow.com/questions/34571/whats-the-proper-way-to-test-a-class-with-private-methods-using-junit) explains how to use `setAccessible` which works for fields as well as methods.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22977247
score: 1

http://stackoverflow.com/q/23015752
possible better answer: http://stackoverflow.com/a/25549245
upvote count: 4
accepted answer: http://stackoverflow.com/a/25578221
type: AnsweredQuestion
downvote count: 0
has body: I have a question related to the MoleculeSampleApp in the Oracle Documentation. In the function buildCamera() they create three objects of type Xform and additionally add the camera to the third one. Why do i need this three nested `Xform-Objects? Thanks in advance! private void buildCamera() { root.getChildren().add(cameraXform); cameraXform.getChildren().add(cameraXform2); cameraXform2.getChildren().add(cameraXform3); cameraXform3.getChildren().add(camera); cameraXform3.setRotateZ(180.0); camera.setNearClip(0.1); camera.setFarClip(10000.0); camera.setTranslateZ(-cameraDistance); cameraXform.ry.setAngle(320.0); cameraXform.rx.setAngle(40); }
tagged with: java
has answer: http://stackoverflow.com/a/25578221
favorite count: 0
type: Question
answer count: 2
has title: Why 3 Xform-Objects in JavaFX 3D Molecule Example
score: 4
has answer: http://stackoverflow.com/a/25549245
tagged with: javafx-8

http://stackoverflow.com/q/23101290
has answer: http://stackoverflow.com/a/23101397
has answer: http://stackoverflow.com/a/23101374
has title: how can I give the action to "MouseListener" to draw a shape in java?
answer count: 3
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/23113678
score: 1
tagged with: java
upvote count: 1
type: Question
has body: this is my code I want to draw the rectangle at the position that I clicked but it is not drawing any thing :( , I don't know how I giving the action to "MouseListener" import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Transparenttxom extends JPanel implements MouseListener { Graphics g=null; public void init(){ Transparenttxom panel=new Transparenttxom(); panel.addMouseListener(this); }//end init //******************************************************************** public void paint(Graphics g){ } //******************************************************************** public void mouseClicked(MouseEvent e){ int mousex=e.getX(); int mousey=e.getY(); g.drawRect(20,20,mousex,mousey); }//end mouseclicked method //******************************************************************** public void mouseEntered(MouseEvent e){ } public void mouseExited(MouseEvent e){ } public void mousePressed(MouseEvent e){ } public void mouseReleased(MouseEvent e){ } //******************************************************************** public static void main(String[] args) { Transparenttxom panel=new Transparenttxom(); JFrame frame = new JFrame("java lover"); frame.add(panel); frame.setSize(300, 300); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } thanks for helping.

http://stackoverflow.com/q/23044719
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35209241
has comment: http://stackoverflow.com/comment/35210438
has comment: http://stackoverflow.com/comment/35211888
tagged with: java
tagged with: database
has title: JPA use with hundreds of servers
has comment: http://stackoverflow.com/comment/35210331
has comment: http://stackoverflow.com/comment/35209445
has comment: http://stackoverflow.com/comment/35209248
has body: I have never used JPA but I am wondering if it is possible to configure it in a way that it will connect to around 200 different servers but input the exact same data into a database on each server all with the same structure.
has comment: http://stackoverflow.com/comment/35267339
tagged with: jpa
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35211828
has answer: http://stackoverflow.com/a/23047220
type: Question
has comment: http://stackoverflow.com/comment/35209584
has comment: http://stackoverflow.com/comment/35209699

http://stackoverflow.com/comment/35356024
type: Comment
has text: Thanks femtoRgon for the solution it really helped me solve my problem. Pasting the implementation of Sort in-case it would be helpful for others. TopDocs docs = searcher.search(q, hitsPerPage, new Sort(new SortField("isbn", SortField.Type.STRING))); ScoreDoc[] hits = docs.scoreDocs;
type: AnswerComment
comment on: http://stackoverflow.com/a/23091186
score: 0

http://stackoverflow.com/a/23132355
has comment: http://stackoverflow.com/comment/35398699
has comment: http://stackoverflow.com/comment/35474529
downvote count: 0
answers question: http://stackoverflow.com/q/23126273
score: 1
has comment: http://stackoverflow.com/comment/35449638
has comment: http://stackoverflow.com/comment/35451894
has comment: http://stackoverflow.com/comment/35438708
upvote count: 1
has body: hadoop fs -getmerge &lt;src&gt; &lt;localdst&gt; [addnl] -getmerge : Get all the files in the directories that match the source file pattern and merge and sort them to only one file on local fs. is kept. example: hadoop fs -getmerge /user/hdfs/test/ /home/hdfs/Desktop/merge where :/user/hdfs/test/ is hdfs dir where files to be merged reside and /home/hdfs/Desktop/merge5 is local destination path where merge file will be copied.
has comment: http://stackoverflow.com/comment/35447541
type: Answer

http://stackoverflow.com/comment/35358789
score: 1
type: AnswerComment
has text: I would not advise this because it's in the book, I cited the book because Bloch's statement is quite precise. In my opinion bitwise operations are similar to programming with pointers: there's a good deal of developers out there that don't grasp the concepts or at least have huge problems with these topics. Joel Spolsky wrote a [nice article](http://www.joelonsoftware.com/articles/fog0000000006.html) a couple of years ago. So if I would code this in a team, I would spare bitwise operations. The SCJP exam dropped bitwise ops thus communicating the connotation: "Don't use it!"
type: Comment
comment on: http://stackoverflow.com/a/23125437

http://stackoverflow.com/comment/35133715
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23002915
has text: It is now also saying field not found: scrollstyle
score: 0

http://stackoverflow.com/q/23058513
has comment: http://stackoverflow.com/comment/35234572
has title: Interface method referencing a concrete class as parameter causes coupling?
downvote count: 0
score: 1
tagged with: java
tagged with: concrete
type: Question
has answer: http://stackoverflow.com/a/23058806
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/35234395
tagged with: loose-coupling
has answer: http://stackoverflow.com/a/23058680
has answer: http://stackoverflow.com/a/23058728
favorite count: 0
has body: I was thinking about programming to interfaces and not to concrete classes, but I had a doubt: should any interface method be able to hold references to concrete classes? Suppose the following scenarios: 1) public interface AbsType1 { public boolean method1(int a); // it's ok, only primitive types here } 2) public interface AbsType2 { public boolean method2(MyClass a); // I think I have some coupling here } Should I choose a different design here in order to avoid the latter? e.g. public interface MyInterface {} // yes, this is empty public classe MyClass implements MyInterface { // basically identical to the previous "MyClass" } public interface AbsType2 { public boolean method2(MyInterface a); // this is better (as long as the // interface is really stable) } But there's still something that doesn't convince me... I feel uncomfortable with declaring an empty interface, though I saw someone else doing so. Maybe and Abstract Class would work better here? I am a little bit confused. EDIT: Ok, I'll try to be more specific by making an example. Let's say I'm desining a ShopCart and I want of course to add items to the cart: public interface ShopCart { public void addArticle(Article a); } Now, if Article were a concrete class, what if its implementation changes over time? This is why I could think of making it an Interface, but then again, it's probably not suitable at least at a semantic level because interfaces should specify behaviours and an Article has none (or almost none... I guess it's a sort of entity class). So, probably I'm ending up right now to the conclusion that making Article an abstract class in this case would be the best thing... what do you think about it?
type: UnansweredQuestion
tagged with: interface
tagged with: coupling

http://stackoverflow.com/comment/35214447
comment on: http://stackoverflow.com/a/23047233
score: 0
type: AnswerComment
has text: Is there any date in your database that is older than January 1, 1970?
type: Comment

http://stackoverflow.com/q/22999977
type: Question
has comment: http://stackoverflow.com/comment/35406696
tagged with: graphics
has title: LWJGL NVIDIA Driver Issue
upvote count: 3
answer count: 1
has comment: http://stackoverflow.com/comment/35546325
favorite count: 0
tagged with: nvidia
has body: I have a GeForce GT 650M, and I recently updated to the 335.23 Driver (latest version). Doing so sort of messed up my LWJGL engine I have been making. First of all when I include this line: org.lwjgl.opengl.ARBTextureStorage.glTexStorage2D(GL_TEXTURE_2D (int)(Math.log(Math.max(decoder.getHeight(), decoder.getWidth()))/Math.log(2))+1, GL_RGBA8, decoder.getWidth(), decoder.getHeight()); I get this error: Exception in thread "main" java.lang.IllegalStateException: Function is not supported at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58) at org.lwjgl.opengl.GL42.glTexStorage2D(GL42.java:238) at org.lwjgl.opengl.ARBTextureStorage.glTexStorage2D(ARBTextureStorage.java:22) at util.GLUtil.setUpTexture(GLUtil.java:255) So I tried removing the parts that used this, and things still don't work. My SSAO component is plain white noise, my G-Buffer is black everywhere, and the final scene either looks like this: I should mention that roughly the same thing happened with a driver update about two months ago. The previous time I could actually make out the scene, the only things wrong were the 5fps framerate, broken shadows, and inverted lighting. A new version was released in a few weeks and it was fixed. No OpenGL components of the engine have been changed for around 3 months. Could someone tell me what's going on here? I put a decent amount of work into this and I would prefer not to lose it all.
type: UnansweredQuestion
score: 3
downvote count: 0
tagged with: opengl
tagged with: java
tagged with: lwjgl
has answer: http://stackoverflow.com/a/23166030

http://stackoverflow.com/q/23034679
type: AnsweredQuestion
has body: I want to delete the repetitive(duplicate) element from an array. I am facing difficulties to do that. I have tried several ways. Can anybody find the solution for me please. Input: 3,5,6,7,3,5,3,8 Expected Output: 3 5 6 7 8 My Code: package com.nanofaroque.DeleteRepElementInArray; public class DeleteElementRepetativeElement { public static void main(String[] args) { // Here is the input Array... int[] arr = { 3, 5, 6, 7, 3, 5, 3, 8 }; int end = arr.length;// finding the length of the array for (int i = 0; i &lt; end; i++) { for (int j = i + 1; j &lt; end; j++) { if (arr[j] == arr[i]) { for (int k = j; k &lt; end; k++) { arr[k] = arr[k + 1]; } end--; } else { j++; } } } for (int i = 0; i &lt; arr.length; i++) { System.out.println(arr[i]); } } }
tagged with: arrays
has comment: http://stackoverflow.com/comment/35194369
type: Question
score: 0
has answer: http://stackoverflow.com/a/23034845
answer count: 1
has title: Repetitive(duplicate) Element Delete from an Int Array
has comment: http://stackoverflow.com/comment/35194347
tagged with: java
has comment: http://stackoverflow.com/comment/35191512
accepted answer: http://stackoverflow.com/a/23034845

http://stackoverflow.com/q/23057600
tagged with: onclicklistener
score: 0
has answer: http://stackoverflow.com/a/23057703
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23070707
has body: I have managed to successfully start two activities using the ImageButton along with .setOnClickListener tied to it, i have also included layouts with different ImageButtons. Each button launches an activity. I have created the activities. I have also managed to remover crash bugs, lint errors, have the latest Android SDK. However now the buttons stop working even though you hear the click. Neither the activity launches on the first imageButton nor the second one. This happens the moment i put multiple ImageButtons in. It works with 1 button. I suspect the (this) command in the class is confused as to what to call. My intent call method to start new activities are streamlined and basic for quick, uncomplicated access. Can someone please help me as to why the multiple setOnclickListener cannot be tied to the relevant imageButtons please? import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.content.Intent; import android.view.View.OnClickListener; import android.widget.ImageButton; public class MainActivity extends ActionBarActivity implements OnClickListener { ImageButton imageButton1; ImageButton imageButton2; ImageButton imageButton3; ImageButton imageButton4; Intent intent; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.reusable_layout); imageButton1=(ImageButton)findViewById(R.id.imageButton1); imageButton2=(ImageButton)findViewById(R.id.imageButton2); imageButton3=(ImageButton)findViewById(R.id.imageButton3); imageButton4=(ImageButton)findViewById(R.id.imageButton4); imageButton1.setOnClickListener(this); imageButton2.setOnClickListener(this); imageButton3.setOnClickListener(this); imageButton4.setOnClickListener(this); } public void onClick1(View view) { Intent intent = new Intent(this, OtherActivity.class); startActivity(intent); } public void onClick2(View view) { Int…
tagged with: eclipse
has title: Multiple ImageButtons with setOnClickListener (clicks but does not launch activities)
tagged with: imagebutton
favorite count: 0
type: UnansweredQuestion
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/23057745
has comment: http://stackoverflow.com/comment/35233173
has answer: http://stackoverflow.com/a/23057728

http://stackoverflow.com/q/23009912
linked to: http://stackoverflow.com/q/687261
has answer: http://stackoverflow.com/a/23263625
score: 1
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23263625
tagged with: opengl
tagged with: java
has title: Calculation of color position between black and white
possible better answer: http://stackoverflow.com/a/23009977
tagged with: percentage
has comment: http://stackoverflow.com/comment/35153884
has answer: http://stackoverflow.com/a/23009977
type: Question
answer count: 2
downvote count: 0
has body: When you read this title you might automatically think of luminescence, but that's not what I'm after. What I want is to have you current color and have it wait on a scale from black to white. So something like this , and then I would like the current color returned as a percentage of how black or white that color is.
favorite count: 0
tagged with: colors

http://stackoverflow.com/comment/35609152
comment on: http://stackoverflow.com/q/23118172
score: 0
type: Comment
type: QuestionComment
has text: There is a Bug registered at Pentaho's JIRA. The developers want sample reports with this occurrence. I wont be able to send them a proper anonymized example any time soon. The link is: http://jira.pentaho.com/browse/PRD-5034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel

http://stackoverflow.com/q/23090858
favorite count: 0
tagged with: jlist
has body: Im about to make a new application, and i stumbled over an very cool sidebar (button-panel) I will try to add to the application (Its the left-sidebar on Spotify). The thing im curious about, is the principble (Take a look at the picture attached). In the top theres 3 buttons (I assume its either JList or JTable items). In the middle we have a "YOUR MUSIC" header (JLabel maybe??) We also have a New Playlist (JButton) And then the Playlist list (JList or JTable?) The interresting things i would like to know is: Firstly, that the three JList (playlistList, appList and yourmusicList, i assume its JLists) share the same JScrollPane, and therefor the JList/JTables(Or whatever it is) have to change size (Height) depended on the amount of items it contains. (For Instance: The playlist list change Height dependen on if have 3 or 17 playlists.) Secondly: I managed to add Buttons, Labels, JLists in the same JPanel, but i could not figure out how to give them a shared JScrollPane (The problem occured when i tried to give two JLists same ScrollPane). I think, that i use wrong LayoutManager for the JPanel the items should be contained in, and i use the wrong kind of Component (JList, JTable). If theres a Swing Component called JSideBar or something, it would be great! Well, thats it! Theres no code example, since it woudlnt really benefit in any way Regards Oliver
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23095068
downvote count: 0
score: 1
tagged with: swing
has title: JList/JTable as button panel
type: Question
has answer: http://stackoverflow.com/a/23093214
accepted answer: http://stackoverflow.com/a/23093214
tagged with: java
tagged with: jtable
tagged with: jscrollpane
upvote count: 1
answer count: 1

http://stackoverflow.com/q/23005325
type: AnsweredQuestion
tagged with: tic-tac-toe
type: Question
has answer: http://stackoverflow.com/a/23005940
tagged with: java
score: 0
answer count: 1
has body: So I did a Tic Tac Toe assignment for my class. I have successfully created a simple Tic Tac Toe program but somehow the method to check for draw sometimes doesn't come out right. If everything is filled but there's no winner, then it's a draw. But if everything else is filled except for row 0 column 1, it will still show "draw" even if that box is still blank. If you don't get what I mean, just try filling out everything but the middle box on the top row but don't win, it will say "draw" even though that last box is not filled. What did I do wrong in my code???? Here's the driver: import javax.swing.JOptionPane; public class TwoDimensionalArray_Driverr { public static void main(String[]args) { char player = 'o'; TwoDimensionalArrayy game = new TwoDimensionalArrayy(); while (game.checkGame() == "PLAY") { if (player == 'o') player = 'x'; else player = 'o'; System.out.println(game); String input = JOptionPane.showInputDialog("Enter Position of Row for player "+ player +" or press Cancel to exit"); if (input == null) System.exit(0); int row = Integer.parseInt(input); input = JOptionPane.showInputDialog("Enter Position of Column for player " + player); int column = Integer.parseInt(input); game.set(row,column,player); game.isDraw(); game.hasWon(row,column,player); game.checkGame(); System.out.println(game.checkGame()); } if (game.checkGame()=="DRAW"){ System.out.println(game); System.out.println("It's a draw."); } else { System.out.println(game); System.out.println(player + " has won.");} } } And here is the Object: public class TwoDimensionalArrayy { private String currentState = "GO"; private char[][] board; private static final int ROWS = 3; private static final int COLUMNS = 3; public TwoDimensionalArrayy(){ board = new char[ROWS][COLUMNS]; for(int i=0;i&lt;ROWS;i++) //always do ROWS first!!!! for(int j = 0;j&lt;COLUMNS;j++) board[i][j]=' '; } public void set(int i, int j, char player) { if(board[i][j] != ' ' ) throw new IllegalArgumentException("Position Occupied")…
accepted answer: http://stackoverflow.com/a/23005940
has title: Tic Tac Toe java draw game

http://stackoverflow.com/comment/35252480
type: Comment
score: 1
type: QuestionComment
has text: Where are you using this lambda?
comment on: http://stackoverflow.com/q/23068305

http://stackoverflow.com/q/23105464
tagged with: java
has comment: http://stackoverflow.com/comment/35318331
answer count: 1
has answer: http://stackoverflow.com/a/23109416
tagged with: newline
accepted answer: http://stackoverflow.com/a/23109416
tagged with: android-logcat
type: AnsweredQuestion
tagged with: string
has body: I'm testing a method in my app. I'm generating a vcard from a stored contact and comparing it to an hardcoded vcard. They should be the exact same vcard, and they are. The problem is the test is failing and don't understand how. From the logcat output it looks obvious that it is not printing a double new line (\n\n) Here is my code: public void testGetContactAsVcard() { String vcardActual = utils.getContactAsVcard(contact.getAllContactIds().get(0)); // This is the vcard for the first contact (position zero) String vcardExpected = "BEGIN:VCARD" + "\nVERSION:2.1" + "\nN:Klisnmann;Jurgen;;;" + "\nFN:Jurgen Klinsmann" + "\nX-ANDROID-CUSTOM:vnd.android.cursor.item/nickname;mynickname;;;;;;;;;;;;;;" + "\nTEL;CELL:922-222-222" + "\nTEL;WORK:911-222-333" + "\nEMAIL;WORK:work@mail.com" + "\nEMAIL;HOME:home@mail.com" + "\nADR;WORK:poBox;;StreetSomething;Berlin Alexanderplatz;Berlin;28000;Germany" + "\nADR;HOME:poBox;;MyStreet20;Berlin Potsdam;Berlin;2800;Germany" + "\nORG:MAT\\;MobileDept." + "\nTITLE:Eng." + "\nURL:www.company.com" + "\nURL:myblog.com" + "\nURL:custom.com" + "\nPHOTO;ENCODING=BASE64;JPEG:/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwM" + "\n EAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/" + "\n 2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUF" + "\n BQUFBQUFBQUFBQUFBT/wAARCAAkAGADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAA" + "\n ECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaE" + "\n II0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZn" + "\n aGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJy" + "\n tLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAw" + "\n QFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobH" + "\n BCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hp" + "\n anN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0" + "\n tPU1dbX2Nna4uPk5ebn6On…
has comment: http://stackoverflow.com/comment/35318161
type: Question
tagged with: android
has title: Android logcat - not ouputing double new line - String with double new line - String equals
score: 0

android
tags question: http://stackoverflow.com/q/23070016
tags question: http://stackoverflow.com/q/23006099
tags question: http://stackoverflow.com/q/23016949
tags question: http://stackoverflow.com/q/23109611
tags question: http://stackoverflow.com/q/23085711
tags question: http://stackoverflow.com/q/23007019
tags question: http://stackoverflow.com/q/23080931
tags question: http://stackoverflow.com/q/23019623
tags question: http://stackoverflow.com/q/23086731
tags question: http://stackoverflow.com/q/23017275
tags question: http://stackoverflow.com/q/22996191
tags question: http://stackoverflow.com/q/23076523
tags question: http://stackoverflow.com/q/23087079
tags question: http://stackoverflow.com/q/23119617
tags question: http://stackoverflow.com/q/23044371
tags question: http://stackoverflow.com/q/22970564
tags question: http://stackoverflow.com/q/23006440
tags question: http://stackoverflow.com/q/22984097
tags question: http://stackoverflow.com/q/23043118
tags question: http://stackoverflow.com/q/23069187
tags question: http://stackoverflow.com/q/23065707
tags question: http://stackoverflow.com/q/23023611
tags question: http://stackoverflow.com/q/23125418
tags question: http://stackoverflow.com/q/23024795
tags question: http://stackoverflow.com/q/23008936
tags question: http://stackoverflow.com/q/23033737
tags question: http://stackoverflow.com/q/23124848
tags question: http://stackoverflow.com/q/22991050
tags question: http://stackoverflow.com/q/23053790
tags question: http://stackoverflow.com/q/23042450
tags question: http://stackoverflow.com/q/23026050
tags question: http://stackoverflow.com/q/23094428
tags question: http://stackoverflow.com/q/23103189
tags question: http://stackoverflow.com/q/23009655
tags question: http://stackoverflow.com/q/23075485
tags question: http://stackoverflow.com/q/23000012
tags question: http://stackoverflow.com/q/23013892
tags question: http://stackoverflow.com/q/23081741
tags question: http://stackoverflow.com/q/23120939
tags question: http://stackoverflow.com/q/22978156
tags question: http://stackoverflow.com/q/23053462
tags question: http://stackoverflow.com/q/23115681
tags question: http://stackoverflow.com/q/23013305
tags question: http://stackoverflow.com/q/22983737
tags question: http://stackoverflow.com/q/22985455
tags question: http://stackoverflow.com/q/23005656
tags question: http://stackoverflow.com/q/23124404
tags question: http://stackoverflow.com/q/23081565
tags question: http://stackoverflow.com/q/23033995
tags question: http://stackoverflow.com/q/23028899
tags question: http://stackoverflow.com/q/23117098
tags question: http://stackoverflow.com/q/23043646
tags question: http://stackoverflow.com/q/23034499
tags question: http://stackoverflow.com/q/22987573
tags question: http://stackoverflow.com/q/23042024
tags question: http://stackoverflow.com/q/23041975
tags question: http://stackoverflow.com/q/23040274
tags question: http://stackoverflow.com/q/23082693
tags question: http://stackoverflow.com/q/23033385
tags question: http://stackoverflow.com/q/23044691
tags question: http://stackoverflow.com/q/22996445
tags question: http://stackoverflow.com/q/23054575
tags question: http://stackoverflow.com/q/23064525
tags question: http://stackoverflow.com/q/22972022
tags question: http://stackoverflow.com/q/23035659
tags question: http://stackoverflow.com/q/23013115
tags question: http://stackoverflow.com/q/23086805
tags question: http://stackoverflow.com/q/22977438
tags question: http://stackoverflow.com/q/23053098
tags question: http://stackoverflow.com/q/23046251
tags question: http://stackoverflow.com/q/23060428
tags question: http://stackoverflow.com/q/23047984
tags question: http://stackoverflow.com/q/23006942
tags question: http://stackoverflow.com/q/23127740
tags question: http://stackoverflow.com/q/22988653
tags question: http://stackoverflow.com/q/22975007
tags question: http://stackoverflow.com/q/23073655
tags question: http://stackoverflow.com/q/23122034
tags question: http://stackoverflow.com/q/23032007
tags question: http://stackoverflow.com/q/23010890

http://stackoverflow.com/comment/35287635
has text: What do yo u mean **i can change the network interface ip but can't run the exes**
comment on: http://stackoverflow.com/a/23084032
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35094592
type: AnswerComment
comment on: http://stackoverflow.com/a/22979566
score: 0
type: Comment
has text: @MaduBiradar: I meant the data from the file. But if it is working then good for you :)

http://stackoverflow.com/q/23022912
has comment: http://stackoverflow.com/comment/35172178
has comment: http://stackoverflow.com/comment/35171558
tagged with: jsf
has body: when I try to display employee.jsp page I am not able to select employee. It looks like SelectOneMenu doesn't work. Am I missing something in that tag (line 20)? I checked and the database has table employee with some employee data. I have connection to database. I use mysql database. You can see connection to this database in persistance.xml file. <%@ page language="java" contentType="text/html; charset=US-ASCII" pageEncoding="US-ASCII"%> <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%> <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%> Employee Details <f:view> Welcome to Employee Home Page <h:form> Select an Employee Number from the drop down: <h:selectOneMenu id="selEmpNo" valueChangeListener="#{employee.employeeReport}" onchange="submit()"> <f:selectItem itemLabel="select" /> <f:selectItems value="#{employee.empNoList}" id="emp"/> </h:selectOneMenu> </h:form> <h:outputText value="Employee Name: "></h:outputText> <h:outputText value="#{employee.empName}"/> <h:outputText value="Employee Number: "/> <h:outputText value="#{employee.empNo}"/> <h:outputText value="Name of the IBU: "/> <h:outputText value="#{employee.ibu}"/> <h:outputText value="Designation: "/> <h:outputText value="#{employee.designation}"/> </f:view> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%> <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%> Home <f:view> <h:outputLabel> Welcome!!!</h:outputLabel> <h:outputLink value="employee.jsp">Employee Details</h:outputLink> </f:view> package employee; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.faces.event.ValueChangeEvent; import javax.faces.model.SelectItem; public class EmployeeBean { private String empName; private String ibu; private String designation; private int empNo; //This is used to dynamically populate the drop down with employee numbers List<SelectItem> empNoList…
tagged with: java
tagged with: mysql
tagged with: eclipse
has answer: http://stackoverflow.com/a/23024437
has comment: http://stackoverflow.com/comment/35171886
type: Question
has comment: http://stackoverflow.com/comment/35171739
has comment: http://stackoverflow.com/comment/35171702
has comment: http://stackoverflow.com/comment/35172030
answer count: 1
has comment: http://stackoverflow.com/comment/35172121
has comment: http://stackoverflow.com/comment/35171635
has title: SelectOneMenu doesn't have any value to choose from
has comment: http://stackoverflow.com/comment/35170767
has comment: http://stackoverflow.com/comment/35171830
score: 0
has comment: http://stackoverflow.com/comment/35170830
has comment: http://stackoverflow.com/comment/35170702
has comment: http://stackoverflow.com/comment/35171620
type: UnansweredQuestion
tagged with: tomcat7

http://stackoverflow.com/comment/35118094
comment on: http://stackoverflow.com/q/22994366
score: 0
type: Comment
has text: How do know that application has been stated successfully?
type: QuestionComment

http://stackoverflow.com/comment/61428256
score: 1
has text: This didn't worked for me, Still the same exception `java.lang.NoClassDefFoundError: org/glassfish/jersey/moxy/json/internal/ConfigurableMoxyJsonProvider`
type: Comment
comment on: http://stackoverflow.com/a/30831541
type: AnswerComment

http://stackoverflow.com/a/23092950
accepted answer of: http://stackoverflow.com/q/23012270
upvote count: 9
has comment: http://stackoverflow.com/comment/35307029
score: 9
has body: As of Spring Framework 4.0.x, it is possible to send messages to a group of users by: explicitly sending messages to each user, using a for loop sending messages to a particular topic, given those users subscribed to this topic beforehand. As you mentioned, you don't want users that don't belong to that "group" to be able to subscribe to this topic. This calls, in fact, for authorization features. With 4.0.x, security features are implemented at the HTTP level, for example during the HTTP Upgrade phase, before clients switch to websocket (see the websocket-portfolio application). The feature you're asking for is implemented in Spring Security 4.0.0 (to be released, see this blog post for a full preview).
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40252502
type: Answer
answers question: http://stackoverflow.com/q/23012270

jboss6.x
tag name: jboss6.x
tags question: http://stackoverflow.com/q/23015793
type: Tag
tags question: http://stackoverflow.com/q/22990092

http://stackoverflow.com/a/22988731
has comment: http://stackoverflow.com/comment/35123339
has body: Try URL url = getDocumentBase(); AudioClip audioClip = getAudioClip(url, "music/JButton.wav") Project sturcture
has comment: http://stackoverflow.com/comment/35124973
has comment: http://stackoverflow.com/comment/35124032
has comment: http://stackoverflow.com/comment/35123597
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35123348
has comment: http://stackoverflow.com/comment/35123637
answers question: http://stackoverflow.com/q/22988516
has comment: http://stackoverflow.com/comment/35124101
has comment: http://stackoverflow.com/comment/35123373
has comment: http://stackoverflow.com/comment/35123829
has comment: http://stackoverflow.com/comment/35123745
has comment: http://stackoverflow.com/comment/35123453
has comment: http://stackoverflow.com/comment/35134874
has comment: http://stackoverflow.com/comment/35126184
has comment: http://stackoverflow.com/comment/35124420
has comment: http://stackoverflow.com/comment/35123223
has comment: http://stackoverflow.com/comment/35123215
downvote count: 0

http://stackoverflow.com/a/23050323
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23050150
has comment: http://stackoverflow.com/comment/35220075
has comment: http://stackoverflow.com/comment/35220029
has comment: http://stackoverflow.com/comment/35219838
answers question: http://stackoverflow.com/q/23050150
has body: You cannot be setting the entries and entryValues of the ListPreference in an onClick event when there are no entries and entryValues to begin with. Instead do it in the onCreate. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings); final ListPreference listPreference = (ListPreference) findPreference("delay"); String[] array={"1","2","3"}; CharSequence[] entries = array; CharSequence[] entryValues = array; listPreference.setEntries(entries); listPreference.setDefaultValue("1"); listPreference.setEntryValues(entryValues); } Then if you need set values dynamically in onClick listener, it should work okay.
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/35219947
has comment: http://stackoverflow.com/comment/35220236
has comment: http://stackoverflow.com/comment/35220108
has comment: http://stackoverflow.com/comment/35219943
has comment: http://stackoverflow.com/comment/35219757
upvote count: 5
has comment: http://stackoverflow.com/comment/35219885
type: AcceptedAnswer

http://stackoverflow.com/comment/35335022
has text: Can you explain why you think that approach is not-simple/ugly? That will give people here some hint on what kind of suggestions you are expecting.
comment on: http://stackoverflow.com/q/23114712
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/22998035
has body: You never initialized lstTriggerEvents, it's still null. Change the declaration to List&lt;Student&gt; lstTriggerEvents=new ArrayList&lt;Student&gt;(); When you declare a variable you have to initialize it, otherwise the JVM assigns a default value. For reference types (like your list) that value is null.
answers question: http://stackoverflow.com/q/22997990
type: Answer
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/23094679
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23094532
has comment: http://stackoverflow.com/comment/35300482
answers question: http://stackoverflow.com/q/23094532
score: 4
has body: You can try with something like String regEx = "(:)(\\w+)\\b(?![.])"; (:)(\\w+)\\b will make sure that you are matching only entire words starting with : (?![.]) is look behind mechanism which makes sure that after found word there is no . This regex will also allow :NULL so if there is some reason why it shouldn't be matched share it with us. Anyway to exclude NULL from results you can use String regEx = "(:)(\\w+)\\b(?![.])(?&lt;!:NULL)"; To make regex case insensitive so NULL could also match null compile this pattern with Pattern.CASE_INSENSITIVE flag like Pattern pattern = Pattern.compile(regEx,Pattern.CASE_INSENSITIVE);
type: AcceptedAnswer

http://stackoverflow.com/q/23122522
has body: Sorry to post a question that has most likely already been answered, but I've been tearing through other posts and tutorials, and still can't figure this out. I've written a dummy app to practice sending post requests from android, but I can't seem to get it to work. All it should do is, on button click, send a post to httpbin.org/post, and then display what is returned in a TextView. Here is the code for MainActivity: package com.getthisshit.app; public class MainActivity extends ActionBarActivity { TextView text; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); text = (TextView) findViewById(R.id.text); } public void Go(View view){ connect doit = new connect(this); doit.execute(); } private class connect extends AsyncTask&lt;Void, Void, String&gt;{ private Context context; public connect(Context context){ this.context = context; } @Override protected String doInBackground(Void... arg0){ List&lt;NameValuePair&gt; userInfo = new ArrayList&lt;NameValuePair&gt;(2); String URL = "http://httpbin.org/post"; String response = "no response"; HttpClient httpClient = new DefaultHttpClient(); HttpEntity httpEntity = null; HttpResponse httpResponse = null; HttpPost httpPost = new HttpPost(URL); userInfo.add(new BasicNameValuePair("email", "bad@man.com")); userInfo.add(new BasicNameValuePair("password", "SayWhatAgain")); try{ httpPost.setEntity(new UrlEncodedFormEntity(userInfo)); httpResponse = httpClient.execute(httpPost); httpEntity = httpResponse.getEntity(); response = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e){ e.printStackTrace(); } catch (ClientProtocolException e){ e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } return response; } @Override protected void onPostExecute(String response){ //Toast.makeText(context , response, Toast.LENGTH_SHORT).show(); text.setText(response…
tagged with: http
has title: Android HTTP POST does not recognize correct url
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23123969
accepted answer: http://stackoverflow.com/a/23123969
tagged with: java
tagged with: post
type: Question
score: 0
answer count: 1
tagged with: android

http://stackoverflow.com/q/23128429
has answer: http://stackoverflow.com/a/23128522
has answer: http://stackoverflow.com/a/23128512
type: UnansweredQuestion
has title: why request.getAttribute should be cast sometimes when using struts
tagged with: java
type: Question
tagged with: jsp
tagged with: struts
score: 0
has body: it is error: &lt;bean:define id="myid" value="&lt;%=request.getAttribute("key")%&gt;" but followed with cast (String) is ok: &lt;bean:define id="myid" value="&lt;%=(String)request.getAttribute("key")%&gt;" what's more. followed is ok. this is &lt;%=request.getAttribute("key")%&gt; why?
answer count: 3
has answer: http://stackoverflow.com/a/23128649

http://stackoverflow.com/q/23014359
favorite count: 0
accepted answer: http://stackoverflow.com/a/23014444
score: -3
has body: I am trying to retrieve all the customer's Information from the main. I have a class CustomerManager and a class main (which is the: main(String[] args)) this is the code of CustomerManager class which is using a hashmap as a collection public class CustomerManager { private static final Map&lt;String, Customer&gt; customersManager = new HashMap&lt;&gt; (); public static void addCustomer(Customer c){ // Customers customersManager.put(c.getID(), c); customersManager.put ("ID1", new Customer ("ID1","Jonathan", "Mifsud", "Test Address", 21345678, "L001")); customersManager.put ("ID2", new Customer ("ID2","David", "Aguis", "2nd Address", 21456778, "L002")); customersManager.put ("ID3", new Customer ("ID3","Frank", "Mamo", "example Address", 21987653, "L003")); } public static void findCustomer(Customer c){ customersManager.put(c.getID(), c); } public static void deleteCustomer(Customer c){ customersManager.remove(c.getID()); } } now how can I retrieve the customer information from the CustomerManagement class to the main. I tried this: System.out.println("Insert Customer ID: "); customersManager.findCustomer(c); but its giving me an error: variable c might not have been initialized
has comment: http://stackoverflow.com/comment/35154060
has comment: http://stackoverflow.com/comment/35154292
downvote count: 3
has comment: http://stackoverflow.com/comment/35154231
type: AnsweredQuestion
has title: Retrieving using HashMap
tagged with: hashmap
has answer: http://stackoverflow.com/a/23014444
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35154084
upvote count: 0
answer count: 1

http://stackoverflow.com/q/23041608
linked to: http://stackoverflow.com/q/16627813
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23041621
has answer: http://stackoverflow.com/a/23041621
accepted answer: http://stackoverflow.com/a/23041795
upvote count: 1
type: Question
score: 1
has title: Graphics use the values 0.01f and 2f: what is this format?
tagged with: java
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23041795
favorite count: 0
tagged with: android
has body: In Android graphics values are used like 2f and 0.01f. What number format is this, and how can we find their decimal representation? Why is this format generally used for graphics?

http://stackoverflow.com/comment/35121807
has text: Also, part of your problem may be the way you have spelTask set up. You initialize the class one in the constructor, however, you try to access the one within panel on the line that's throwing an error. That would be fine if spelTask was static I believe; otherwise you should be calling spelTimer.schedule(spelTask, 0, speed); I would think.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22996276

http://stackoverflow.com/q/23023759
has comment: http://stackoverflow.com/comment/35172342
upvote count: 0
has comment: http://stackoverflow.com/comment/35173092
favorite count: 0
has body: I have written code that will record all of my information in another code to a textfile. However I know i havent been able to advance the variable 'u' properly and I'm not sure how to do so. public void writeAllToFile() { try { BufferedWriter bw = new BufferedWriter(new FileWriter("SystemData.txt")); int i =0; String u = emailUsers.getUser(i).username; while(u!=null) { bw.write("" + emailUsers.getUser(i).username); bw.newLine(); bw.write(""+emailUsers.getUser(i).inbox.getNumMessages()); bw.newLine(); int j=0; String s = emailUsers.getUser(i).inbox.getMessage(j).getSender(); while(s!=null) { bw.write("" + emailUsers.getUser(i).inbox.getMessage(j).getSender()); bw.newLine(); bw.write("" + emailUsers.getUser(i).inbox.getMessage(j).getReceiver()); bw.newLine(); bw.write("" + emailUsers.getUser(i).inbox.getMessage(j).getSubject()); bw.newLine(); bw.write("" + emailUsers.getUser(i).inbox.getMessage(j).getBody()); bw.newLine(); j++; } i++; } bw.close(); } catch(Exception e) { } }
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35172335
has title: Looping code in java
score: -1
has comment: http://stackoverflow.com/comment/35172415
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/35172343
downvote count: 1
has answer: http://stackoverflow.com/a/23024853
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23024009

http://stackoverflow.com/comment/35285072
type: AnswerComment
comment on: http://stackoverflow.com/a/23083985
type: Comment
has text: Am not sure about the solution for android. Kindly upvote if you have found the answer you have been searching for.
score: 0

http://stackoverflow.com/comment/35158745
type: AnswerComment
comment on: http://stackoverflow.com/a/23016693
has text: @icaughtfireonce, I have no idea what you are asking. Read the tutorial for working examples and more detail explanations.
type: Comment
score: 0

http://stackoverflow.com/q/22980966
favorite count: 0
has comment: http://stackoverflow.com/comment/35094662
has comment: http://stackoverflow.com/comment/35101517
answer count: 0
upvote count: 2
has title: R.java file is not updating or recovering after clean up
type: UnansweredQuestion
downvote count: 1
type: Question
tagged with: java
tagged with: eclipse
has body: I am working with an R.java file that is not getting updated with changes made in an XML file. After I try to clean the project up, the Java file is getting deleted and is not recovering automatically. My package name in the manifest file is correct. Does anyone know what the problem might be?
has comment: http://stackoverflow.com/comment/35093793
tagged with: r.java-file
score: 1

http://stackoverflow.com/comment/36069183
has text: Is there any chance you could open up a ticket instead ? Or give some indications on how to open an account on your subdomain ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23280870
type: Comment

http://stackoverflow.com/comment/35279335
has text: Just checked and it didn't show up here either, though the following article says it should: http://blog.arungupta.me/2013/12/netbeans8-and-wildfly8-techtip-6/
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23081092
score: 1

http://stackoverflow.com/q/23116426
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/23117367
score: 0
has title: How to get the volume of a byte array from a SourceDataLine in Java
tagged with: byte
tagged with: volume
answer count: 1
accepted answer: http://stackoverflow.com/a/23117367
tagged with: audio
type: AnsweredQuestion
tagged with: java
has body: I have written a Java programm for peer to peer voice chat, but in order to keep the traffic as low as possible i would like to analyze the captured data and make parts with low volume completely silent. The problem is, that I have no idea how to get the volume from the byte array and how to make parts silent.

http://stackoverflow.com/a/23004741
type: Answer
answers question: http://stackoverflow.com/q/23004663
upvote count: 4
score: 4
downvote count: 0
has body: There is no "correct order" with Key-Value Pairs in a JSON Object. However, if you manually process the JSON Reader, you will read the serialized order - this approach works because the stream is handled before it is reconstructed into an object graph (that uses a Map for JSONObject internally). To access the raw JSON reader, see JsonReader - however, be aware that there is no guarantee that any equivalent JSON that you get is supplied in this order! While it "will work", it creates a false brittleness based upon one (of many) equivalent JSON outputs. See the accepted answer in When JsonObject's keys are iterated they aren't in the same order as in the response from the server: The order of the keys of a JSON object is not supposed to be meaningful. If you want a specific order, you should use an array, not an object.

http://stackoverflow.com/comment/35316935
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23104751
has text: you are right. But from docs "In the expression ((A)(B(C))), for example, there are four such groups".. then there should be actually 5 grups.. first the entire match,((A)(B(C))), and then the ((A)(B(C))) match then (A) then (B(C)) then (C)
type: AnswerComment

http://stackoverflow.com/comment/35341604
score: 0
comment on: http://stackoverflow.com/q/23118013
has text: You need to implement the parameterized version of `Comparable`, namely `Comparable<WordCount>` in order to use `WordCount#compareTo(Wordcount)`. Implementing the non-parameterized `Comparable` forces your class to use `WordCount#compareTo(Object)`.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23003648
has body: Is there a reason that the third constructor does not simply utilize this(x,y,width,height). Because it is the constructor that would be invoked with this(x, y, width, height); and that would cause an infinite recursive loop. As Keppil said in the comments, this is a keyword. When used like this(x, y, width, height); in a constructor, it invokes the class constructor with the appropriate parameter list. In this case, that constructor is the third constructor. So what you are suggesting is that the third constructor invoke the third constructor which invokes the third constructor, ad nauseam.
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/23003634
score: 6
answers question: http://stackoverflow.com/q/23003634

http://stackoverflow.com/a/23152717
downvote count: 0
answers question: http://stackoverflow.com/q/23056564
score: 4
has body: Go to the google wallet quick start java page link here and download the sample and configure and build the sample finally run and verify the sample.
type: Answer
upvote count: 4

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/23033072
type: Tag
tags question: http://stackoverflow.com/q/22993022
tags question: http://stackoverflow.com/q/23038131
tags question: http://stackoverflow.com/q/23000669

http://stackoverflow.com/a/23092419
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23088064
type: Answer
accepted answer of: http://stackoverflow.com/q/23088064
has body: If you are validating the numbers, I would suggest that you might have more luck converting your validation string into a number to compare with the value in the cell. There is no information stored in the spreadsheet about the decimal/thousands separator. That is based on the locale set in the application or OS and is display-only - it is not stored at all. So you will have to manually format the number as a String.
upvote count: 1
score: 1

http://stackoverflow.com/a/23087196
upvote count: 1
has body: I solved, for large files should use the temporary folder RichFaces Filter richfaces org.ajax4jsf.Filter createTempFiles true maxRequestSize 419430400
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23064960
type: Answer

state
tag name: state
tags question: http://stackoverflow.com/q/23061533
type: Tag

http://stackoverflow.com/comment/35237447
type: AnswerComment
has text: yes I mean this thanks very very much.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23051622

http://stackoverflow.com/q/23089348
has answer: http://stackoverflow.com/a/23089444
has comment: http://stackoverflow.com/comment/35290265
favorite count: 0
has comment: http://stackoverflow.com/comment/35290303
has comment: http://stackoverflow.com/comment/35290299
has comment: http://stackoverflow.com/comment/35290221
has title: Regex to match continuous pattern of integer then space
has answer: http://stackoverflow.com/a/23090284
has answer: http://stackoverflow.com/a/23089956
has body: I'm asking the user for input through the Scanner in Java, and now I want to parse out their selections using a regular expression. In essence, I show them an enumerated list of items, and they type in the numbers for the items they want to select, separated by a space. Here is an example: 1 yorkshire terrier 2 staffordshire terrier 3 goldfish 4 basset hound 5 hippopotamus Type the numbers that correspond to the words you wish to exclude: 3 5 The enumerated list of items can be a just a few elements or several hundred. The current regex I'm using looks like this ^|\\.\\s+)\\d+\\s+, but I know it's wrong. I don't fully understand regular expressions yet, so if you can explain what it is doing that would be helpful too!
tagged with: regex
answer count: 4
type: AnsweredQuestion
score: 2
downvote count: 0
type: Question
possible better answer: http://stackoverflow.com/a/23089444
tagged with: java
has answer: http://stackoverflow.com/a/23089954
accepted answer: http://stackoverflow.com/a/23089954
upvote count: 2

http://stackoverflow.com/comment/35327893
has text: @Spring: what is NPE?
score: 0
comment on: http://stackoverflow.com/q/23110894
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23087795
has comment: http://stackoverflow.com/comment/35287279
has answer: http://stackoverflow.com/a/23087970
favorite count: 0
tagged with: return
type: UnansweredQuestion
downvote count: 1
has body: Im trying to return an arraylist from the method getNumbers (which contains strings) public ArrayList&lt;String&gt; getNumbers(){ return (numeros); } Then by using a searcher im trying to compare between a variable m (which contains the desired info to look for) and the returned list. public class NumberSearcher { Reader reader = new KeyboardReader(); public NumberSearcher(ArrayList&lt;Contacto&gt; contactos){ String m = reader.read(); for(int i = 0; i&lt;contactos.size();i++){ if(contactos.get(i).getPhoneNumbers().contains(m)){ contactos.get(i).display(); } } } } I have succeded in creating a searcher using this very same style but only when using methods that return String alone. The problem is its not working. If there there would be a match it should display the contact information but it seem it isnt "comparing" properly because nothing happens.
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/35290897
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35287283
upvote count: 0
has answer: http://stackoverflow.com/a/23087952
tagged with: arraylist
has title: Returning an arraylist and iterating throught the returned list

http://stackoverflow.com/comment/35228083
comment on: http://stackoverflow.com/q/23004991
type: QuestionComment
type: Comment
has text: Thanks, but I can't reproduce the problem use MCVE. May be I can't find the key point.
score: 0

http://stackoverflow.com/comment/35317427
has text: Yes, i know this. I have read some articles that explain how to solve this, but they all were about how to do this using java classes but not jar libraries.
score: 0
comment on: http://stackoverflow.com/q/23104198
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35125552
comment on: http://stackoverflow.com/q/22998281
has text: @Coffee - It depends on the average size of a record, doesn't it? If each record is, say, 1KB on average, that's a couple of GB. If OP is trying to build an in-memory DOM representation of the XML, small wonder there's a memory problem.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/23014962
has body: Your code will process characters which are reserved in java like:'\' , it will show no termination of string if we use '\' without any preferred method like "\"" . Try this: String replace(String data) { String strSpecial = ""; strSpecial = " \f\n\r\t\'\"\\"; return(strSpecial.replace("\"", " ")); }
score: 0
answers question: http://stackoverflow.com/q/23014823
type: Answer
has comment: http://stackoverflow.com/comment/35155394
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/23006974
type: Answer
has body: String[] names = new String[] {}; ... names [i] = cursor.getString(1); //Names in cursor You're assigning to an empty array which causes ArrayIndexOutOfBoundsException. Consider using a list such as ArrayList where you can append your values, e.g. List&lt;String&gt; names = new ArrayList&lt;String&gt;(); ... names.add(cursor.getString(1)); If you really need to return a String[], you can convert the list with toArray(): String[] arr = new String[names.size()]; names.toArray(arr); return arr; Also, when posting questions that involve exceptions, always include the exception stacktrace from logcat in the question itself.
has comment: http://stackoverflow.com/comment/35140674
has comment: http://stackoverflow.com/comment/35140593
score: 0
accepted answer of: http://stackoverflow.com/q/23006942
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35140557
answers question: http://stackoverflow.com/q/23006942

http://stackoverflow.com/q/23124849
upvote count: 1
accepted answer: http://stackoverflow.com/a/23125855
tagged with: java-8
has body: I have a messaging system, and I have a (unwritten) method for a Message class where I want to be able to return an eloquent string representing the two most significant time differences between two points: Message(String sender, String channel, String message, String target) { this.sender = sender; this.channel = channel; this.message = message; this.target = target; this.timestamp = System.nanoTime(); } private String getTime() { long now = System.nanoTime(); return ""; } public String toString() { return String.format("(%s ago)[%s] %s =&gt; %s", this.getTime(), this.channel, this.sender, this.message); } I'd rather not loop through the TimeUnit enum for different values, and get the largest two non-zero values. Is there a simpler method for retrieving a user-friendly time between two points? Does Java 8's new time API introduce anything for this? Keep in mind, I don't want a specific date, but the difference of the two.
has answer: http://stackoverflow.com/a/23125131
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23125855
type: Question
has comment: http://stackoverflow.com/comment/35353732
possible better answer: http://stackoverflow.com/a/23125099
has comment: http://stackoverflow.com/comment/35353611
has title: Eloquently printing "time between" two time prints
has comment: http://stackoverflow.com/comment/35353670
answer count: 3
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/1440557
has answer: http://stackoverflow.com/a/23125099
has comment: http://stackoverflow.com/comment/35353697

http://stackoverflow.com/a/23013359
has body: I solved this. By placing the whole sequence of instructions for reading (the getQueueStatus() and the read()) in another Thread. Specifically, I used an AsyncTask, and put the reading instructions in its doInBackground() method.
answers question: http://stackoverflow.com/q/22985558
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22985558
downvote count: 0
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35541488

http://stackoverflow.com/a/22992630
has comment: http://stackoverflow.com/comment/35114886
score: 0
has comment: http://stackoverflow.com/comment/35115011
has body: From double to String : String doubleInString = "" + double; Or more intended to do this : String.valueOf(double) @DwB is that what you want ? From String to double : try { Double.parseDouble(myString) }catch( Exception e ) { // what you want in case of error } From double to words : You can use RuleBasedNumberFormat but I never tried so good luck :)
answers question: http://stackoverflow.com/q/22992589
has comment: http://stackoverflow.com/comment/35114842
has comment: http://stackoverflow.com/comment/35122688
type: Answer

http://stackoverflow.com/q/22978074
tagged with: tor
has title: Using Selenium WebDriver with Tor
has comment: http://stackoverflow.com/comment/35495615
has comment: http://stackoverflow.com/comment/35489317
tagged with: tor-browser-bundle
possible better answer: http://stackoverflow.com/a/22978733
favorite count: 0
linked to: http://stackoverflow.com/q/22740778
has answer: http://stackoverflow.com/a/23320554
answer count: 5
has body: Because Tor Browser Bundle is just a patched version of Firefox, it seems that it should be possible to use a FirefoxDriver with Tor Browser. This is what I've tried so far: String torPath = "C:\\Users\\My User\\Desktop\\Tor Browser\\Start Tor Browser.exe"; String profilePath = "C:\\Users\\My User\\Desktop\\Tor Browser\\Data\\Browser\\profile.default"; FirefoxProfile profile = new FirefoxProfile(new File(profilePath)); FirefoxBinary binary = new FirefoxBinary(new File(torPath)); FirefoxDriver driver = new FirefoxDriver(binary, profile); driver.get("http://www.google.com"); This results in a blank Tor Browser page opening with a popup message: Your Firefox profile cannot be loaded. It may be missing or inaccessible. I know that the profile is valid/compatible because I can successfully start the browser and profile with: binary.startProfile(profile, profilePath, "")); I don't know how to send commands to a browser opened in such a manner, however. I've found similar questions, but I'm specifically looking for a Java solution, preferably tested on Windows. I'm using a standalone Selenium library that can be downloaded here and the Tor Browser Bundle that can be downloaded here.
has answer: http://stackoverflow.com/a/23170160
score: 25
tagged with: selenium-webdriver
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35479931
has answer: http://stackoverflow.com/a/22978733
type: Question
linked to: http://stackoverflow.com/q/15316304
has answer: http://stackoverflow.com/a/31826957
tagged with: firefox
has comment: http://stackoverflow.com/comment/35496801
has answer: http://stackoverflow.com/a/32633986
upvote count: 25
accepted answer: http://stackoverflow.com/a/23320554

http://stackoverflow.com/comment/35124517
comment on: http://stackoverflow.com/q/22997719
has text: @azurefrog has the best idea. Simply keep track of current minimum, and current maximum, and compute your average using a moving average. No TreeSet necessary. However, if you want to use a TreeSet, recall that for every primitive type, there is an Object type, and you should be able to work forward from there. You could compute more interesting statistics like median, mode, and standard deviation if you have the full statistics.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23067517
answers question: http://stackoverflow.com/q/23067252
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: I would start by doing the following Google search: logging best practices java The first link I get is this, which explains when to use each of the log levels. Now, to give some context, log levels are used to easily slice-and-dice through massive log files. Imagine that you have a web application that creates a log for each user's specific click actions. If that web application has thousands of users logged in at the same time to the application, you could end up with millions of lines of logs per minute. How would you figure out which log is important to you? Browsing through millions of lines isn't really wise, is it? As a developer, you might only be interested in ERROR or WARNs. A marketing guy might be interested in the INFO logs which indicate which web pages, or sections of the web site are getting most hits, a networks guy might want to look at logs that indicate SEVERE server problems. SLF4J also allows you to create custom MARKERS. You could add markers to logs to derive even greater business value from your logs. To conclude, I'd say, think of logs as your best friend once your code goes to production. The better you organize your logs with levels, markers, etc., the sooner you'll be able to debug issues and respond in time.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23067252

http://stackoverflow.com/a/22972505
has body: try this: cur.moveToFirst(); if (cur != null) { do { sms += "From :" + cur.getString(2) + " : " + cur.getString(11)+"\n"; Log.i("MyApp", "A " + cur.getString(2) + " " + cur.getString(3)); }while(cur.moveToNext()); }
type: Answer
answers question: http://stackoverflow.com/q/22972360
has comment: http://stackoverflow.com/comment/35082406
upvote count: 1
has comment: http://stackoverflow.com/comment/35079333
has comment: http://stackoverflow.com/comment/35079511
score: 1
has comment: http://stackoverflow.com/comment/35080237
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35079672
has comment: http://stackoverflow.com/comment/35080496
accepted answer of: http://stackoverflow.com/q/22972360

http://stackoverflow.com/a/23129348
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23111863
type: Answer
has body: Thanks for the answers! I have managed to solve the problem by adding "&lt;tx:annotation-driven mode="proxy"/&gt; to my application context xml file. It's working perfectly now! However i'm still not sure what this statemant does and why i only need it for the findAll() method and not any of the other's i've used. (count(), findOne(), findBySchemaPropertyValue() etc)
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/46443698
downvote count: 0
answers question: http://stackoverflow.com/q/23111863

http://stackoverflow.com/q/23077008
type: AnsweredQuestion
has body: I'm using iText 2.1.7,i'm adding header and footer at absolute position using writer.getDirectcontent() method.All is working fine except the fonts in first page gets darker than second pages. Note the Header and Footer in First and second pages anyhelp? Here is what i did Reader stringReader = new StringReader(svgXmlDoc); Document document = new Document(PageSize.A4.rotate()); ByteArrayOutputStream content = new ByteArrayOutputStream(); try { PdfWriter writer = PdfWriter.getInstance(document, content); document.open(); PdfService event = new PdfService(); event.setHeader(date.toString()); event.onOpenDocument(writer, document); event.onEndPage(writer, document); event.onCloseDocument(writer, document); writer.setPageEvent(event); Image image1 = Image.getInstance("Infinity-Loop.png"); image1.scalePercent(35); PdfPTable signature = new PdfPTable(numberOfSignature); signature.setTotalWidth(document.getPageSize().getWidth() - document.leftMargin() - document.rightMargin()); signature.setLockedWidth(true); signature.setWidthPercentage(100); signature.getDefaultCell().setFixedHeight(20); signature.getDefaultCell().setHorizontalAlignment( Element.ALIGN_RIGHT); for (int i = 0; i &lt; numberOfSignature; i++) { PdfPCell cell = new PdfPCell(new Paragraph( String.valueOf("____________"))); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); signature.addCell(cell); } PdfPTable header = new PdfPTable(3); float[] columnWidths = {1f,2f,1f}; header.setWidths(columnWidths); header.setTotalWidth(document.getPageSize().getWidth() - document.leftMargin() - document.rightMargin()); header.setLockedWidth(true); header.setWidthPercentage(100); header.getDefaultCell().setPadding(15); header.getDefaultCell().setBorder(Rectangle.NO_BORDER); PdfPCell logocell = new PdfPCell(image1, false); logocell.setRowspan(3); logocell.setFixedHeight(72); logocell.setBorder(Rectangle.NO_BORDER); header.addCell(logocell); PdfPCell Title = new PdfPCell(new Phrase(title, F…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35268591
accepted answer: http://stackoverflow.com/a/23079311
type: Question
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35268516
favorite count: 0
has comment: http://stackoverflow.com/comment/35268945
has comment: http://stackoverflow.com/comment/35269251
tagged with: pdf-generation
has comment: http://stackoverflow.com/comment/35269035
has answer: http://stackoverflow.com/a/23079311
has title: itext font color gets darker in first page
has comment: http://stackoverflow.com/comment/35269800
has comment: http://stackoverflow.com/comment/35268610
has comment: http://stackoverflow.com/comment/35271752
tagged with: itext
upvote count: 1
has comment: http://stackoverflow.com/comment/35271230
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/35269163

http://stackoverflow.com/q/22973848
tagged with: automated-refactoring
answer count: 2
has answer: http://stackoverflow.com/a/46691778
downvote count: 0
favorite count: 0
has title: Is there a command line tool to Optimize Imports on Java project?
type: UnansweredQuestion
score: 11
tagged with: refactoring
tagged with: java
has body: I'm looking for a tool that will automate the process of optimizing the imports on a code base. This tool is available in most IDEs (IntelliJ for instance) which removes unused imports and expands any .* imports into the those specifically used by the code. I'd like to add this as a MVN goal, or Ant Task, or just something I can run before my commit/push. Perhaps there is a way run IntelliJ at the command line to specifically execute this feature, but I haven't found such a command.
type: Question
upvote count: 11
has answer: http://stackoverflow.com/a/22974302

http://stackoverflow.com/a/23125993
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23125946
has body: Well, first of, you should call super.paint(g)...this is very important, as part of it's job is to paint the child components... Having said that...You should avoid overriding paint especially of top level containers like JFrame, instead, you should create a custom component that extends from something like JComponent (like JPanel for example) and override it's paintComponent method instead. You should also avoid painting to components that contain other components, unless you're planning on painting a background image of some kind, for example. Instead, separate your containers, so you're painting doesn't end up under other components...unless thats what you're aming for, then you should carry on... Take a closer look at Performing Custom Painting and Painting in AWT and Swing for more details

http://stackoverflow.com/q/23028722
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23029605
has title: Verifying a Text in SWT and trying to clear it but doesn't work
has answer: http://stackoverflow.com/a/23029605
tagged with: text
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: swt
type: Question
has body: I am trying to verify a text in SWT to allow only binary numbers and it works, but my problem is that I have a button that I need to reset the field but it doesn't work. Here is the code DACMUX.addVerifyListener(new VerifyListener() { public void verifyText(VerifyEvent e) { e.doit = false; char myChar = e.character; if (myChar == '1' || myChar == '0' || myChar == '\b'){ e.doit = true; } } }); reset.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { DACMUX.setText(""); } @Override public void widgetDefaultSelected(SelectionEvent e) { // TODO Auto-generated method stub } });
upvote count: 1

http://stackoverflow.com/comment/35135140
comment on: http://stackoverflow.com/a/23003882
type: Comment
has text: Yeah have been doing it this way but I guess there is no other way.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22972095
downvote count: 0
has comment: http://stackoverflow.com/comment/35078639
has comment: http://stackoverflow.com/comment/35078560
has comment: http://stackoverflow.com/comment/35078075
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35078401
upvote count: 1
has body: A char is 16 bits, i.e. 2 bytes. You're reading from the middle of the first character, which results in an unmappable unicode character (which is translated to '?'). You want to do seek(2) instead. From the javadoc for public final void writeChar(int v): Writes a char to the file as a two-byte value, high byte first. The write starts at the current position of the file pointer.
answers question: http://stackoverflow.com/q/22972023
has comment: http://stackoverflow.com/comment/35078033

http://stackoverflow.com/comment/35086731
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22976226
has text: Sorry about this being a duplicate. Didn't realize this would be labeled as rotating swing text

http://stackoverflow.com/a/22986479
score: 0
type: Answer
has body: AFAIK looking for a file index.xxx (xxx being a container specific extension, xhtml i your case) is default behavior if just a folder is provided in the url. The welcome file would be used if the user didn't provide any further information than that the application should be accessed. Thus http://webappname/ should resolve to the welcome file while http://webappname/admin/ would resolve to admin/index.xhtml. You could use a global rewriting to redirect the user to the welcome file, either by using an external webserver like Apache with mod_rewrite or an internal url rewriting like the Tuckey URL Rewriting library. Btw, since your welcome file is called login.xhtml, shouldn't the user always be redirected when she's not logged in?
has comment: http://stackoverflow.com/comment/35141761
answers question: http://stackoverflow.com/q/22986292

http://stackoverflow.com/comment/35335532
type: AnswerComment
type: Comment
has text: @atamanroman author is already altering initial array, so I believe he doesn't care about index information :)
comment on: http://stackoverflow.com/a/23114395
score: 0

http://stackoverflow.com/q/23017127
has body: I have an Android Application which uploads data to an FTP(S) Server. Everything works fine until I hash my passwords. The strange thing is that login/upload and disconnect to the server seems to work, but my FTP shows no new data. Heres the code where I fill my password: MessageDigest sha; try { sha = MessageDigest.getInstance("SHA-1"); byte[] hashOne = sha.digest(etPassword.getText().toString().getBytes()); server.setPassword(hexEncode(hashOne)); } catch (NoSuchAlgorithmException e) { // } static private String hexEncode(byte[] aInput) { StringBuffer result = new StringBuffer(); char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; for (byte b : aInput) { result.append(digits[(b &amp; 0xf0) &gt;&gt; 4]); result.append(digits[b &amp; 0x0f]); } return result.toString(); } and in my Upload Service: private void ftpUpload(File localSrc) { try { FTPSClient ftps = new FTPSClient(); ftps.connect(server.getIp()); ftps.login(server.getUser(), server.getPassword()); ftps.changeWorkingDirectory(server.getRemoteDir()); ftps.setFileType(FTPClient.BINARY_FILE_TYPE); try { upload(localSrc, ftps); // does the upload magic } catch (Exception e) { // } finally { ftps.disconnect(); } } catch (Exception e) { // } } For testing purposes I tried to use FTPClient instead, but I got the same problem. Btw I use Apache commons-net for the FTP stuff. I get no exception and everything seems to be working just fine. (ftps.isConnected()also says that I am connected). But no new data has been put to the FTP Server. Has anyone an idea what the problem could be? edit: I'm not sure if I was clear in my initial post. I want the user to put in ip/username/password of an FTP(S) Server und later in the app some data should be uploaded to this server. Since I dont want to save the users password in plaintext in my database I wanted to hash it first. But since I hashed it before saving the password to the database I cant login to the FTP(S) Server, because o…
tagged with: ftps
tagged with: android
has answer: http://stackoverflow.com/a/23017237
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35180654
tagged with: ftp-client
has title: Hashed password causes FTP Upload problems
type: Question
tagged with: apache-commons
tagged with: java
has comment: http://stackoverflow.com/comment/35159690
score: 0
answer count: 1

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/23028796
tags question: http://stackoverflow.com/q/23126587
tags question: http://stackoverflow.com/q/23118074
tags question: http://stackoverflow.com/q/23084897
type: Tag

http://stackoverflow.com/comment/35200563
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23039569
has text: From what I've read and understand, one the reasons for importing implicitly like this is it could improve compilation. It also reduces ambiguity when two classes have the same name
type: QuestionComment

http://stackoverflow.com/a/23051457
upvote count: 1
has body: Please look closly to your condition of inner while loop. while (choice &lt; 1 &amp;&amp; choice &gt; 4 ) Means loop will work until choice&lt;1 and choice>4 remains true. Is it exactly what you want? I think No because what if input is 5 it is true for >4 but false for &lt;1 what you want is you need to loop things until user enters correct input. Am I right? So what you need to do is just change condition like this while(choice&lt;1 || choice&gt;4) As Jared stated. One more thing I want to suggest you don't you think you should break; external loop while user enters wrong input.(No problem) You can do one this also. ArrayList&lt;Integer&gt; ar=new ArrayList&lt;Integer&gt;(4); ar.add(1); ar.add(2); ar.add(3); ar.add(4); while(true) { if(ar.contains(choice)) { //Go On } else { //Print old stuff } }
downvote count: 0
answers question: http://stackoverflow.com/q/23050941
type: Answer
score: 1

http://stackoverflow.com/q/23096536
type: Question
tagged with: uri
has answer: http://stackoverflow.com/a/23096956
has title: Java URI#resolve improperly resolves relative URLs in certain cases
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23096956
type: AnsweredQuestion
score: 1
tagged with: java
has body: I'm writing my own web crawler in Java, and I'm using URI#resolve to resolve URLs that appear on every HTML page that my crawler encounters. In certain cases, it's behaving in an unexpected way. For example, while crawling https://hacks.mozilla.org, I notice that one of the URLs extracted is https://hacks.mozilla.orgabout/ (indeed, if you look at the HTML source for that page, you will find an &lt;a href="about/"&gt;). I did some testing, and got these results: URI uri1 = new URI("https://hacks.mozilla.org").resolve("about/"); System.out.println(uri1); // =&gt; https://hacks.mozilla.orgabout/ URI uri2 = new URI("https://hacks.mozilla.org/").resolve("about/"); System.out.println(uri2); // =&gt; https://hacks.mozilla.org/about/ I don't know how practical it is to attempt to mitigate this issue by manually adding the slash after the base URL, but I want to know if there is an actual non-hacky fix to this problem. I did a little more experimentation, and realized that this happens when the path element is empty (null or 0-length string): URI uri3 = new URI("http", null, "hacks.mozilla.org", 80, "", null, null).resolve("about/"); System.out.println(uri3); // =&gt; http://hacks.mozilla.org:80about/
upvote count: 1

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/23048399

http://stackoverflow.com/comment/38027715
type: Comment
has text: Couple of further issues regarding your question, in any plane you have coordinates that increase in the positive range and/or the negative range based on your direction of movement from the point of origin. Based on your example you have given you appear to be assuming that x and z are only increasing on the positive scale and therefore only located in one quarter of the plane grid. Also as Matthew pointed out is your y coordinate a factor in the region counting? or is the region only determined by the x,z plane alone.
score: 0
comment on: http://stackoverflow.com/q/23068475
type: QuestionComment

http://stackoverflow.com/comment/35334950
type: Comment
comment on: http://stackoverflow.com/q/23114092
has text: `static final char telnetEscape = 29;` Is that what you needed to know?
score: 0
type: QuestionComment

http://stackoverflow.com/q/23072353
has body: I feel like a kid in a candy store--in trying yet again to get a handle on key bindings I stumbled onto setMnemonic() (in Netbeans form designer and its ton of generated code) and [especially!] the setDisplayedMnemonic() / setActionFor() pair (from Googling "can jlabel have mnemonic"), which seems a godsend. All I know is that the following code just made my latest app a whole lot more user friendly in that it has rendered mouse/touchpad unnecessary. btnRemoveScratchWords.setMnemonic(VK_C); btnSearch.setMnemonic(VK_H); btnClearOutput.setMnemonic(VK_O); btnExit.setMnemonic(VK_X); btnHelp.setMnemonic(VK_H); lblPattern.setDisplayedMnemonic(VK_P); lblPattern.setLabelFor(txtPattern); lblLegal.setDisplayedMnemonic(VK_L); lblLegal.setLabelFor(txtLegal); lblMust.setDisplayedMnemonic(VK_R); lblMust.setLabelFor(txtRequiredLetters); lblMinimumPointsPerLetter.setDisplayedMnemonic(VK_R); lblMinimumPointsPerLetter.setLabelFor(txtMinScore); But is key bindings a better way to do this?
has comment: http://stackoverflow.com/comment/35268496
has comment: http://stackoverflow.com/comment/35293876
has comment: http://stackoverflow.com/comment/35293533
answer count: 1
downvote count: 0
tagged with: keyboard-shortcuts
favorite count: 0
has comment: http://stackoverflow.com/comment/35294049
has answer: http://stackoverflow.com/a/23123189
has title: Key bindings vs. setMnemonic, setDisplayedMnemonic, and setLabelFor
tagged with: swing
type: AnsweredQuestion
tagged with: key-bindings
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23123189

http://stackoverflow.com/q/23027945
tagged with: oop
accepted answer: http://stackoverflow.com/a/23027980
upvote count: 3
has answer: http://stackoverflow.com/a/23028082
tagged with: java
has answer: http://stackoverflow.com/a/23028067
has comment: http://stackoverflow.com/comment/35179477
type: Question
has body: arraylists, buffered reader, scanner, etc.. all "Default" classes that "already exist" in the language.. unlike, say, public class widthOfTable which would be a "made up" class , that " did not already exist in language".. why is there no term to distinguish these ideas when teaching? I barely discovered this difference in college , despite being here 3 years.
downvote count: 0
has comment: http://stackoverflow.com/comment/35179473
has title: Term to distinguish "default" vs "made-up" classes in OOP
has answer: http://stackoverflow.com/a/23027980
tagged with: language-agnostic
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/23028011
has comment: http://stackoverflow.com/comment/35179476
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23028082
score: 3

http://stackoverflow.com/a/23080264
has comment: http://stackoverflow.com/comment/90668321
accepted answer of: http://stackoverflow.com/q/23079492
type: Answer
upvote count: 35
has comment: http://stackoverflow.com/comment/71150584
downvote count: 0
has comment: http://stackoverflow.com/comment/65509993
has comment: http://stackoverflow.com/comment/35273988
has comment: http://stackoverflow.com/comment/35332334
answers question: http://stackoverflow.com/q/23079492
score: 35
has comment: http://stackoverflow.com/comment/35273799
has body: WildFly adds slf4j as a default logging dependency Have you tried excluding the main implementation in jboss-deployment-structure.xml descriptor (It should go under the META-INF directory). This can be done with below lines: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;jboss-deployment-structure&gt; &lt;deployment&gt; &lt;exclusions&gt; &lt;module name="org.apache.commons.logging" /&gt; &lt;module name="org.apache.log4j" /&gt; &lt;module name="org.jboss.logging" /&gt; &lt;module name="org.jboss.logging.jul-to-slf4j-stub" /&gt; &lt;module name="org.jboss.logmanager" /&gt; &lt;module name="org.jboss.logmanager.log4j" /&gt; &lt;module name="org.slf4j" /&gt; &lt;module name="org.slf4j.impl" /&gt; &lt;/exclusions&gt; &lt;/deployment&gt; &lt;/jboss-deployment-structure&gt;
type: AcceptedAnswer

http://stackoverflow.com/comment/35303546
has text: Bob: You have created a new class called `WordCount` but unlike other Java objects you cannot just compare these using the .equals() method as it hasn't been implemented.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23096329
type: Comment

http://stackoverflow.com/q/23086165
has answer: http://stackoverflow.com/a/23086226
accepted answer: http://stackoverflow.com/a/23086226
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23086277
type: Question
possible better answer: http://stackoverflow.com/a/23086322
has title: Passing Image in java
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35284403
has body: Can someone help me with this Error that I get. When I try to pass in the image it gives me Error. This is part of my project, I completed the rest but have problem with the main screen. Here is the Error: Project.java:36: cannot find symbol symbol : method drawImage(java.awt.Image) location: class java.awt.Graphics g.drawImage(img); ^ 1 error ----jGRASP wedge: exit code for process is 1. ----jGRASP: operation complete. And this the full Program: import javax.imageio.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.util.*; public class Project extends JPanel implements KeyListener, MouseListener, MouseMotionListener { char shape = 'r'; int x = 0; int y = 0; Image img; boolean start = false; boolean help = false; boolean Player1 = false; boolean Player2 = false; public Project() { img = Toolkit.getDefaultToolkit().getImage("mp.jpg"); setFocusable(true); addKeyListener(this); addMouseListener(this); addMouseMotionListener(this); setSize(400, 400); } public void paintComponent(Graphics g) { // BG Dimension d = getSize(); g.setColor(getBackground()); // IMAGE ************************************* ERROR g.drawImage(img); g.setColor(Color.black); // Help g.setFont(new Font("default", Font.BOLD, 12)); if (x &gt;= 900 &amp;&amp; x &lt;= 950 &amp;&amp; y &gt;= 600 &amp;&amp; y &lt;= 650 &amp;&amp; start == false) { g.drawString("Press START to", 960, 620); g.drawString("start the game.", 960, 635); } if (x &gt;= 900 &amp;&amp; x &lt;= 950 &amp;&amp; y &gt;= 600 &amp;&amp; y &lt;= 650 &amp;&amp; start) { g.drawString("Choose a Player", 960, 620); } else { g.setColor(Color.red); g.fillOval(900, 600, 50, 50); g.setFont(new Font("default", Font.BOLD, 45)); g.setColor(Color.cyan); g.drawString("?", 915, 640); } // Help g.setColor(Color.black); g.fillRect(550, 555, 97, 50); g.setFont(new Font("default", Font.BOLD, 30)); g.setColor(Color.cyan); g.drawString("Start", 559, 590); // Start if (start) { g.setColor(Color.black); g.fillRect(400, 550, 400, 5…
has answer: http://stackoverflow.com/a/23086322

http://stackoverflow.com/a/23060866
type: Answer
has body: You are creating a new WindowEvent with WindowEvent tabClosingEvent = new WindowEvent(this,.... and posting this to the event queue. The this here refers to the main frame. That's why it is closed. However, you should usually not mess around with the event queue manually. Instead, you should do the respective actions programmatically with the method that perform the desired actions. There are some parts of the code between the first { and the last } that might benefit from a slight cleanup, but in order to solve the actual issue, you could change your closeActionPerformed method to something like this: private void closeActionPerformed(java.awt.event.ActionEvent evt) { Component c = tPane.getSelectedComponent(); if (c instanceof JInternalFrame) { JInternalFrame f = (JInternalFrame)c; f.dispose(); tPane.remove(f); } } (BTW: Then you also don't need the InternalFrameListener any more)
score: 0
answers question: http://stackoverflow.com/q/23059183

http://stackoverflow.com/comment/35602057
score: 0
type: Comment
has text: I haven't been able to test this answer yet (code moved on, problems not reoccurring etc.), but I suspect its correct. You get an up-vote for now, and a shiny green tick if I can ever prove it :-)
comment on: http://stackoverflow.com/a/23077033
type: AnswerComment

http://stackoverflow.com/comment/35318635
score: 0
has text: Seems be a bug in JBoss AS (https://community.jboss.org/message/259438) - but that should be fixed in 4.2.3 I guess. Are you sure that the permissions are correct, i.e can the user running JBoss actually access the deploy folder? Never happened before? Could be that you're running out of file descriptors.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23105304

http://stackoverflow.com/comment/35072831
type: Comment
has text: I am using intellij idea and I don't have gradles as says in the tutorial. What should I do in this case? I tried to import th whole project and I still have the fail
comment on: http://stackoverflow.com/q/22968979
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35319055
comment on: http://stackoverflow.com/a/23105713
type: Comment
has text: What about the 2020? Is it a specific port in which RMI runs or network connection or something? (This is all new to me) or could I put any port I wanted?
score: 0
type: AnswerComment

http://stackoverflow.com/a/23038270
downvote count: 0
answers question: http://stackoverflow.com/q/23038024
has comment: http://stackoverflow.com/comment/35198471
has comment: http://stackoverflow.com/comment/35198472
has comment: http://stackoverflow.com/comment/35198301
has comment: http://stackoverflow.com/comment/35198149
has comment: http://stackoverflow.com/comment/35198376
has comment: http://stackoverflow.com/comment/35216524
has body: An enum is used as a sort of pseudo-type. You do need the enumerated class because 1. it's part of your assignment and 2. it makes it just clearer to anyone reading your code (including yourself) what certain values mean. If you have some enum Day and some variable day1, it's easy to see what you're doing when you write if (day1.toString.equals("MONDAY")) but if you use magic numbers/pre-defined constants, it will look like if (day1 == 0) which is meaningless to anyone who didn't write the code (and possibly you in the future, when you're looking at this code again). In addition to that, using an enum disallows for garbage values. If you weren't using enums, you could define day1 to be 10,000 and it would be valid Java. This is a nonsensical value if you only have 7 days of the week. Enums provide a layer of abstraction that avoid garbage values and gives you explicit control over how an Enum is handled. Implementation of the Position enum //in Position.java public enum Position { DESIGN("Design"), MANUFACTURING("Manufacturing"), SALES("Sales"); private final String positionName; //note enums have private constructors private Position(String positionName) { this.positionName= positionName; } //you're overriding the default toString() method //defined for all objects in Java, so add @Override @Override public String toString() { return positionName; } } Thus in your Employee class you declare an Employee with: Employee employee = new Employee("John", "Deer", DESIGN); Since you're going to want to keep track of how many of each position you have, you need to create an attribute in Company that stores the number of employees of a given type. So in Company in your attribute declaration you will create 3 integers: private int numOfDesigners; private int numOfManufacturers; private int numOfSalesmen; Whenever you add an employee, you want to make sure there aren't too many already, so you'll encapsulate the creation of the Employee class inside an public boolean addEmploy…
has comment: http://stackoverflow.com/comment/35215613
has comment: http://stackoverflow.com/comment/35209500
type: Answer
has comment: http://stackoverflow.com/comment/35206522
upvote count: 1
has comment: http://stackoverflow.com/comment/35216545
score: 1
has comment: http://stackoverflow.com/comment/35198168
has comment: http://stackoverflow.com/comment/35198245
has comment: http://stackoverflow.com/comment/35198635
accepted answer of: http://stackoverflow.com/q/23038024
has comment: http://stackoverflow.com/comment/35216836
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35198413

http://stackoverflow.com/comment/35340495
score: 0
type: Comment
type: QuestionComment
has text: @amitsalyan I see, how did you know it uses sax? because of the logback module? (I'm assuming that's where it came from). How would I go about using an external jar? add it to the ear/lib folder? -- or add it to the classpath?
comment on: http://stackoverflow.com/q/23116695

http://stackoverflow.com/q/23069478
has comment: http://stackoverflow.com/comment/35255560
has title: How to remove the brackets and commas from a .ToString Array
has body: I am making a random binary generator. int onenum = rand1.nextInt(2); int twonum = rand2.nextInt(2); int threenum = rand3.nextInt(2); int fournum = rand4.nextInt(2); int fivenum = rand5.nextInt(2); int sixnum = rand6.nextInt(2); int sevennum = rand7.nextInt(2); int eightnum = rand8.nextInt(2); int binary[] = {onenum, twonum, threenum, fournum, fivenum, sixnum, sevennum, eightnum}; System.out.println(java.util.Arrays.toString(binary)); The code needs to be ready to be copied at any time. and a result of {1, 0, 1, 1, 0, 1, 0, 0, 1} doesn't allow for easy copying. How do I make the result say 101101001. Meaning removing the brackets and commas from the array either before or while its turned into a string.
has answer: http://stackoverflow.com/a/23069565
downvote count: 1
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/35255146
favorite count: 0
upvote count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/35257087
tagged with: java
score: -1

http://stackoverflow.com/q/23096231
has body: I need to repeat a date every last day of February, I am using Joda time to use a rule to generate the dates for days, weeks, months, etc. For Months is working fine but when is about years I receive wrong outputs. private static List&lt;DateTime&gt; calculateRecurrentDates(DateTime startDate, String recurrentRule) { List&lt;DateTime&gt; dates = new ArrayList&lt;DateTime&gt;(); TimeStamp startDate = Timestamp.valueOf("2011-02-28 10:10:10"); String recurrentRule = "RRULE:FREQ=YEARLY;COUNT=6;INTERVAL=1;"; String leapYearRule = "RRULE:FREQ=YEARLY;COUNT=6;INTERVAL=1;BYMONTHDAY=28,29;BYSETPOS=-1"; try { DateTimeIterable range = DateTimeIteratorFactory.createDateTimeIterable(recurrentRule, startDate, DateTimeZone.UTC, true); for (DateTime date : range) { dates.add(date); } } catch (ParseException e) { dates = null; logger.error(e.getMessage()); } return dates; } But I receive this: 2011-02-28T10:10:10.000Z 2012-02-28T10:10:10.000Z 2013-02-28T10:10:10.000Z 2014-02-28T10:10:10.000Z 2015-02-28T10:10:10.000Z 2016-02-28T10:10:10.000Z and in the case is in a leap year this: 2012-02-29T10:10:10.000Z 2012-12-29T10:10:10.000Z 2013-12-29T10:10:10.000Z 2014-12-29T10:10:10.000Z 2015-12-29T10:10:10.000Z 2016-12-29T10:10:10.000Z 2017-12-29T10:10:10.000Z How I write one rule to get the last day of February every year?
tagged with: java
has title: How to make a date repeat every year for the last day of February in java for iCal google-rfc-2445
tagged with: icalendar
type: Question
possible better answer: http://stackoverflow.com/a/23154031
tagged with: jodatime
tagged with: rfc2445
score: 0
has answer: http://stackoverflow.com/a/23113142
has answer: http://stackoverflow.com/a/23154031
has comment: http://stackoverflow.com/comment/35331716
accepted answer: http://stackoverflow.com/a/23103751
has comment: http://stackoverflow.com/comment/35303254
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23103751
has answer: http://stackoverflow.com/a/23101718

http://stackoverflow.com/a/23046310
type: Answer
score: 1
upvote count: 1
has body: change size = size + 200 to Foo.size = size + 200; size is local in your method, then you change the variable that you want. The problem is that the parameter name size is equal to name of the static field size so when you point it in that method compiler considers the local variable.
downvote count: 0
has comment: http://stackoverflow.com/comment/35212368
answers question: http://stackoverflow.com/q/23046292

http://stackoverflow.com/comment/35160656
comment on: http://stackoverflow.com/a/23017597
type: AnswerComment
score: 0
type: Comment
has text: Ok, as you wish. I always try to correct all the errors or mistakes of the OP in my answers, but it's just my approach and others may find it a bad idea.

http://stackoverflow.com/q/23061611
tagged with: bson
linked to: http://stackoverflow.com/q/36134737
has body: new Gson().toJson(new ObjectId()) When I do the above, the output I get is "_id" : { "_time" : 1374347520 , "_machine" : -1025067326 , "_inc" : 585905201 , "_new" : false} But Actually I want it to be as "_id":{"$oid":51eae100c2e6b6c222ec3431} which is the usual mongodb ID format. What is the preferable method in Java for this? Update: My value object import com.google.gson.annotations.SerializedName; import org.bson.types.ObjectId; public class TaskObject { @SerializedName("_id") private ObjectId _id; @SerializedName("revNo") private int revNo; } I am trying to store this to mongodb with a custom _id TaskObject taskObject = new TaskObject(); taskObject.set_id(new ObjectId()); TaskMongoDBClient.getInstance(). persistNewTaskData(new Gson().toJson(taskObject)); What is stored in the mongodb looks like this. _id: { "_time" : 1397464341 , "_machine" : 1441187434 , "_inc" : -1687457948 , "_new" : true} Instead of _id:{"$oid": xxxx} which i can query by using a the oid value. What I am doing wrong here? please help. Thanks
has comment: http://stackoverflow.com/comment/35240741
answer count: 1
has comment: http://stackoverflow.com/comment/35250064
favorite count: 0
has answer: http://stackoverflow.com/a/23393169
has title: Converting BSON Type ObjectId to JSON (Storing in Mongodb) -Java
type: UnansweredQuestion
score: 6
tagged with: java
tagged with: gson
has comment: http://stackoverflow.com/comment/35241954
upvote count: 7
downvote count: 1
type: Question
tagged with: mongodb
has comment: http://stackoverflow.com/comment/35249958

http://stackoverflow.com/comment/35255764
comment on: http://stackoverflow.com/a/23069774
type: AnswerComment
score: 0
type: Comment
has text: it is wrong... it would start at 3...

http://stackoverflow.com/comment/35345011
type: Comment
type: QuestionComment
has text: That's fine, but your LogCat stack trace is useless, because it is from code other than what you have now.
score: 0
comment on: http://stackoverflow.com/q/23118832

http://stackoverflow.com/comment/35106175
score: 0
type: AnswerComment
has text: It alert it shows whatever I type in the ` ` named editor.
comment on: http://stackoverflow.com/a/22987794
type: Comment

concurrency
tags question: http://stackoverflow.com/q/23104012
tag name: concurrency
tags question: http://stackoverflow.com/q/23065675
tags question: http://stackoverflow.com/q/23002090
tags question: http://stackoverflow.com/q/23016664
tags question: http://stackoverflow.com/q/23017888
tags question: http://stackoverflow.com/q/23049833
tags question: http://stackoverflow.com/q/23011480
tags question: http://stackoverflow.com/q/23126801
tags question: http://stackoverflow.com/q/22981673
tags question: http://stackoverflow.com/q/23070997
tags question: http://stackoverflow.com/q/23041328
tags question: http://stackoverflow.com/q/23011189
tags question: http://stackoverflow.com/q/22980568
tags question: http://stackoverflow.com/q/22978198
tags question: http://stackoverflow.com/q/23076177
tags question: http://stackoverflow.com/q/23093581
tags question: http://stackoverflow.com/q/23030723
tags question: http://stackoverflow.com/q/22990750
tags question: http://stackoverflow.com/q/23086236
tags question: http://stackoverflow.com/q/22997434
tags question: http://stackoverflow.com/q/23119711
type: Tag
tags question: http://stackoverflow.com/q/23095934

http://stackoverflow.com/comment/35144238
type: Comment
comment on: http://stackoverflow.com/q/23008090
score: 0
type: QuestionComment
has text: yes, but I need to put in the jFrame2 or JDialog 9 buttons with a big image on each button. JDialog can be configured with 9 buttons each with a picture and some actions?

http://stackoverflow.com/comment/77066100
type: Comment
has text: You need to be aware of some packaging differences here. If you are using version >= 1.4.x of Spring Boot, the plugin changed to package the files under `BOOT-INF/classes`, _not_ at the root of the JAR file. If you execute the JAR file in a way that expects the files to be at the root of the JAR file, execution will fail.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23003879

http://stackoverflow.com/comment/35203861
has text: @user3127499 n yes i have set the method to post and i have given the form action as the name of the servlet
comment on: http://stackoverflow.com/q/23041750
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23044796
score: 1
favorite count: 0
has title: editing the while loop
type: Question
answer count: 2
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/23044845
possible better answer: http://stackoverflow.com/a/23044885
has answer: http://stackoverflow.com/a/23044885
has body: I have a while loop in my video poker java game. I'm using this loop to ask the player whether they want to keep the current cards in their hand. There's another while loop inside the first one that asks the player to enter a valid answer in case their entered anything other than "yes" or "no." For some reason, it skips every other card in the hand. For instance, it will say, "Do you want to keep card number 1?" Then I press yes/no, and it asks next, "Do you want to keep card number 3?" instead of number 2. Can you help me figure out why this is happening, please? int i = 1; while (i &lt; 6) { System.out.println("Would you like to keep the card number " + i + "?"); System.out.println("Enter yes or no"); String answer = input.next(); while((!answer.equals("yes")) &amp;&amp; (!answer.equals("no"))) { System.out.println("Please enter a valid answer"); answer = input.next(); } if (answer.equals("yes")) { toKeep.add(p.getHand().get(i-1)); i++; } else if (answer.equals("no")); { i++; } }
downvote count: 0
tagged with: while-loop
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23044845

http://stackoverflow.com/comment/35170778
score: 1
has text: ideally stream should be closed in finally block so that even if there is some exception it will be closed in the finally block.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23022824

http://stackoverflow.com/comment/111725833
type: AnswerComment
has text: Good point -you can take the max of length of the substring vs 3.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23019662

http://stackoverflow.com/comment/35222712
type: Comment
type: QuestionComment
has text: @adneal yes that is my question but this question is updated with my different code.
comment on: http://stackoverflow.com/q/23051981
score: 0

http://stackoverflow.com/comment/35121941
comment on: http://stackoverflow.com/q/22996276
type: QuestionComment
type: Comment
score: 0
has text: Can you give me concrete code how to solve this?

http://stackoverflow.com/a/23067212
score: 1
upvote count: 1
has body: I haven't tracked down any official documentation regarding your issue, but the problem appears to be that your frame is not invalidating and re-validating itself when you add the components to it. I was able to resolve this two different ways. Move your call for frame.setVisible(true) to after you have built the GUI. This will force the frame to re-validate its layout before displaying. Make a call to frame.validate() after building the GUI, which also solves the problem. Placing either of these in the final line of your Builder constructor worked fine for me in both cases. Ordinarily, adding components to another component should force a re-validation, but for some reason this is not happening. However, I generally try to add all my components to my frames before making them visible anyways, and might be a good practice to get into. Edit: I found this in the API documentation for the add(Component comp) method in java.awt.Containter (emphasis mine): This method changes layout-related information, and therefore, invalidates the component hierarchy. If the container has already been displayed, the hierarchy must be validated thereafter in order to display the added component. Thus, if the component is already visible, it must be validated. Calling setVisible(true) will cause a validation, and is why if it is called after adding everything fixes the problem.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23066586
answers question: http://stackoverflow.com/q/23066586
has comment: http://stackoverflow.com/comment/35250753

http://stackoverflow.com/comment/35197958
type: Comment
type: QuestionComment
has text: I deleted, don't know why I put it. I'm kinda tired and not thinking very straight.
score: 0
comment on: http://stackoverflow.com/q/23038024

http://stackoverflow.com/q/23022703
type: UnansweredQuestion
tagged with: maven
has title: Maven Source Plugin - How do I generate the source jar for ONLY the classes I want included
tagged with: java
type: Question
answer count: 1
score: 0
tagged with: pom.xml
has answer: http://stackoverflow.com/a/23023013
has body: Currently, the project I am working on has all of the code for the web service in a single and is creating a war and a jar file. The Jar file only contains the bare minimum of classes shared by other projects. I don't have the option to split the shared classes out into a separate core project at this time. (Though I would prefer that) I'm trying to put only the necessary java files in the source jar: Common_Model-1.1.2.jar Common_Model-1.1.2.jar-sources I have something like this in my POM: maven-jar-plugin 2.3.2 jar gov/app/api/common/models/** gov/app/api/intra/models/** gov/app/api/models/** Common_Model-1.1.2 maven-source-plugin jar gov/app/api/common/models/** gov/app/api/intra/models/** gov/app/api/models/** Common_Model-1.1.2 While this does create the sources jar, it ignores the includes configuration and adds all of the .java files from the entire project. I've also tried using <excludes>, but that too is ignored.

mongodb
tags question: http://stackoverflow.com/q/23008014
tags question: http://stackoverflow.com/q/23034024
tags question: http://stackoverflow.com/q/23023078
tags question: http://stackoverflow.com/q/23026722
tags question: http://stackoverflow.com/q/23061611
tags question: http://stackoverflow.com/q/23017978
tag name: mongodb
tags question: http://stackoverflow.com/q/23050602
tags question: http://stackoverflow.com/q/23069381
type: Tag
tags question: http://stackoverflow.com/q/23050559
tags question: http://stackoverflow.com/q/22995541
tags question: http://stackoverflow.com/q/23094415
tags question: http://stackoverflow.com/q/23066349
tags question: http://stackoverflow.com/q/23015301
tags question: http://stackoverflow.com/q/23084553
tags question: http://stackoverflow.com/q/23067022

http://stackoverflow.com/q/23105261
has body: By using ant build system, I can put sample.xml file under $projectDir/src directory, and when ant build finished, the file is in the generated apk's root directory. But this method does not work in gradle build system. How can I get the same result by using Android Studio(gradle)? Thanks.
favorite count: 0
has title: By using android gradle,how to pack a file to apk zip root directory?
type: Question
score: 3
tagged with: android
upvote count: 3
has comment: http://stackoverflow.com/comment/39154953
has comment: http://stackoverflow.com/comment/38289429
tagged with: ant
tagged with: java
type: UnansweredQuestion
answer count: 0
downvote count: 0

http://stackoverflow.com/q/23068006
favorite count: 0
has comment: http://stackoverflow.com/comment/35252357
has comment: http://stackoverflow.com/comment/35251849
tagged with: java-8
has comment: http://stackoverflow.com/comment/35252146
tagged with: method-reference
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35251981
has comment: http://stackoverflow.com/comment/35252220
downvote count: 1
has title: In Java 8, how do I make a method reference to a method that takes no parameters and returns void?
type: Question
score: 3
has answer: http://stackoverflow.com/a/23068007
has comment: http://stackoverflow.com/comment/35252028
upvote count: 4
has body: I have a bunch of methods with this signature: public void sideEffects() {...} public void foo() {...} public void bar() {...} (That is, they return void and take no parameters) And I'd like to be able to populate a List by doing something like this: list.add(MyClass::sideEffects); list.add(MyClass::foo); list.add(MyClass::bar); But, I'm unable to find a built in @FunctionalInterface in the java.util.function package that supports this signature. Will I have to create my own @FunctionalInterface for this?
answer count: 1
has comment: http://stackoverflow.com/comment/35251937

http://stackoverflow.com/comment/35318522
type: QuestionComment
comment on: http://stackoverflow.com/q/23105724
has text: "*even though the value of 's' is same as that the value in condition*" => is it?
score: 0
type: Comment

http://stackoverflow.com/a/23055635
type: Answer
has comment: http://stackoverflow.com/comment/35230079
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35331722
has comment: http://stackoverflow.com/comment/35229235
has body: Copied from here, but changed the api call argument. connecting to shared folder in windows with java String url = "smb://[NAS server-IP or hostname]/file-or-directory-path"; NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("[company network domain]", "user", "password"); SmbFile dir = new SmbFile(url, auth); for (SmbFile f : dir.listFiles()) { System.out.println(f.getName()); }
upvote count: 1
answers question: http://stackoverflow.com/q/23055158

http://stackoverflow.com/q/23041579
tagged with: liferay
has title: Name conflicts in Vaadin WidgetSet
tagged with: javascript
upvote count: 1
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: gwt
has body: I am working on integrating third party javascript libraries into a Vaadin WidgetSet for a Liferay portal. I am using Vaadin version 6.7.3 and Liferay 6.1. There are, so far, two independent projects and each generates a differente jar file. The inherits element is the same in both the cliend-side module descriptors: &lt;inherits name="com.vaadin.portal.gwt.PortalDefaultWidgetSet" /&gt; When I use the Vaadin Liferay Control Panel to recompile my WidgetSet, I see that the results of the compilation are dumped into tomcat-folder/webapps/ROOT/html/VAADIN/widgetsets/com.vaadin.portal.gwt.PortalDefaultWidgetSet, which is expected. Each Widget defines their own javascript and stylesheets in their client-side module descriptors like so: Widget 1 &lt;script src="script_1.js"&gt;&lt;/script&gt; &lt;stylesheet src="styles_1.css"&gt;&lt;/stylesheet&gt; Widget 2 &lt;script src="script_2.js"&gt;&lt;/script&gt; &lt;stylesheet src="styles_2.css"&gt;&lt;/stylesheet&gt; Since each javascript file and stylesheet is named differently, I see that the folder tomcat-folder/webapps/ROOT/html/VAADIN/widgetsets/com.vaadin.portal.gwt.PortalDefaultWidgetSet does contain script_1.js, script_2.js, styles_1.css and styles_2.css. The problem is that there are name clashes. Both widgets define styles and functions in their stylesheets/javascript files, but some names are the same, which leads to unexpected behaviour. Using firebug, I have confirmed that both stylesheets and both javascript files are loaded when using either one of the widgets. I have also checked that if I undeploy one of the widgets and recompile the widget set, it works perfectly. Since those javascripts and stylesheets are actually third party provided and have been obfuscated for my reading pleasure, it would be a bit tedious to go through all names to resolve conflicts. I have tried to force the gwt compiler to rename the widgetset by passing properties in the client-side module descriptor, like so: &lt;set-property name="wid…
downvote count: 0
score: 1
tagged with: java
tagged with: vaadin
type: Question

http://stackoverflow.com/comment/35080638
comment on: http://stackoverflow.com/q/22973093
score: 0
type: Comment
type: QuestionComment
has text: I think you can convert your number to an array of chars, then sort them by descending alphanumerical order, then recombine them. Happy to suggest an implementation of this, if it sounds what you're after

http://stackoverflow.com/q/23050026
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/23050107
tagged with: nullpointerexception
type: AnsweredQuestion
has title: NullPointerException causing app to instantly crash
favorite count: 0
type: Question
has body: My apologies for the bad question title. My problem is that my app keeps instantly crashing once an action is performed. When I read back the error, I'm seeing an NullPointerException that is the reason for the crashing. The error states that it takes place in Main.java at line 48. Here is my full Main.java: package com.fuzzyapplications.tutorial.youtube.app; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; public class Main extends ActionBarActivity { public static final String EXTRA_MESSAGE = "com.fuzzyapplications.practice.app.MESSAGE"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @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); } public void sendMessage(View view){ Intent intent = new Intent(this, DisplayMessageActivity.class); EditText editText = (EditText) findViewById(R.string.edit_message); String message = editText.getText().toString(); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent); } } Also, here is the activity that should be activated (once a button is pushed package com.fuzzyapplications.tutorial.youtube.app; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import and…
tagged with: android
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/23050107
score: 0

http://stackoverflow.com/comment/35263583
has text: I dont understand how to link this to my arc :(
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23074049
score: 0

mime-mail
type: Tag
tags question: http://stackoverflow.com/q/23023583
tag name: mime-mail

keystroke
type: Tag
tags question: http://stackoverflow.com/q/23052777
tag name: keystroke

http://stackoverflow.com/comment/35273988
comment on: http://stackoverflow.com/a/23080264
has text: So am I. It is interesting that Similar questions are different when you type your question and when the question is actually submitted.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35237890
comment on: http://stackoverflow.com/q/23060292
type: Comment
type: QuestionComment
score: 2
has text: Variable.equals() and String.equals() are different methods. If you call equals() on a Variable, Variable.equals() will be executed. If you call equals() on a String, String.equals() will be executed. BTW, you should test your code, that would tell you if the code works as expected or not.

http://stackoverflow.com/comment/35244093
comment on: http://stackoverflow.com/a/23063121
type: Comment
has text: Does it output the same value for every instance of the same string. I mean will the vlaue be the same if i execute the code some time later(twice ,thrice, ....)?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35233583
type: AnswerComment
comment on: http://stackoverflow.com/a/23057712
score: 0
type: Comment
has text: In **Ex 1** every thread uses the same instance of `MySecondClass`.

http://stackoverflow.com/q/23061270
accepted answer: http://stackoverflow.com/a/23061327
score: 0
answer count: 2
tagged with: generics
has title: Trying to sub-type classes using generics
has answer: http://stackoverflow.com/a/23061327
possible better answer: http://stackoverflow.com/a/23061374
has answer: http://stackoverflow.com/a/23061374
type: AnsweredQuestion
tagged with: java
type: Question
has body: I am having problems trying to create a sub-type class, and calling its superconstructor with an ArrayList of objects of a certain generic type. I am trying to get this code to work. I want my SubTypes to ONLY accept a list of GenericObjects that are of type X. public class SubType extends SuperType{ public SubType(ArrayList&lt;GenericObject&lt;Y&gt;&gt; g) { super(g); } } public class SuperType { public ArrayList&lt;GenericObject&lt;?&gt;&gt; data = new ArrayList&lt;GenericObject&lt;? extends X&gt;&gt;(); public SuperType(ArrayList&lt;GenericObject&lt;? extends X&gt;&gt; series) { data.addAll(series); } } class GenericObject&lt;T extends X&gt;{} class X{}; class Y extends X{}; I get an error where the super(g) is called. It says that The constructor TestGenerics.SuperType(ArrayList>) is undefined Thats kind of strange because I thought that Generics allowed this kind of thing. If I don't pass through an ArrayList of my generic object, and just pass the generic object through then it is OK. public class SubType extends SuperType{ public SubType(GenericObject&lt;Y&gt; g) { super(g); } } public class SuperType { public ArrayList&lt;GenericObject&lt;?&gt;&gt; data = new ArrayList&lt;GenericObject&lt;? extends X&gt;&gt;(); public SuperType(GenericObject&lt;? extends X&gt; series) { data.add(series); } } class GenericObject&lt;T extends X&gt;{ } class X{}; class Y extends X{}; The above works perfectly. Is there any way to get the first example to work?

http://stackoverflow.com/a/23020461
downvote count: 0
has body: Why is it not needed for a Java application to follow the Java naming conventions? Because they're conventions rather than rules. It would be very odd for naming conventions to be enshrined in a language specification as actual rules - I don't think I've ever seen that. Naming it seen to be primarily a developer's choice, with some suggestions to make things more consistent between other developers. Any Java compiler which refused to compile unconventional code would be violating the Java Language Specification. Would you also suggest that brace formatting should be enforced by the compiler? How about the ordering of import statements? While I would certainly recommend that Java developers should follow the naming conventions - at least wherever reasonable (there can be odd capitalization cases which make this difficult... anything around iPhone for example could look odd one way or another) I would be against them being proscribed as "law" in the language specification.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23020388
accepted answer of: http://stackoverflow.com/q/23020388
score: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/35361824
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23129492
has text: This might not meet the OP's needs, because he wanted to match a pattern, not an exact value.
type: AnswerComment

http://stackoverflow.com/comment/35113326
score: 1
type: AnswerComment
has text: @user2672744: The manifest is usually generated when a project is created, not when a project is compiled.
comment on: http://stackoverflow.com/a/22991393
type: Comment

http://stackoverflow.com/comment/35342539
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23118770
has text: What do you think `Math.sqrt(radicand);` does?
type: Comment

http://stackoverflow.com/comment/35133612
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23002844
score: 0
has text: See [this answer](http://stackoverflow.com/a/21447111/2587435) for how to correctly use `Action` for menus and tool bars. Also see [How to Use Actions](http://docs.oracle.com/javase/tutorial/uiswing/misc/action.html)

http://stackoverflow.com/comment/35336259
score: 0
has text: Yeah, that's because I misread your intent and jumped to the wrong conclusion.
type: Comment
comment on: http://stackoverflow.com/a/23114975
type: AnswerComment

http://stackoverflow.com/q/22984343
score: 18
upvote count: 18
has comment: http://stackoverflow.com/comment/35099529
answer count: 2
possible better answer: http://stackoverflow.com/a/70797396
tagged with: sql
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/35099717
favorite count: 0
has answer: http://stackoverflow.com/a/70797396
tagged with: querydsl
has title: How to call mysql function using querydsl?
has comment: http://stackoverflow.com/comment/35099908
type: AnsweredQuestion
has body: I am in little hurry so, i just want to ask a quick question about querydsl. According to my research, query dsl doesn't support stored procedure but can support database functions. My Question is how can we invoke those database functions using querydsl?
type: Question
has answer: http://stackoverflow.com/a/22988168
accepted answer: http://stackoverflow.com/a/22988168
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/35183417
has text: First you need a parser. Then you need to store the results of the parser. Look up 'dependency parsing' or PCFG's or whatever appeals. This is a complex task, it's not a 'java nlp' project, it's an 'nlp project', and ngrams won't do it.
score: 1
comment on: http://stackoverflow.com/q/23030234
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23129354
score: 2
upvote count: 3
downvote count: 1
has body: The append(String appended, int n) method belongs to Appender, not StringBuilder so you have to return it, instead of the sb public class HelloWorld{ public static void main(String []args){ System.out.println("Hello World"); Appender ap = new Appender("Ala"); ap.append(" ma kota", 3).append( " i psa", 2); System.out.println(ap); ap.append(" ojej", 3); System.out.println(ap); } public static class Appender { private StringBuffer sb; public Appender(){ sb = new StringBuffer(); } public Appender(String s){ sb = new StringBuffer(s); } public Appender append(String str, int n) { while(n &gt; 0){ sb.append(str); n--; } return this; } public String toString(){ return sb.toString(); } } }
answers question: http://stackoverflow.com/q/23129235
type: Answer

http://stackoverflow.com/q/22997843
has comment: http://stackoverflow.com/comment/35125628
has answer: http://stackoverflow.com/a/56683045
answer count: 3
has title: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
favorite count: 0
has comment: http://stackoverflow.com/comment/35126295
has comment: http://stackoverflow.com/comment/35125173
has comment: http://stackoverflow.com/comment/35126906
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/46140169
has comment: http://stackoverflow.com/comment/35126340
has answer: http://stackoverflow.com/a/31627004
tagged with: java
tagged with: tomcat7
has body: When trying to start tomcat I get this error. What could be the cause of this? I've read through a bunch of similar posts and I can't seem to find anything that's a help. I'm not missing a .jar file as far as I can tell. SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:188) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:799) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 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: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) ... 6 more Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getClassLoader()Ljava/lang/ClassLoader; at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:90) at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1543) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1265) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:873) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.jav…
downvote count: 1
type: Question
score: 3
tagged with: eclipse
upvote count: 4

http://stackoverflow.com/comment/35178573
score: 0
comment on: http://stackoverflow.com/q/22996895
has text: @Red Alert :Nop, that is not how it works. M = [0 1 4 2 7 9 3 8], A[0 4 7 3],B[1 2 9 8]. It divides it like that. Look at the code at first for loop. It works like this i == 1 Copy M[0] to A[0]. i++; i == 2 Copy M[1] to B[0] i++;
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23018862
tagged with: eclipse
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23019156
has comment: http://stackoverflow.com/comment/35163276
tagged with: maven
has answer: http://stackoverflow.com/a/23019156
has title: getting an error in eclipse
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35173626
has body: Whenever I try to run my project, it runs perfectly but in the error pane it shows some kind of error. I am using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! For now I have added the below lines into pom.xml as its a maven project - &lt;properties&gt; &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt; &lt;project.reporting.outputencoding&gt;UTF-8&lt;/project.reporting.outputencoding&gt; &lt;/properties&gt; But the problem is still there, adding sorceEncoding and reporting outputencoding into pom.xml did not resolves the problem. What is the problem? Here is a screenshot of the error: Update Error resolved after a soft restart but another error appears - Internal browser is not available: No more handles [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)] its something related to the browser and even my dashboard is prompting this.How can i resolve this?
tagged with: java

http://stackoverflow.com/q/23090405
has answer: http://stackoverflow.com/a/23090886
type: Question
has title: How jsf or any framework creates beans using annotation?
linked to: http://stackoverflow.com/q/2215843
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/4296910
type: UnansweredQuestion
has body: How jsf or any framework creates beans using annotation? Like jsf when we are using @ViewScoped, it's creating bean for every view or @RequestScoped creats bean for every request, how exactly it works internally?
score: 3
tagged with: jsf
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/35181172
type: AnswerComment
has text: @mok Most of the built-in subclasses of `Exception` don't have any fields of their own, and don't override `hashCode` or `equals`.
type: Comment
comment on: http://stackoverflow.com/a/23028778
score: 0

http://stackoverflow.com/q/23062340
has body: I'm having some bother with JDBC and the creation of a log in page. I have a button called btnLogIn and 2 text fields, one called UsernameField, and the other called PasswordField(which is an actual password field). What I'm trying to achieve is, when the user enters information into the fields, the database searches the the database I have set up, then 'logs in' by displaying an appropriate welcome message or error message. What am I doing wrong? I am very very lost. My code is below. btnLogIn.addActionListener(new ActionListener() { @SuppressWarnings({ "deprecation" }) public void actionPerformed(ActionEvent arg0) { // creating connection and query variables Connection conn = null; ResultSet rs = null; PreparedStatement pst = null; String url = "jdbc:mysql://MY.DB.URL/*******"; //load the driver try { Class.forName("com.mysql.jdbc.Driver"); // making connection conn = DriverManager.getConnection(url, "*******", "*******"); // query String sql = "select * from log_in where username = ? and pssword = ?"; pst = conn.prepareStatement(sql); pst.setString(1, UsernameField.getText()); pst.setString(2, PasswordField.getText()); rs = pst.executeQuery(sql); if(rs.next()){ //Retrieve by column name String username = rs.getString("username"); System.out.println("Username : " + username); String password = rs.getString("pssword"); System.out.println("Password : " + password); lblLog_In.setText("Welcome."); } else { lblLog_In.setText("ERROR: invalid log in information."); } } catch (SQLException e) { System.out.println("SQL Exception."); } catch (ClassNotFoundException e) { System.out.println("Class not found exception."); } } });
has comment: http://stackoverflow.com/comment/35241934
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35242377
has comment: http://stackoverflow.com/comment/35245836
has title: Log-In page - Java Swing
answer count: 0
has comment: http://stackoverflow.com/comment/35243962
tagged with: mysql
tagged with: authentication
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/35243228
tagged with: java
has comment: http://stackoverflow.com/comment/35241998
has comment: http://stackoverflow.com/comment/35245518
score: 0

http://stackoverflow.com/q/23080102
has body: I want to use values inside properties file directly inside my jsp. I am using tiles and tried following things to make it work. WEB-INF/text/guide.properties <entry key="GuidedTut" value-ref="GuideProperties" /> and i tried to access in jsp as follow ${GuidedTut.guide.welcome.firstline} project runs well but i cant see properties file value in jsp.
tagged with: spring
answer count: 1
has title: cant access properties file value in tiles spring mvc
tagged with: spring-mvc
tagged with: java
tagged with: jsp
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23088534
type: Question
has comment: http://stackoverflow.com/comment/35274869
score: 0

http://stackoverflow.com/comment/35139343
comment on: http://stackoverflow.com/a/23005940
score: 0
type: AnswerComment
has text: @user3504731 `isDraw` is a `void` method, so it has no return value - a simple `return;` will exit the method.
type: Comment

http://stackoverflow.com/comment/35177672
score: 0
has text: Seriously, did you *really* need to include a 5+ page XML example?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23005896

http://stackoverflow.com/comment/35178698
score: 1
comment on: http://stackoverflow.com/a/23027150
has text: That works and makes great sense because i have to check for the right tool anyway. So win win, thanks :)
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35175428
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23008504
has text: Thanks for suggestion. Can you provide an example how would I solve my question basis on the suggestion you gave which is using `Interceptor`? Actually I am slightly new to this so if you can provide an example then it will be of great help.
score: 0

http://stackoverflow.com/q/23013141
tagged with: java
tagged with: jboss
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/35152366
downvote count: 0
has comment: http://stackoverflow.com/comment/35152684
answer count: 1
tagged with: jax-rs
has body: I'm having some trouble with my REST API service on my JBOSS 7.1.1 server. Right now I use a RESTEasy implementation and I have the following filter to add CORS headers to the response: @WebFilter(filterName = "HeaderFilter", urlPatterns = {"/*"}) public class HeaderFilter implements Filter { public void init(FilterConfig arg0) throws ServletException{} public void destroy(){} public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { //Just continue the request filterChain.doFilter(request, response); //After the request add the response headers HttpServletResponse responseObj = (HttpServletResponse)response; responseObj.addHeader("Access-Control-Allow-Origin", "*"); responseObj.addHeader("Access-Control-Allow-Methods", "GET,POST,PUT,DELETE,OPTIONS"); responseObj.addHeader("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, Content-Length"); } } My problem is that the server sometimes chooses to send the response in parts. Via the Transfer-Encoding: chunked "protocol". This doesn't matter and I have no problem with that but it doesn't add the CORS headers anymore when it does this. The client side of the application is now unable to use the data and I cannot figure out how to add the CORS headers to the final response. Do you guys know how I could fix this issue? EDIT: I'm using Jackson to turn my lazy loaded model into JSON by the way, so I don't think it's as easy as just setting the Content-Length.
favorite count: 0
tagged with: resteasy
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/67579286
has comment: http://stackoverflow.com/comment/95246324
has title: JAX-RS add headers to chunked response
score: 2

http://stackoverflow.com/q/22969652
downvote count: 0
answer count: 1
tagged with: google-contacts-api
favorite count: 0
has title: Retrieve Google Delegated Contacts
has answer: http://stackoverflow.com/a/22977624
has body: I am trying to get the delegated contacts from another user of Google. I managed to get the contacts and groups from a user. However, I am not able to get the contacts delegated to me by another user with the API. I need help, thanks.
type: UnansweredQuestion
tagged with: google-app-engine
upvote count: 1
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/35142977
type: QuestionComment
has text: @Bharanikumar But your question is basically the same; however you should ask yourself if you really should connect directly from an Android tablet/phone to MySQL directly.
comment on: http://stackoverflow.com/q/23006999
score: 0
type: Comment

http://stackoverflow.com/comment/35359122
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23109443
score: 0
has text: I was already using control characters for printing to lpt without any problem. And i used same for usb, i think the problem is not with characters.

http://stackoverflow.com/comment/35540990
has text: Hi Angelo, did you get time to look into this? I still looking into that but don't know why its not working. I tried to print ModelAndView and getting this 'modelandview reference to view with name 'login': model is null'
comment on: http://stackoverflow.com/a/23117955
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23058043
answers question: http://stackoverflow.com/q/23057761
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23057761
has comment: http://stackoverflow.com/comment/35233554
has comment: http://stackoverflow.com/comment/35233666
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35233897
type: Answer
has body: There's 101 examples online. I Googled "java parse csv" and this was the #1 result: http://www.mkyong.com/java/how-to-read-and-parse-csv-file-in-java/ That uses a String as a separator, however this is code rather than an API. Given that parsing a CSV file is a pretty simple process, I don't think it's a good example of a situation requiring a library and - especially with a slightly unique requirement like you have with the strange \t\t separator - it is probably better to just code it anyway.

http://stackoverflow.com/comment/35199068
type: Comment
score: 1
has text: Can you show the code that starts the `AwesomeRunnable`?
comment on: http://stackoverflow.com/q/23038682
type: QuestionComment

http://stackoverflow.com/a/22969640
has body: The error java.lang.noclassdeffounderror appears when your installer doesn't find some dependencies in your project. E.g. In eclipse you need to enable check on "Android private libraries" and "Android Dependencies" in Build Path if you want to package extras libs into APK I don't use IntelliJ but in this link talk about it java.lang.noclassdeffounderror: com.google.android.gms.R$styleable
score: 0
answers question: http://stackoverflow.com/q/22968979
type: Answer

http://stackoverflow.com/comment/35249058
comment on: http://stackoverflow.com/q/23064982
score: 0
type: Comment
type: QuestionComment
has text: Hi, I dont think it is a problem with code.

http://stackoverflow.com/comment/35215514
score: 0
type: Comment
has text: I am very new to JSON, how would I create an arrayadapter
type: QuestionComment
comment on: http://stackoverflow.com/q/23047825

http://stackoverflow.com/comment/35193732
comment on: http://stackoverflow.com/q/23035746
type: QuestionComment
has text: There is no point in doing an ids if there is no goal to reach
type: Comment
score: 2

fibonacci
tags question: http://stackoverflow.com/q/23072597
tag name: fibonacci
tags question: http://stackoverflow.com/q/23073822
type: Tag

http://stackoverflow.com/a/28144581
score: 4
type: Answer
has body: If you call the following code on a request; String bodyText = request().body().asText(); bodyText will be null if the Content-Type header is application/json There isn't a way using the provided controller APIs to just get JSON text if the Content-Type header is application/json without first converting to a JsonNode So the best way to do this if the application/json is your Content-Type header is String bodyText = request().body().asJSON().toString(); This is a fail on play framework's part, because they should just have a method to get the request body as a String no matter what the Content-Type header is.
answers question: http://stackoverflow.com/q/23034837
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/35250440
type: Comment
has text: As I understand in Your example there is a situation where You access fields from Child Controller (PersonEditorController class) in Root controller (MainController class). In my case there is different situation, because I want access fields from Controller that has no relation with this second Controller (they are both children of another fxml - there is no fx:include between them)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23049538

http://stackoverflow.com/q/23128063
has body: I have a label in my JFrame. It's variable name is l_1001. I want to get this variable name in output. How can I do it? I tried System.out.print(l_1001.getName()) But output rotates null.
tagged with: get
score: 0
has comment: http://stackoverflow.com/comment/35359159
answer count: 1
linked to: http://stackoverflow.com/q/744226
has comment: http://stackoverflow.com/comment/35359174
tagged with: jlabel
has title: Getting the name of JLabel
has answer: http://stackoverflow.com/a/23128102
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
tagged with: java
type: Question

http://stackoverflow.com/q/23033385
accepted answer: http://stackoverflow.com/a/23041201
upvote count: 3
tagged with: java
tagged with: android-videoview
type: Question
tagged with: vitamio
has title: Vitamio VideView crashes
has body: I'm trying to play stream video in my app using Vitamio VideoView. I've downloaded vitamio demo app and it worked fine with my url. But when I'm trying to use it in my app it crashes after "mVideoView.setVideoURI(Uri.parse(path));" public void play () { LinearLayout VideoView = (LinearLayout) findViewById(R.id.videoview); VideoView.setVisibility(View.VISIBLE); String path = "here is my url"; mVideoView = (VideoView) findViewById(R.id.surface_view1); mVideoView.setVideoURI(Uri.parse(path)); MediaController mediaController = new MediaController(this); mVideoView.setMediaController(mediaController); mVideoView.requestFocus(); mVideoView.start(); mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mediaPlayer) { // optional need Vitamio 4.0 //mediaPlayer.setPlaybackSpeed(1.0f); } }); } This is layout for my videoview in main.xml: &lt;LinearLayout android:id="@+id/videoview" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFFFFF" android:visibility="gone"&gt; &lt;io.vov.vitamio.widget.CenterLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;io.vov.vitamio.widget.VideoView android:id="@+id/surface_view1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerHorizontal="true" android:layout_centerVertical="true" /&gt; &lt;/io.vov.vitamio.widget.CenterLayout&gt; LogCat shows: 04-12 20:00:00.241: E/Vitamio(16177): Error loading libs 04-12 20:00:00.241: E/Vitamio(16177): java.lang.UnsatisfiedLinkError: Cannot load library: load_library(linker.cpp:771): library "nulllibstlport_shared.so" not found 04-12 20:00:00.241: E/Vitamio(16177): at java.lang.Runtime.load(Runtime.java:340) 04-12 20:00:00.241: E/Vitamio(16177): at java.lang.System.load(System.java:507) 04-12 20:00:00.241: E/Vitamio(16177): at io.vov.vitamio.MediaPlayer.&lt;init&…
downvote count: 0
has comment: http://stackoverflow.com/comment/35189564
score: 3
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/23041201
has comment: http://stackoverflow.com/comment/35189546
favorite count: 0
has comment: http://stackoverflow.com/comment/35189240
has comment: http://stackoverflow.com/comment/35189189
type: AnsweredQuestion

http://stackoverflow.com/a/23015821
type: Answer
has body: A simple solution: Utilities.java /** * @return true if keyEvent is consumed */ public static boolean onKeyDown(final Activity activity, final Class&lt;?&gt; action, String message, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK &amp;&amp; event.getRepeatCount() == 0) { //...all you code here return true; } return false; } Login.java @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(Utilities.onKeyDown(this, null, "Do you want to exit the application", keyCode, event)){ return true; } return super.onKeyDown(keyCode, event); }
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23015520
has comment: http://stackoverflow.com/comment/35156860
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23015520
has comment: http://stackoverflow.com/comment/35157459

http://stackoverflow.com/comment/35411680
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23032697
has text: So why did you delete your last question (http://stackoverflow.com/questions/23157384/how-to-add-more-than-2-cols-on-jlist/23157438#23157384) after I gave you the answer. Should you not accept the answer after the time I spend to point you in the right direction?

http://stackoverflow.com/q/23020722
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23021048
has comment: http://stackoverflow.com/comment/35166528
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/35166374
tagged with: java
upvote count: 1
tagged with: swing
tagged with: bufferedimage
type: Question
has title: Drawing a polygon with mouse clicks not working?
tagged with: graphics
has answer: http://stackoverflow.com/a/23021048
has comment: http://stackoverflow.com/comment/35166599
has body: Im trying to draw any shape with mouse clicks..but the frame is just displaying a white background... I have to use buffered image because this is only part of an assignment...otherwise it was working... can someone help me with this? please... import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Rectangle; import java.awt.Component.*; import java.awt.Point; import java.awt.Shape; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.geom.Ellipse2D; import java.awt.geom.Line2D; import java.awt.geom.Path2D; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; import java.awt.event.InputEvent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class DrawPolygon extends JFrame{ static int X, Y; private static BufferedImage bI = new BufferedImage(500,500, BufferedImage.TYPE_INT_RGB); public static void main(String[] args) { new DrawPolygon(); } public DrawPolygon() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { } catch (InstantiationException ex) { } catch (IllegalAccessException ex) { } catch (UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new PolyPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public static class PolyPane extends JPanel { private MouseHandler mouseHandler; private Path2D currentShape; private List&lt;Path2D&gt; lstPloys; private Point lastPoint; private Point currentPoint; private Image img; private boolean initialize = true; public PolyPane() { l…
downvote count: 0

http://stackoverflow.com/q/22997678
has comment: http://stackoverflow.com/comment/35124449
downvote count: 1
has title: Adding Raise to Salary
type: Question
score: 0
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/22997747
has body: I got the program running the way I want it.I am trying to make the program adds 2% raise to every employee's salary. My issue is that the program's output does not display the 2% raise. Here is the output I get when I run the program.. Enter social security number:12345678 Enter salary2000 Please input next security numbers or -1 to quit:12345677 Enter salary3000 Please input next security numbers or -1 to quit:-1 Social Security Number Salaries Salary After Raise 12345678 2000.000000 0.000000 12345677 3000.000000 0.000000 The code.. import java.util.Scanner; public class Salaries { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner (System.in); //Declaring variables int[] ssNumbers = new int [10]; double[] salaries = new double [10]; double[] nSalaries = new double [10]; int c; c = inputData (ssNumbers, salaries); //calling input data method raise (salaries, c); // calling raise method output (ssNumbers, salaries, nSalaries); //calling output method } public static int inputData (int[]ssn, double[]sals){ // input method int c = 0; Scanner input = new Scanner (System.in); int ssNum; System.out.print("Enter social security number:"); ssNum = input.nextInt(); while (ssNum != -1) //using while loop. { ssn[c] = ssNum; System.out.print("Enter salary"); sals[c] = input.nextDouble(); //prompting user for input c++; System.out.print("Please input next security numbers or -1 to quit:"); ssNum = input.nextInt(); //prompting user for input } return c; } public static void raise (double[] salaries, int c) // raise method { double[] salaryraise = new double [10]; for (int i = 0; i &lt; c; i++ ) salaryraise[i] = salaries[i]*.02; } public static void output (int[] ssNumbers, double[] salaries, double[] salaryraise ) //output method { System.out.printf("%30s %30s %30s\n", "Social Security Number", "Salaries", "Salary After Raise"); for (int i = 0; i &lt; salaries.length; i++) //output System.out.printf("%30d %30f %30f\n", ssNumb…
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22997752
has comment: http://stackoverflow.com/comment/35124260
has comment: http://stackoverflow.com/comment/35124297
tagged with: java

http://stackoverflow.com/a/49207551
downvote count: 0
has body: Can I do it dynamically? Create view class: public class View { static class Public { } static class ExtendedPublic extends Public { } static class Internal extends ExtendedPublic { } } Annotate you model @Document public class User { @Id @JsonView(View.Public.class) private String id; @JsonView(View.Internal.class) private String email; @JsonView(View.Public.class) private String name; @JsonView(View.Public.class) private Instant createdAt = Instant.now(); // getters/setters } Specify the view class in your controller @RequestMapping("/user/{email}") public class UserController { private final UserRepository userRepository; @Autowired UserController(UserRepository userRepository) { this.userRepository = userRepository; } @RequestMapping(method = RequestMethod.GET) @JsonView(View.Internal.class) public @ResponseBody Optional<User> get(@PathVariable String email) { return userRepository.findByEmail(email); } } Data example: {"id":"5aa2496df863482dc4da2067","name":"test","createdAt":"2018-03-10T09:35:31.050353800Z"} UPD: keep in mind that it's not best practice to use entity in response. Better use different DTO for each case and fill them using modelmapper
has comment: http://stackoverflow.com/comment/128359782
answers question: http://stackoverflow.com/q/23101260
has comment: http://stackoverflow.com/comment/100711403
upvote count: 56
has comment: http://stackoverflow.com/comment/126242411
type: Answer
score: 56

http://stackoverflow.com/q/23072754
score: 0
has comment: http://stackoverflow.com/comment/35262489
tagged with: java
has title: Java Swing Timer Not Clear
has comment: http://stackoverflow.com/comment/35262693
tagged with: sleep
has comment: http://stackoverflow.com/comment/35262290
accepted answer: http://stackoverflow.com/a/23072847
has comment: http://stackoverflow.com/comment/35262347
has body: I have been having some problems with using the Timer function of Java swing. I am fairly new to programming with Java, so any help is greatly appreciated. I have looked over many other Timer questions on this site but none of them have answered my question. I have made a GUI that allows you to play rock paper scissors, where you can choose from clicking three buttons. I want my program to sleep for around 1 second after you click the button, and again after it displays a message. After I realized Thread.sleep() wouldn't work for my GUI, I tried to implement a timer. import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.Border; import java.io.*; public class rps { //ROCK PAPER SCISSORS static JLabel middle = new JLabel(); static JLabel them = new JLabel(); static JLabel yourWins = new JLabel(); static JLabel theirWins = new JLabel(); static JPanel yourPanel = new JPanel(); static JPanel middlePanel = new JPanel(); static JLabel blank1 = new JLabel(); static JLabel blank2 = new JLabel(); static JButton rock = new JButton("Rock"); static JButton paper = new JButton("Paper"); static JButton scissors = new JButton("Scissors"); static int yw = 0; static int tw = 0; static ButtonHandler listener = new ButtonHandler(); public static void main(String[] args) { //Create the frame JFrame frame = new JFrame("Rock Paper Scissors"); frame.setSize(500, 500); //Setting the size of the frame middle.setFont(new Font("Serif", Font.PLAIN, 30)); middle.setHorizontalAlignment(SwingConstants.CENTER); them.setFont(new Font("Serif", Font.PLAIN, 15)); them.setHorizontalAlignment(SwingConstants.CENTER); yourWins.setHorizontalAlignment(SwingConstants.CENTER); theirWins.setHorizontalAlignment(SwingConstants.CENTER); //Creating panels JPanel bigPanel = new JPanel(); Border border = BorderFactory.createLineBorder(Color.BLACK, 1); Border wlb = BorderFactory.createLineBorder(Color.RED, 1); them.setBorder(border); yourPanel.setBorder(border); bigPanel.setBorder…
linked to: http://stackoverflow.com/q/23073741
has comment: http://stackoverflow.com/comment/35262421
has comment: http://stackoverflow.com/comment/35262398
has comment: http://stackoverflow.com/comment/35261677
has answer: http://stackoverflow.com/a/23072847
has comment: http://stackoverflow.com/comment/35262585
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35262445
possible better answer: http://stackoverflow.com/a/29970086
tagged with: timer
has comment: http://stackoverflow.com/comment/35262038
has comment: http://stackoverflow.com/comment/35262240
type: Question
has answer: http://stackoverflow.com/a/29970086
answer count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/35262784
has comment: http://stackoverflow.com/comment/35262635

http://stackoverflow.com/a/22998408
type: Answer
has body: This now copies the file contents. This implementation works perfectly on the example set below (you can literally copy and paste this into a java file and it will compile and do what you want). The only potential drawbacks are that it will skip 'versions' in between. So if it has A1.txt and A3.txt, it will only create A4.txt. It also cannot handle files without extensions, but I don't think that would matter much to you anyway. It prints "Failure" if the file already exists or it otherwise fails in creating the file for some reason. Note that you can specify the file directory on the command line or else it will use the current working directory. It also recursively searches folders below, if you only want it to search the current/specified file directory, simple remove the else statement right before the return fileMap; in the getFilesForFolder method. Before: ~/currentdirectory A1.txt A4.txt B1.txt ~/currentdirectory/asdf A1.txt B1.txt B5.txt After: ~/currentdirectory A1.txt A4.txt A5.txt B1.txt B2.txt ~/currentdirectory/asdf A1.txt A2.txt B1.txt B5.txt B6.txt import java.io.File; import java.io.IOException; import java.io.BufferedWriter; import java.io.FileWriter; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.Map; import java.util.HashMap; import java.io.InputStream; import java.io.OutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; public class Files { static File folder; static List&lt;String&gt; files; public static void main(String[] args) { if (args.length &gt; 0) folder = new File(args[0]); else folder = new File(System.getProperty("user.dir") + "/testfiles"); Map&lt;File, Map&lt;String, Integer&gt;&gt; files = new HashMap&lt;File, Map&lt;String, Integer&gt;&gt;(); files = getFilesForFolder(folder); writeFile(files); } public static void writeFile(Map&lt;File, Map&lt;String, Integer&gt;&gt; files) { String fileName; for (Map.Entry&lt;File, Map&l…
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22994140
downvote count: 0

http://stackoverflow.com/comment/35161507
comment on: http://stackoverflow.com/a/23018034
type: AnswerComment
has text: @EmilH It should, if you provide an anonymous implementation of Inner to `test`.
type: Comment
score: 0

http://stackoverflow.com/comment/35096642
comment on: http://stackoverflow.com/q/22982734
type: Comment
type: QuestionComment
has text: What errors ? What code ? How to know where the error is ?
score: 1

http://stackoverflow.com/a/23041485
has body: You should replace this : if(price&lt;max) min=price; by if(price&lt;min) min=price;
accepted answer of: http://stackoverflow.com/q/23041468
has comment: http://stackoverflow.com/comment/35203283
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35203725
has comment: http://stackoverflow.com/comment/35203534
has comment: http://stackoverflow.com/comment/35203516
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35203700
has comment: http://stackoverflow.com/comment/35203744
answers question: http://stackoverflow.com/q/23041468
has comment: http://stackoverflow.com/comment/35203487

http://stackoverflow.com/comment/35285052
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23086119
has text: @reporter "I want to pass a list of values, how do I send many values?" That said, passing a list *IS* passing one parameter/attributes, a list. There is no way this question can be misinterpreted.

http://stackoverflow.com/comment/35288479
score: 0
type: Comment
type: QuestionComment
has text: I found a similar solution to the string operations I mentioned at http://stackoverflow.com/questions/19445528/parsing-of-stackoverflows-posts-xml-on-hadoop/19591736#19591736 but it is simply ineffective or not re-usable if I want to extract all fields of above format.
comment on: http://stackoverflow.com/q/23088320

http://stackoverflow.com/q/23024388
tagged with: arrays
has title: Copying and printing arrays?
favorite count: 0
linked to: http://stackoverflow.com/q/4479683
accepted answer: http://stackoverflow.com/a/23024457
duplicate of: http://stackoverflow.com/q/4479683
type: AnsweredQuestion
score: -3
possible better answer: http://stackoverflow.com/a/23024544
type: Question
has answer: http://stackoverflow.com/a/23024544
linked to: http://stackoverflow.com/q/1230842
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/23024457
linked to: http://stackoverflow.com/q/409784
duplicate of: http://stackoverflow.com/q/1230842
answer count: 2
upvote count: 0
has body: Whenever I try to print the elements I copied from array stonefist to array vaporeon I get This new array: [I@175705e Is this a problem on my end or is this a problem with my version of java? public class ArrayTest { public static void main(String[] args) { int[] stonefist = new int[6]; int[] vaporeon = new int[stonefist.length]; stonefist[0] = 34; stonefist[1] = 2; stonefist[2] = 14; stonefist[3] = 34; stonefist[4] = 58; stonefist[5] = 4; int jolteon = 0; int flareon = 0; int dragonite = Integer.MIN_VALUE; for(int i = 0; i &lt; stonefist.length; i++) { System.out.println(stonefist[i]); if(stonefist[i] &gt; dragonite) { dragonite = stonefist[i]; } jolteon = jolteon + stonefist[i]; flareon = jolteon/stonefist.length; System.arraycopy(stonefist,1,vaporeon,0,3); } System.out.println("The largest number is: " + dragonite); System.out.println("The average is: " + flareon); System.out.print("This new array: " + vaporeon); } }

http://stackoverflow.com/a/23084641
answers question: http://stackoverflow.com/q/23084575
type: Answer
has comment: http://stackoverflow.com/comment/35281415
has body: Use .+, it means any character having one or unlimited lengths. It will ensure to avoid the inputs like only .txt matches(".+[.]txt") FYI: [.] simply matches with the dot character.
has comment: http://stackoverflow.com/comment/35281239
score: 0
has comment: http://stackoverflow.com/comment/35281358
has comment: http://stackoverflow.com/comment/35281314

http://stackoverflow.com/q/23069672
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: android-dialer
answer count: 1
has title: HTC Dialer removes letters from phone number
has answer: http://stackoverflow.com/a/23071582
accepted answer: http://stackoverflow.com/a/23071582
downvote count: 0
favorite count: 0
has body: I'm having a problem specifically with HTC Sense's Phone Dialer removing any letters from a phone number passed to it. I'm using this code to start the Phone intent and it works on Stock Android. I don't have a Samsung with TouchWiz to test with so it's possible that this is also a problem there. public void callPhoneNumber(Context context, String number) { ... //Number will be something like "123-456-TEST" number = "tel:" + number; context.startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse(number))); ... } On stock Android if I have a number like "123-456-TEST", it will be interpreted correctly as "123-456-8378" whereas with HTC Sense it will end up with "123-456" in the dialer. If they are all numbers both work just fine. Is there anyway besides writing my own phone number parser to pass the number correctly to the HTC intent? Thanks in advance.
tagged with: android
upvote count: 1
tagged with: android-intent

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/23100725
type: Tag

http://stackoverflow.com/a/53236546
has body: &lt;% String dateStr = request.getParameter("datedebut"); java.text.SimpleDateFormat oldFormater = new SimpleDateFormat("dd-mm-yyyy"); java.util.Date resultInDate = oldFormater.parse(dateStr); java.text.SimpleDateFormat newFormater = new SimpleDateFormat("dd-mm-yyyy"); String resultInString = newFormater.format(resultInDate); out.println(resultInDate); // Wed Apr 02 00:00:00 WET 2014 out.println(resultInString); // 02-04-2014 /* convert String resultInString into java.sql.Date resultInDateSql */ java.sql.Date resultInDateSql = java.sql.Date.valueOf(resultInString); /* set in query sql */ preparedStatement.setDate(1, resultInDateSql); %&gt;
answers question: http://stackoverflow.com/q/22983392
type: Answer
score: 0

http://stackoverflow.com/comment/35295052
type: AnswerComment
has text: Smart! I seriously doubted this before trying it.
type: Comment
comment on: http://stackoverflow.com/a/23091761
score: 1

http://stackoverflow.com/comment/35215045
has text: @user3482560: the best way to get quick useful answers is to ask succinct smart questions. That's one other reason why I advise you not to ask mega-questions but rather focused questions that deal with issues in one class. You will get help if your questions are well presented.
type: Comment
comment on: http://stackoverflow.com/a/23046409
type: AnswerComment
score: 0

http://stackoverflow.com/q/23016274
answer count: 0
has comment: http://stackoverflow.com/comment/35194434
upvote count: 3
tagged with: java
tagged with: file
downvote count: 1
has comment: http://stackoverflow.com/comment/35158819
type: Question
has comment: http://stackoverflow.com/comment/35158249
has comment: http://stackoverflow.com/comment/35158149
has title: NoSuchElementException when creating object from txt file
has comment: http://stackoverflow.com/comment/35158075
linked to: http://stackoverflow.com/q/190629
has comment: http://stackoverflow.com/comment/35157861
has body: I have txt file which looks like this and i want to transform it to object and then fill sqlite db with it. When I'm trying to parse data, strange error has place. [Dokument] DataWyst=14.01.15 SymbolKontrahenta=KUMA [ZawartoscDokumentu] [Poz1] Nazwa=MML Symbol=5902317000160 CenaNetto=169 SymbolDostawcy= 69 659 [Poz2] Nazwa=ŚMT Symbol=5902317100433 CenaNetto=1430 SymbolDostawcy= 54 568 [Poz3] Nazwa=tka Symbol=1204 CenaNetto=1008 SymbolDostawcy= 7 78 [Dokument] DataWyst=14.01.15 SymbolKontrahenta=EA [ZawartoscDokumentu] [Poz1] Nazwa=dag Symbol=5900643030141 CenaNetto=358 SymbolDostawcy= [Poz2] Nazwa=DANS Symbol=59026990 CenaNetto=234 SymbolDostawcy= 4 18 I'm trying to parse this text to objects in that way: int i_liczba_dokumentow = liczba_dokumentow.size(); Dokument[] l_dok = new Dokument[i_liczba_dokumentow]; System.out.println(i_liczba_dokumentow); try { Scanner s = new Scanner(new File("D:\\Temp.txt")); for (int i = 0; i &lt; l_dok.length; i++) { while (s.hasNextLine()) { if (s.next() == "[Dokument]") { l_dok[i] = new Dokument(); String line = s.nextLine(); if (line == "DataWyst=") { String[] si = line.split("\\="); l_dok[i].DataWyst = si[1]; } if (s.next() == "SymbolKontrahenta=") { String line2 = s.nextLine(); String[] si = line2.split("\\="); l_dok[i].SymbolKontrahenta = si[1]; } while (s.hasNextLine()) { if (s.next() == "[Poz") { l_dok[i].Elementy.add(new Element()); } if (s.next() == "Nazwa=") { String line2 = s.nextLine(); String[] si = line2.split("\\="); l_dok[i].Elementy.get(i).Nazwa = si[1]; } if (s.next() == "Symbol=") { String line2 = s.nextLine(); String[] si = line2.split("\\="); l_dok[i].Elementy.get(i).Symbol = si[1]; } if (s.next() == "CenaNetto=") { String line2 = s.nextLine(); String[] si = line2.split("\\="); l_dok[i].Elementy.get(i).CenaNetto = si[1]; } if (s.next() == "SymbolDostawcy=") { String line2 = s.nextLine(); String[] si = line2.split("\\="); l_dok[i].Elementy.get(i).SymbolDostawcy = si[1]; } } } } s.close(); } } catch (FileNotFoundEx…
favorite count: 0
type: UnansweredQuestion
tagged with: io
score: 2

http://stackoverflow.com/a/23051661
answers question: http://stackoverflow.com/q/23051522
score: 0
type: Answer
has body: Path getFileName() returns Path Object , so whenever we print object ,its toString() method will be called which is inherited from Object class. so Path's toString() method is called and it returns path object in string form. so do something like path.getFileName().getName(); to get the name if there is such method.

http://stackoverflow.com/q/23040238
has comment: http://stackoverflow.com/comment/35201724
has comment: http://stackoverflow.com/comment/35201378
has comment: http://stackoverflow.com/comment/35201359
has comment: http://stackoverflow.com/comment/35201504
has body: I am making a some large project. In that I am stuck at one place. I am using the following code to read from the file: String str = null; FileReader fr = new FileReader("H:\\Eclipse\\Emulator\\progin8085.txt"); BufferedReader br = new BufferedReader(fr); str = br.readLine(); //using it in a loop from 0 to total_no_of_lines Now I when I reached suppose at line 8(counting lines numbers while entering data to the file), I want to go back to line 3 or 4 or any and again want to read and execute each statement. How to read previous statements using BufferedReader only? If it is not possible, any other solution?
has comment: http://stackoverflow.com/comment/35201375
has comment: http://stackoverflow.com/comment/35201348
has answer: http://stackoverflow.com/a/23040261
answer count: 2
tagged with: file-io
has comment: http://stackoverflow.com/comment/35201400
has comment: http://stackoverflow.com/comment/35201434
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/23040329
has comment: http://stackoverflow.com/comment/35201438
has comment: http://stackoverflow.com/comment/35201433
favorite count: 0
has comment: http://stackoverflow.com/comment/35201511
has comment: http://stackoverflow.com/comment/35201480
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35201609
has comment: http://stackoverflow.com/comment/35201320
has comment: http://stackoverflow.com/comment/35201332
score: -1
has comment: http://stackoverflow.com/comment/35201477
has comment: http://stackoverflow.com/comment/35201349
tagged with: java
downvote count: 2
has title: How to read previous line by using bufferedReader
upvote count: 1
has comment: http://stackoverflow.com/comment/35201537
type: Question

http://stackoverflow.com/comment/35279147
score: 0
comment on: http://stackoverflow.com/q/23083124
type: QuestionComment
has text: @Duncan I have classes and source files. But I don't know what java file each class belongs to...
type: Comment

http://stackoverflow.com/comment/35320465
has text: In this moment, seems like I don't need the Custom AuthenticationProvider, but I will need in the future; because so, I am finding a solution where I can keep it.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23096350
score: 0

http://stackoverflow.com/comment/35096675
type: QuestionComment
comment on: http://stackoverflow.com/q/22982527
has text: It only fails if the `where` condition did not fetch any records.
score: 0
type: Comment

http://stackoverflow.com/q/23029707
has answer: http://stackoverflow.com/a/23034673
has title: Jackson polymorphic deserialization
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 4
type: Question
upvote count: 4
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23034673
tagged with: polymorphism
tagged with: jackson
favorite count: 0
has body: I've got the following problem with Jackson and type hierarchy. I'm serializing a class SubA which extends Base into a String, and trying afterwards to derserialize it back. Of course at compile time, the system does not know whether it will be Base or SubA so I'm expecting a Base and will do some other operations afterwards, if it is a SubA. My Base class looks like: @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @Type(value = SubA.class, name = "SubA") }) public class Base { protected String command; // +get +set protected String type; // +get +set } ... and a class deriving from Base: @JsonTypeName("SubA") public class SubA extends Base { private AnotherClass anotherClass; // +get +set private String test; // +get +set @JsonIgnore @Override public String getType() { return "SubA"; } } ... and I'm trying to execute the following code: ObjectMapper mapper = new ObjectMapper(); ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter(); Base payload = new SubA(); // + setting anotherClass as well as test variables String requestStringSend = ow.writeValueAsString(payload); System.out.println("Sending: " + requestStringSend); Base received = mapper.readValue(requestStringSend, Base.class); String requestStringReceived = ow.writeValueAsString(received); System.out.println("Received: " + requestStringReceived); The String requestStringSend is: Sending: { "command" : "myCommand", "type" : "SubA", "anotherClass" : { "data" : "someData" }, "test" : "test123" } But I'm keep getting the same error over and over again. The mapper does now know what to do with the anotherClass parameter - it does not exist in Base. But I thought the mapper will convert it into an SubA class? Exception in thread "main" org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "anotherClass" (Class com.test.Base), not marked as ignorable at [Source: java.io.StringReader@1256ea2; line: 4, column: 21] (throug…
has comment: http://stackoverflow.com/comment/35193865

http://stackoverflow.com/a/23065537
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35247596
downvote count: 0
has comment: http://stackoverflow.com/comment/35253175
accepted answer of: http://stackoverflow.com/q/23065508
type: Answer
answers question: http://stackoverflow.com/q/23065508
has comment: http://stackoverflow.com/comment/35247439
has body: for (int i = 0; i &lt;= myNodes.size(); i++) This causes the problem change it to for (int i = 0; i &lt; myNodes.size(); i++) Because, lets say myNodes.size() returns 8 and you are trying to reach dist[8] but dist[] array starts at 0 and ends at 7.
upvote count: 3
has comment: http://stackoverflow.com/comment/35248104
score: 3
has comment: http://stackoverflow.com/comment/35247670

http://stackoverflow.com/comment/35134419
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23003349
has text: @user3495562 On the left of the answer there are arrows and a checkmark. You check the checkmark to accept an answer and indicate that it answered your question to your satisfaction. You can upvote if it was good and/or helpful. You downvote if it was not useful or wrong.
type: AnswerComment

http://stackoverflow.com/q/23063442
score: 0
tagged with: java
type: Question
has title: Change jLabel Visibility
tagged with: jpanel
has body: I am new to Netbeans and Java and am having an issue with jLabels that are on jPanels. I have a jTabbedPane with a jPanel in it. I have a jLabel on the jPanel. I would like to set the visibility of the jLabel to false, but it does not seem to work. The label is still visible when I run the program. I do not understand why. Label label = new Label("jLabel1"); label.setVisible(false);
answer count: 1
has comment: http://stackoverflow.com/comment/35380678
has answer: http://stackoverflow.com/a/23070925
tagged with: netbeans
tagged with: jlabel
tagged with: jtabbedpane
has comment: http://stackoverflow.com/comment/35243552
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35243636

http://stackoverflow.com/q/23110894
has title: Double to string conversion error
type: AnsweredQuestion
has body: I was trying to convert variable of a double datatype to string and vice versa, but I encountered the errors generated by logcat. Please help me to find and correct the mistake. JavaCode: public class DataTypeConversion extends ActionBarActivity { TextView stringValue; TextView numericValue; double var; String text; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_data_type_conversion); stringValue = (TextView) findViewById(R.id.stringValue); numericValue = (TextView) findViewById(R.id.numericValue); stringValue.setText("0123.45"); var = Double.valueOf((String) stringValue.getText()); text = String.valueOf(var); XML: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.datatypeconversion.DataTypeConversion$PlaceholderFragment" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/stringValue"/&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/numericValue"/&gt; LOGCAT output: 04-16 09:17:20.715: D/AndroidRuntime(1056): Shutting down VM 04-16 09:17:20.715: W/dalvikvm(1056): threadid=1: thread exiting with uncaught exception (group=0x41465700) 04-16 09:17:20.735: E/AndroidRuntime(1056): FATAL EXCEPTION: main 04-16 09:17:20.735: E/AndroidRuntime(1056): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.datatypeconversion/com.example.datatypeconversion.DataTypeConversion}: java.lang.NullPointerException 04-16 09:17:20.735: E/AndroidRuntime(1056): at android.app.Acti…
has comment: http://stackoverflow.com/comment/35327893
downvote count: 2
possible better answer: http://stackoverflow.com/a/23111009
type: Question
score: -2
has answer: http://stackoverflow.com/a/23110993
tagged with: java
has comment: http://stackoverflow.com/comment/35327927
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35327710
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/35327944
favorite count: 0
has comment: http://stackoverflow.com/comment/35327930
accepted answer: http://stackoverflow.com/a/23110993
tagged with: android
has answer: http://stackoverflow.com/a/23111009

sms
tags question: http://stackoverflow.com/q/23069618
tag name: sms
type: Tag

http://stackoverflow.com/q/23112830
has answer: http://stackoverflow.com/a/23113367
favorite count: 0
has comment: http://stackoverflow.com/comment/35331583
has title: What do I return if there is no numerical solution for my int returning method to find?
has comment: http://stackoverflow.com/comment/35332148
tagged with: return
has comment: http://stackoverflow.com/comment/35331748
has comment: http://stackoverflow.com/comment/35331983
possible better answer: http://stackoverflow.com/a/23114395
answer count: 4
has answer: http://stackoverflow.com/a/23115107
has answer: http://stackoverflow.com/a/23114395
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23113630
tagged with: java
has body: This is my method for finding a single duplicate within an array. What should I return when an array has no duplicates? public int findDuplicate(int[] array) { Arrays.sort(array); int duplicate = 0; for(int i = 0; i &lt; array.length; i++) { if(array[i] == duplicate) { return duplicate; } duplicate = array[i]; } return ???; }
type: Question
has answer: http://stackoverflow.com/a/23113630
has comment: http://stackoverflow.com/comment/35331886
has comment: http://stackoverflow.com/comment/35331475
tagged with: int
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/35364861
comment on: http://stackoverflow.com/a/23123699
score: 0
type: AnswerComment
has text: Thanks for the answer. I was reading yesterday about `@Primay` and `@Named`, but I think that wouldn't solve the problem: Spring would just go for the implementation annotated with `@Primary`. Maybe my problem is not so clearly explained - I'm working now on a solution, I'll post it to make both question and answer clear if I find a clean solution.
type: Comment

http://stackoverflow.com/comment/35280465
comment on: http://stackoverflow.com/a/23084028
has text: The Context of RequestScoped Beans will destroyed after the Servlet request ends, the SessionScoped Beans Context lives until your Browsersession is up.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35194933
type: QuestionComment
comment on: http://stackoverflow.com/q/23036271
type: Comment
has text: What have you tried? Use a loop through the list, get int value and call put().
score: 0

http://stackoverflow.com/q/23101125
possible better answer: http://stackoverflow.com/a/23101890
has title: Simulation for the rolling of dice with the calculation of sums, frequencies and, percentages
has body: I am having trouble calculating out the frequency of the sum of the rolling of a pair of dice. I am told I have to use a one dimensional integer array to count the number of times each possible sum appears in 36000 rolls. I am unsure what I am supposed to do since we just started going over arrays. Here is a link to the instructions: http://s65.photobucket.com/user/jls7884/media/DicePic-page-001_zpsd45d977f.jpg.html?filters[user]=139936213&amp;filters[recent]=1&amp;sort=1&amp;o=0. Here is the code I have so far: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Dice; /** * * @author Jacob */ import java.util.Random; public class Dice { public static void count1 () { int count; int frequency[] = new int[7]; frequency[1] = 2; count = 1; while (count &lt;= 6) { frequency[count] = count + 1; count++; } System.out.printf ( "%-2d %-2d %-2d %-2d %-2d %-2d \n" , frequency [1] , frequency [2] , frequency [3] , frequency [4] , frequency [5] , frequency [6] ); } public static void count2 () { int count; int frequency[] = new int[8]; frequency[1] = 3; count = 1; while (count &lt;= 6) { frequency[count] = count + 2; count++; } System.out.printf ( "%-2d %-2d %-2d %-2d %-2d %-2d \n" , frequency [1] , frequency [2] , frequency [3] , frequency [4] , frequency [5] , frequency [6] ); } public static void count3 () { int count; int frequency[] = new int[7]; frequency[1] = 4; count = 1; while (count &lt;= 6) { frequency[count] = count + 3; count++; } System.out.printf ( "%-2d %-2d %-2d %-2d %-2d %-2d \n" , frequency [1] , frequency [2] , frequency [3] , frequency [4] , frequency [5] , frequency [6] ); } public static void count4 () { int count; int frequency[] = new int[7]; frequency[1] = 5; count = 1; while (count &lt;= 6) { frequency[count] = count + 4; count++; } System.out.printf ( "%-2d %-2d %-2d %-2d %-2d %-2d \n" , frequency [1] , frequency [2…
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23101245
accepted answer: http://stackoverflow.com/a/23101245
has answer: http://stackoverflow.com/a/23101890
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23124325
tagged with: java
type: Question
tagged with: dice
tagged with: arrays

http://stackoverflow.com/q/23097418
favorite count: 0
has answer: http://stackoverflow.com/a/23097448
score: 0
possible better answer: http://stackoverflow.com/a/23098190
has answer: http://stackoverflow.com/a/23098190
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/23097448
tagged with: tic-tac-toe
downvote count: 1
tagged with: jbutton
has body: however I am not sure where I am supposed to enter the whoWins() method. Do I enter this method in the actionperformed Method of the buttons or do i need to something different. Please help. public class TTT extends JFrame implements ActionListener { private JButton buttons[] = new JButton[9]; private JButton exitButton; public JLabel title; public JPanel titlePanel, panel; private int count = 0; int symbolCount = 0; private boolean win = false; public TTT() { title = new JLabel("Welcome to my Tic Tac Toe Game!"); titlePanel = new JPanel(); title.setFont(new Font(Font.SERIF, 0, 30)); titlePanel.add(title); this.add(titlePanel, BorderLayout.NORTH); panel = new JPanel(new GridLayout(3, 3)); for (int i = 0; i &lt; buttons.length; i++) { buttons[i] = new JButton(); panel.add(buttons[i]); buttons[i].setEnabled(true); buttons[i].addActionListener(this); } this.add(panel, BorderLayout.CENTER); JPanel panel1 = new JPanel(new FlowLayout(FlowLayout.CENTER)); exitButton = new JButton("Quit"); panel1.add(exitButton); this.add(panel1, BorderLayout.SOUTH); exitButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.exit(WIDTH); } }); } public void whoWins() { //Determines who wins using for the horizontal rows. if (buttons[0].getText() == buttons[1].getText() &amp;&amp; buttons[1].getText() == buttons[2].getText() &amp;&amp; buttons[0].getText() != "") { win = true; } else if (buttons[3].getText() == buttons[4].getText() &amp;&amp; buttons[4].getText() == buttons[5].getText() &amp;&amp; buttons[3].getText() != "") { win = true; } else if (buttons[6].getText() == buttons[7].getText() &amp;&amp; buttons[7].getText() == buttons[8].getText() &amp;&amp; buttons[6].getText() != "") { win = true; } //Determines the verticles wins else if (buttons[0].getText() == buttons[3].getText() &amp;&amp; buttons[3].getText() == buttons[6].getText() &amp;&amp; buttons[0].getText() != "") { win = true; } else if (buttons[1].getText() == buttons[4…
type: AnsweredQuestion
has title: Hello I am creating a TicTacToe game for myself to understand Java better
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35305306

http://stackoverflow.com/comment/35236288
type: QuestionComment
comment on: http://stackoverflow.com/q/23059620
has text: mb problem is in getElementsByTagName("assets").item(0) ? try item(1) instead of item(0)
score: 0
type: Comment

http://stackoverflow.com/a/22978493
score: 0
has body: This piece of code is doing it for me. Thanks @ Patricia Shanahan int j = 0, i = 0; while( j &lt; newArr.length &amp;&amp; i &lt; oldArray.length){ if(commonSet.contains(i)){ i++; } else{ diffArray[j] = arrayOne[i]; j++; i++; } }
type: Answer
has comment: http://stackoverflow.com/comment/35089709
has comment: http://stackoverflow.com/comment/35089629
answers question: http://stackoverflow.com/q/22977938
has comment: http://stackoverflow.com/comment/35089691

twilio
tag name: twilio
tags question: http://stackoverflow.com/q/23016255
type: Tag

http://stackoverflow.com/comment/35089350
type: Comment
has text: what is in line number 47 of paintComponent() in JavaGame2.java file?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22978403

http://stackoverflow.com/a/22983245
upvote count: 3
answers question: http://stackoverflow.com/q/22983034
type: Answer
downvote count: 0
has body: SOA is a design pattern much like OOP. SOA is not 'web centric' in that is a pattern specifically for 'web services', SOA is simply that, a design architecture that takes 'services' into account instead of 'objects'. A 'service' (in SOA) is just a 'thing'; this 'thing' can be anything from a member function of a class, to a complete working application 10k+ lines strong, a 'service' can even be considered a 'group of services' (much like a web service acts). As with any 'design principle' don't get hung up on semantics; SOA is not an 'end all', it's a buzz word that got over used and is oft misused (as with all buzz-words in the tech industry). That's not to say SOA is bad (no more so than OOP or a procedural pattern), it's just a tool to use in your repertoire. Hope that can help.
score: 3

http://stackoverflow.com/comment/35219572
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23050210
has text: What package do you declare in the ChessApplet class? Should the `code=` be `classes.dtadams.chess.gui.ChessApplet.class`? To allow a fully declared name including its packages.
score: 0

http://stackoverflow.com/q/23042803
type: Question
score: 5
tagged with: library-project
accepted answer: http://stackoverflow.com/a/23045791
answer count: 1
has comment: http://stackoverflow.com/comment/35210841
tagged with: java
has comment: http://stackoverflow.com/comment/35210179
tagged with: aar
has comment: http://stackoverflow.com/comment/35210673
upvote count: 5
downvote count: 0
has body: Hi I have a Android Library Project which produces an AAR. All is good but when I use the AAR in another project I get this error: java.lang.NoClassDefFoundError: com.squareup.picasso.Picasso The AAR makes use of picasso, is it possible to export the dependencies of the AAR as well when generating one?
has answer: http://stackoverflow.com/a/23045791
has comment: http://stackoverflow.com/comment/35205678
type: AnsweredQuestion
tagged with: android
has title: Android Library AAR depending on another library
has comment: http://stackoverflow.com/comment/35210544
favorite count: 0

http://stackoverflow.com/q/22997965
has answer: http://stackoverflow.com/a/22998132
has comment: http://stackoverflow.com/comment/35124946
has body: This is for a school project where it I'm supposed to produce a program that calculates the total amount of money. I keep getting 0 as a result. What did I do wrong? Thanks! package com.david.scanner; import java.util.Scanner; public class coin { public static void main (String[] Args){ int quarters = 0; int dimes = 0; int nickels = 0; int pennies = 0; int totalCents = 0; int dollars = 0; int cents = 0; totalCents = (quarters*25 + dimes*10 + nickels*5 + pennies); dollars = (totalCents/100); cents = (totalCents%100); @SuppressWarnings("resource") Scanner keyboard = new Scanner(System.in); System.out.print("How many quarters do you have --&gt;"); quarters = keyboard.nextInt(); System.out.println("How many dimes do you have --&gt;"); dimes = keyboard.nextInt(); System.out.println("How many nickels do you have --&gt;"); nickels = keyboard.nextInt(); System.out.println("How many pennies do you have --&gt;"); pennies = keyboard.nextInt(); System.out.println("Quarters = " + quarters); System.out.println("Dimes = " + dimes); System.out.println("Nickels = " + nickels); System.out.println("Pennies = " + pennies); System.out.println("Total value =" + dollars + "dollars " + cents + "cents!"); } }
tagged with: java
has comment: http://stackoverflow.com/comment/35124705
has comment: http://stackoverflow.com/comment/35125025
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35124711
has answer: http://stackoverflow.com/a/22998001
has title: I keep getting 0 as a result
score: 0
answer count: 3
tagged with: zero
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22999199

http://stackoverflow.com/a/23864289
upvote count: 1
answers question: http://stackoverflow.com/q/23068260
has body: If Oracle 10g ships with a JDBC driver called ojdbc6.jar, then you should use it instead of ojdbc14.jar. Otherwise, you can use the Oracle 11g JDBC driver (I know, for sure, that it ships with ojdbc16.jar). Unless otherwise noted, Oracle's JDBC drivers are backward compatible.
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36785769
type: Answer

http://stackoverflow.com/a/23029357
has comment: http://stackoverflow.com/comment/35196666
has body: I dont work with gxt 2.x.x. My friend trys to migrate from 2 to 3. And he use 2 and 3 parallel. So he start to build a new pages with gxt3 because if youll mix them you may have a big problems with layouts! If you want to use gxt3 you should do sonething like this: //Create grid Grid&lt;Plant&gt; grid = new Grid(...); //Create editable grid GridEditing&lt;Plant&gt; editing = new GridInlineEditing&lt;Plant&gt;(editableGrid); //add first editing column TextField watchField = new TextField(); TextField targerField = new TextField(); watchField.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { if(smtng) targerField.disable(); else targetField.enable(); } }); editing.addEditor(cc1, watchField); editing.addEditor(cc2, targetField); So I think thats help you.
answers question: http://stackoverflow.com/q/23025115
has comment: http://stackoverflow.com/comment/35201148
has comment: http://stackoverflow.com/comment/35211725
has comment: http://stackoverflow.com/comment/35222829
score: 0
type: Answer

http://stackoverflow.com/a/23075352
upvote count: 1
has body: For starters you are missing quite some dependencies (spring-beans, spring-context-supprt and probably spring-expression) and you have non-existing dependencies (spring-servlet, which probably must be spring-webmvc). Next your @Controller is wrong it currently maps to /hello which will lead to a URL /hello/hello which will never be touched by the DispatcherServlet as it is mapped to /hello and not /hello/* however I expect you want it to map to /hello so map your servlet to / or /* Finally I would strongly recommend you start to look at Maven (or Gradle) again. You don't want to be searching the internet for which jars you need to include into your project. If you really want to keep using ant at least look into Ivy for dependency management. For maven the following would be enough (and is roughly a translation of your build.xml file). 4.0.0 test my-test war 0.0.1-SNAPSHOT <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <spring.version>3.2.8.RELEASE</spring.version> org.springframework spring-webmvc ${spring.version} javax.servlet javax.servlet-api 3.0.1 provided org.apache.maven.plugins maven-compiler-plugin 3.1 ${project.build.sourceEncoding} 1.6 1.6 This will download all necesarry dependencies and will create a war file, when you do mvn package.
score: 1
answers question: http://stackoverflow.com/q/23072572
downvote count: 0
type: Answer

http://stackoverflow.com/q/23109953
tagged with: java
has answer: http://stackoverflow.com/a/23110063
type: Question
has title: Java File.toURI() issue on Linux
has comment: http://stackoverflow.com/comment/35326124
score: 0
tagged with: linux
answer count: 3
has answer: http://stackoverflow.com/a/23110123
type: UnansweredQuestion
has body: I'm trying to get the URI of a File to put into a HTML document, which is then later processed to read the image locations (which are in the system temp directory) from that HTML and do some processing on the images. It works fine on Windows, but on Linux I'm running into issues where the image locations from the HTML can't be found for subsequent processing. I think the issue is as follows... On Windows, the File.toURI().toString() command is returning (for C:\temp\image.jpeg): file:/C:/temp/image.jpeg On Linux, it is therefore presumably returning (for /tmp/image.jpeg): file://tmp/image.jpeg This is being interpreted by the HTML parser as tmp/image.jpeg (i.e. a relative path), and therefore can't be found. Is there an easy workaround for this, or do I need to manually force the URI to be correct (I guess file:///tmp/image.jpeg and file://C:/temp/image.jpeg)?
has answer: http://stackoverflow.com/a/23110183

http://stackoverflow.com/a/23047777
has comment: http://stackoverflow.com/comment/35324492
type: AcceptedAnswer
downvote count: 0
has body: public class Student { private int id; private String firstName; private String lastName; private int yearOfBirth; private String telephone; public Student(){ // public constructor yearOfBirth = -1; // default value to indicate that age was not specified yet } public setFirstName(String firstName) { this.firstName = firstName; } public setLastName(String lastName) { this.lastName = lastName; } public setAge(int age){ // calculate approximate year of birth based on student's current age Calendar calendar = new GregorianCalendar(); calendar.setTime(new Date()); yearOfBirth = calendar.get(Calendar.YEAR) - age; } public setTelephone(String telephone){ this.telephone = telephone; } /* add getters by yourself */ @Override public String toString(){ StringBuilder result; if (!getFirstName().equals("")){ result.append(getFirstName()); } if (!getLastName().equals("")){ if (!result.equals("")){ result.append(" "); } result.append(getLastName()); } if (getAge() != -1){ if (!result.equals("")){ result.append(", "); } result.append("age: ").append(String.valueOf(getAge())); } if (!getTelephone().equals("")){ if (!result.equals("")){ result.append(", "); } result.append("telepnone: ").append(getTelepnone()); } return result.toString(); } };
has comment: http://stackoverflow.com/comment/35326758
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/23047238
upvote count: 1
answers question: http://stackoverflow.com/q/23047238

http://stackoverflow.com/a/23119886
accepted answer of: http://stackoverflow.com/q/23119747
has body: To sort an array with compareTo(), public void sort(Comparable[] lst) { for(int i=0; i&lt;lst.length; i++) { for(int j=i; j&lt;lst.length; j++) { if(lst[i].compareTo(lst[j]) &lt; 0) { //swap elements, sorts in ascending order Comparable tmp = lst[i]; lst[i] = lst[j]; lst[j] = tmp; } } } }
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23119747

http://stackoverflow.com/comment/35324852
score: 3
comment on: http://stackoverflow.com/q/23109347
has text: how do you make the compare? can you give the code where test fails?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23014761
type: Question
tagged with: servlet-3.0
score: 0
has comment: http://stackoverflow.com/comment/35155775
has comment: http://stackoverflow.com/comment/35154877
type: UnansweredQuestion
has title: Spring 4 Jar overriding Servlet 3 Api
has comment: http://stackoverflow.com/comment/35155698
tagged with: spring
tagged with: spring-mvc
tagged with: spring-4
answer count: 0
tagged with: java
has body: I am trying to configure my latest Spring application programmatically instead of with an xml file. However, I am running into a problem where when I import the spring-webmvc-4.0.3.RELEASE jar the compiler no longer uses the Servlet 3 api. I need to have access to methods like: ServletContext.addListener(java.lang.Class listenerClass) and ServletContext.addServlet(java.lang.String servletName, java.lang.Class servletClass) But I also need to be able to use spring mvc classes like DispatcherServlet . Is this a known bug with Spring 4 and does anyone know of any resolution for it?
has comment: http://stackoverflow.com/comment/35156068

http://stackoverflow.com/q/23106077
has answer: http://stackoverflow.com/a/23107159
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35319490
type: Question
has comment: http://stackoverflow.com/comment/35319286
tagged with: recursion
tagged with: numbers
has comment: http://stackoverflow.com/comment/127519633
tagged with: sum
tagged with: java
has comment: http://stackoverflow.com/comment/35319180
has body: I have the below snippet of code to use a recursive method to add the sum of odd numbers. I have already coded the iterative method successfully that adds the sum of all odd numbers between n and m which are entered by the user. I'd like to reach that goal but am started slow to make sure I understand what is happening. I know that it makes more sense to do it iteratively, however I am experimenting with the two types to see which is more efficient. I am stuck on the below as it is not doing what i want it to and i can't understand why. import java.util.*; public class SumofOdd { public static void main (String [] args) { int n = 0; Scanner sc = new Scanner(System.in); System.out.println("Please enter an odd number"); n = sc.nextInt(); int x = add(n); } public static int add(int x) { if (x == 0) { return 0; } else { return (x + add(x-1)); } } } I have changed the above to the below. It compiles however stops after I enter the number. import java.util.*; public class SumofOdd { public static void main (String [] args) { int n = 0; Scanner sc = new Scanner(System.in); System.out.println("Please enter an odd number"); n = sc.nextInt(); if (n%2 == 0) { System.out.println("The number entered is even"); } else { int x = add(n); } } public static int add(int x) { if (x &lt;= 0) { return 0; } else { return (x + add(x-2)); } } }
has title: Recursive method to add odd numbers
has answer: http://stackoverflow.com/a/64422241
score: 0
has answer: http://stackoverflow.com/a/23310006
has answer: http://stackoverflow.com/a/23106396
answer count: 4

http://stackoverflow.com/q/23059122
score: 0
tagged with: fileinputstream
has title: Read one line at time from a file when a function is called each time
has answer: http://stackoverflow.com/a/23059220
answer count: 1
tagged with: bufferedreader
tagged with: file-io
has comment: http://stackoverflow.com/comment/35285468
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23059220
type: Question
tagged with: java
has body: String time=Read_one_Line(); public static String Read_one_Line() throws FileNotFoundException, IOException { FileInputStream fin=new FileInputStream("sample.txt"); BufferedReader br=new BufferedReader(new InputStreamReader(fin)); str=br.readLine(); next_line=br.readLine(); return next_line; } Each time it should read one line from text file called "sample.txt" and return it. next time it should return next line and so on.... Contents of sample.txt are: Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:310 Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:0 Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:10 Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:0 Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:380 Date:0 Year:0 Hour:0 Minute:0 Seconds:10 MilliSeconds:-840 Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:0 Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:0 Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:0 Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:0 But rather its reading and returning first line only each time.. please tell me how to increment to next line and return it when i call this function next time.

http://stackoverflow.com/comment/35294372
type: AnswerComment
comment on: http://stackoverflow.com/a/23063576
type: Comment
score: 1
has text: yep 5.5.0 worked. i thought i was grabbing latest from maven repository but i accidentally mis clicked when i went to copy paste. crap.

http://stackoverflow.com/comment/35100950
score: 0
type: AnswerComment
has text: Why `stat.executeUpdate( query2 );` again? Remove that statement and execute.
type: Comment
comment on: http://stackoverflow.com/a/22982514

http://stackoverflow.com/comment/35161583
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23017689
has text: It's still continuing to crash even after I moved everything over to activity_main.xml. Am I missing something?

http://stackoverflow.com/comment/35086840
comment on: http://stackoverflow.com/q/22976752
has text: @ylun.za I believe the option you are looking for is in Preferences>Run/Debug>Perspectives>Open the associated perspective when launching
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/q/23090427
has title: Dealing with lots (and lots) of JButtons Elegantly
answer count: 0
tagged with: java
tagged with: swing
has body: Just wondering what would be the best way to go about including tons of Buttons in a Swing application without affecting performance too much? At the moment I have a few ideas: [Brute Force] Display a list of JButtons all using the same action listener. -this method is essentially brute force and causes obvious problems [Dynamic Visiblity] Hide/Display//Remove/Add JButtons based on the scroller position so that a limited amount are active at any time. -I haven't tried (or any of the below) this but it seems like it would get quite messy* [Fake Buttons] Create a Large JPanel with a mouse Listener, Draw Rectangles to Panel when clicked based on mouse coordinates from a mouseListener. [Dynamic Fake Buttons] Like number 3 except using a Small JPanel that only fills the window area. This is repainted every time the user scrolls (on a fake ScrollPane) Any ideas on how best to deal with this problem?
has comment: http://stackoverflow.com/comment/35298976
type: Question
has comment: http://stackoverflow.com/comment/35292161
score: 0
tagged with: jscrollpane
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35316916
tagged with: jbutton

http://stackoverflow.com/q/23033995
type: Question
has comment: http://stackoverflow.com/comment/35593276
has body: MainActivity : public class MainActivity extends Activity implements OnKeyboardActionListener{ public int start = 0; private View view; static Button submit; final Activity activity = this; public int stop; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } //EditText editText = (EditText) findViewById(R.id.result); submit = (Button) activity.findViewById(R.id.submit); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } public void submitNumber(final View view){ if(stop == 0){ level lev= new level(0) ; operation opreration = new operation(); int sum= 1; TextView score = (TextView) findViewById(R.id.score); TextView number2 = (TextView) findViewById(R.id.randNumber2); TextView number = (TextView) findViewById(R.id.randNumber); TextView opr = (TextView) findViewById(R.id.opr); int num1 = Integer.parseInt(number.getText().toString()); int num2 = Integer.parseInt(number2.getText().toString()); EditText ed…
has comment: http://stackoverflow.com/comment/35469735
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Android App crashing when I disable or/and enable button
answer count: 0
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/23129102
has answer: http://stackoverflow.com/a/23133694
has body: Good day, I am trying to use Spring framework in my java project and currently I am configuring the beans.xml file. I am new to Spring and I have difficulties on understanding how beans are used and what do they represent; I have read several documentations but still I need some clarification on this. Can anyone briefly explain what beans are and how are they used? Let's say, I have the following classes; what are beans in this case? public class Repository { private final Set&lt;Integer&gt; integers = new HashSet&lt;Integer&gt;(); private final Set&lt;String&gt; strings = new HashSet&lt;String&gt;(); public void addInt(int i) { integers.add(i); } public void addString(String s) { strings.add(s); } public Set&lt;Integer&gt; getInts() { return integers; } public Set&lt;String&gt; getStrings() { return strings; } } and public class Service { private Repository repository; public void createInt(int i) { repository.addInt(i); } public void createString(String s) { repository.addString(s); } public Set&lt;Integer&gt; getInts() { return repository.getInts(); } public Set&lt;String&gt; getStrings() { return repository.getStrings(); } } Thank you
has title: How are beans correctly used and what do they represent?
type: Question
has comment: http://stackoverflow.com/comment/35361423
tagged with: java
has comment: http://stackoverflow.com/comment/35361011
has comment: http://stackoverflow.com/comment/35360840
score: 0
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35361151
tagged with: spring
has comment: http://stackoverflow.com/comment/35361521
has comment: http://stackoverflow.com/comment/35361294
tagged with: spring-mvc

http://stackoverflow.com/comment/35320133
has text: Looks like a hack to me, especially adding a subfolder of src/main/resources, which I suspect will cause the configuration files to be duplicated. Something like ${basedir}/src/main/config would make more sense.
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/23105754

http://stackoverflow.com/q/22988243
favorite count: 0
accepted answer: http://stackoverflow.com/a/22988474
has comment: http://stackoverflow.com/comment/35106365
score: 20
has title: Using @Nullable in Java
linked to: http://stackoverflow.com/q/4963300
possible better answer: http://stackoverflow.com/a/22988357
has answer: http://stackoverflow.com/a/22988357
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35106421
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/348408
has answer: http://stackoverflow.com/a/22988474
upvote count: 20
has comment: http://stackoverflow.com/comment/35106362
has body: I have a question regarding the usage of @Nullable annotation in Java. From what I've read, it's a good practice to set in on methods that may return a null value. In this way, the IDE may help detect some null pointer exception errors or suggest the removal unnecessary null pointer exception checks if @NotNull is used. So far so good, but what about using @Nullable for method parameters? Is this a good practice or will the code become even more verbose (if used with final) and the benefit may be missing since you don't always know what arguments will be passed to the function call? Also, what is your opinion on using @Nullable with setter methods? The usage is related to a situation when working in a company and not to a small project (like a homework).
linked to: http://stackoverflow.com/q/14076296
answer count: 3
has answer: http://stackoverflow.com/a/22988767
downvote count: 0

http://stackoverflow.com/comment/35347486
comment on: http://stackoverflow.com/a/23121398
type: AnswerComment
has text: It seems that `printComputer()` doesn't return a string but prints that line to the standard output. Moreover, name is probably the first element after the split.
score: 0
type: Comment

http://stackoverflow.com/a/23120858
upvote count: 1
has body: Try frame.setAlwaysOnTop(true); For more info have a look at Window#setAlwaysOnTop() OR Try with null parent as defined below: int n = JOptionPane.showOptionDialog(null, "Would you like to continue or stop procedure?", "Plese confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); For more info look at JOptionPane Defines the Component that is to be the parent of this dialog box. It is used in two ways: the Frame that contains it is used as the Frame parent for the dialog box, and its screen coordinates are used in the placement of the dialog box. In general, the dialog box is placed just below the component. This parameter may be null, in which case a default Frame is used as the parent, and the dialog will be centered on the screen (depending on the L&amp;F). --EDIT-- If nothing is working then find the answer at How to Make Dialogs.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35346938
has comment: http://stackoverflow.com/comment/35346615
has comment: http://stackoverflow.com/comment/35346776
has comment: http://stackoverflow.com/comment/35346907
score: 1
answers question: http://stackoverflow.com/q/23120752

http://stackoverflow.com/comment/35338564
has text: @squiguy Educational purpose I guess, one problem at a time is probably better to understand how things work ;)
comment on: http://stackoverflow.com/q/23116326
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22987170
has body: I am working on a monitoring program that reads the /var/log/auth.log file. I am using Apache Commons IO Tailer class to read the file in real time. To get started, I wanted to test the real-time reading part on a simple file, and manually enter some code in the console line. Here is my code: public class Main { public static void main(String[] args) { TailerListener listener = new MyListener(); Tailer tailer = Tailer.create(new File("log.txt"), listener, 500); while(true) { } } } public class MyListener extends TailerListenerAdapter { @Override public void handle(String line) { System.out.println(line); } } And from the terminal : sudo echo "Hello" &gt;&gt; log.txt The problem is when I try to write manually something in the file, it does not print it in the console. I tried to find a concrete example of usage of Tailer class, but no luck. What am I doing wrong here?
answer count: 2
has title: Apache Commons IO Tailer example
tagged with: apache-commons-io
favorite count: 0
has comment: http://stackoverflow.com/comment/35109385
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22987713
upvote count: 18
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35109630
type: Question
has comment: http://stackoverflow.com/comment/35105519
has answer: http://stackoverflow.com/a/22988065
score: 18

http://stackoverflow.com/q/22993209
score: 1
tagged with: java
has body: I have a pdf file with different pages that I'm trying to merge into ONE PDF page. So this list of pages are merged together and numbered. For example : 1. Page1 2. Page2 till all the separate pages are numbered and merged into one whole document. the PROBLEM here is, that the numbers appear bottom aligned. I cannot get the numbers to appear at the top of the text. Here is the snippet canvas.addTemplate(page, 1f, 0 , 0, 1, 100, pos); canvas.beginText(); canvas.setTextMatrix(90, (float) ((pos)-0.5*CurPsize)); canvas.showText(m+"."+" "); canvas.endText(); where , m=1 // number of pages counter initialized at 1 Rectangle r=reader.getPageSize(m) CurPsize=(r.getTop()-r.getBottom()); pos=pos-CurPsize . I have attached the pdf file here. https://drive.google.com/file/d/0B4scqcWd2Ci0X1JpSi15Q1FkVDQ/edit?usp=sharing This is the file I want to merge with numbering
tagged with: itext
tagged with: formatting
type: Question
upvote count: 1
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/35182556
answer count: 1
favorite count: 0
has title: Picture Alignment with Numbered List (Android)
has comment: http://stackoverflow.com/comment/35187267
has answer: http://stackoverflow.com/a/23909347
accepted answer: http://stackoverflow.com/a/23909347
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/23073544
answers question: http://stackoverflow.com/q/23073521
score: 0
has body: You have done these assignments prior taking the user inputs: int low = numbers[0]; int max = numbers[0]; which means low and max initial value will be 0. So for your minimum logic, user inputs are compared with low and no value is lower than 0 so you always get 0 as the minimum. You should define or re-assing them after taking the user input i.e with the real numbers array values.
type: Answer

http://stackoverflow.com/q/23016934
has body: I'm trying to see if the Eclipse SonarQube plugin can help me to get a good understanding of an Eclipse RCP Product. My goal is to understand and identify all the dependencies between RCP projects that make up all of the Features included in the Product. Is this even possible? If so, does anybody have an idea of how to approach this? The immediate goal in identifying the dependencies between the RCP projects is to identify which projects are tightly coupled and then begin to asses how to go about refactoring projects to de-couple those that can be de-coupled. I've used sonar in a similar fashion with JavaEE projects but not with Eclipse RCP projects. Looking for some tips and guidance. thanks, mbeddedsoft.
tagged with: sonarqube
tagged with: eclipse
upvote count: 2
downvote count: 0
has title: How to use Sonar Qube with Eclipse RCP product to identify project dependencies
favorite count: 0
type: UnansweredQuestion
score: 2
answer count: 0
tagged with: java
type: Question

http://stackoverflow.com/a/23055614
has comment: http://stackoverflow.com/comment/35229335
answers question: http://stackoverflow.com/q/23055505
type: Answer
has body: Did you try to split the string with just one backslash, likes this: .split("\n").
has comment: http://stackoverflow.com/comment/35229116
score: 0

http://stackoverflow.com/comment/35353670
score: 0
type: QuestionComment
type: Comment
has text: @BasilBourque Something simple as "3 minutes, 29 seconds". If I can get the amount/units to work with, I can most likely make a string from there.
comment on: http://stackoverflow.com/q/23124849

http://stackoverflow.com/a/23113085
has comment: http://stackoverflow.com/comment/102007297
has comment: http://stackoverflow.com/comment/67960227
type: AcceptedAnswer
downvote count: 0
has body: I think flatMap() is what you're looking for. For example: List&lt;AClass&gt; allTheObjects = map.values() .stream() .flatMap(listContainer -&gt; listContainer.lst.stream()) .collect(Collectors.toList());
has comment: http://stackoverflow.com/comment/102007878
type: Answer
answers question: http://stackoverflow.com/q/23112874
accepted answer of: http://stackoverflow.com/q/23112874
score: 215
upvote count: 215
has comment: http://stackoverflow.com/comment/68252977
has comment: http://stackoverflow.com/comment/68254521
has comment: http://stackoverflow.com/comment/91825345

http://stackoverflow.com/a/23077037
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23074771
has body: How To Add ShortCut Keys to JTextField? The link shows how to add your own KeyBinding. You can do the same for TAB replacing default action with your own one. In your custom action you can fill the suggestions list and show them in a JPopupMenu or in JComboBox where you need. You should also read http://www.coderanch.com/t/482913/GUI/java/Tab-Key-Binding-JTextField That's an attempt to replace behaviour. TAB and SHIFT+TAB are used for focus so you could meet all the problems described.
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/35239149
comment on: http://stackoverflow.com/q/23061017
type: Comment
type: QuestionComment
has text: Please update your question by posting your entities
score: 0

http://stackoverflow.com/a/23712602
has comment: http://stackoverflow.com/comment/37276939
has comment: http://stackoverflow.com/comment/37220730
downvote count: 0
has comment: http://stackoverflow.com/comment/37240408
score: 10
has comment: http://stackoverflow.com/comment/37237345
has body: if you're using the Drive API library, it will handle the 401 exceptions for you, as long as you give it a credential with access and refresh token. Here's how to build a Credential object with the StoredCredential . You can use an implementation different than MemoryDataStoreFactory : public class ApiCredentialManager { private DataStore<StoredCredential> dataStore; //Put your scopes here public static String[] SCOPES_ARRAY = { "https://www.googleapis.com/auth/admin.directory.user" }; private ApiCredentialManager() { try { dataStore = MemoryDataStoreFactory.getDefaultInstance().getDataStore("credentialDatastore"); } catch (IOException e) { throw new RuntimeException("Unable to create in memory credential datastore", e); } } public static ApiCredentialManager getInstance() { if (instance == null) instance = new ApiCredentialManager(); return instance; } public Credential getCredential(String username) throws Exception { try { GoogleCredential credential = new GoogleCredential.Builder() .setTransport(new NetHttpTransport()) .setJsonFactory(new JacksonFactory()) .addRefreshListener( new DataStoreCredentialRefreshListener( username, dataStore)) .build(); if(dataStore.containsKey(username)){ StoredCredential storedCredential = dataStore.get(username); credential.setAccessToken(storedCredential.getAccessToken()); credential.setRefreshToken(storedCredential.getRefreshToken()); }else{ //Do something of your own here to obtain the access token. //Most usually redirect the user to the OAuth page } return credential; } catch (GeneralSecurityException e) { throw new Exception("isuue while setting credentials", e); } catch (IOException e) { e.printStackTrace(); throw new Exception("isuue while setting credentials", e); } } //Call this when you've obtained the access token and refresh token from Google public void saveCredential(String username, Credential credential){ StoredCredential storedCredential = new StoredCredential(); storedCredential.setAccessToken(credential.getAcces…
upvote count: 10
answers question: http://stackoverflow.com/q/23083982
type: Answer

http://stackoverflow.com/comment/35284956
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23086343
has text: Thanks the return; worked and the this.setVisible(false); is for when opening the next page the current page won't be visible

http://stackoverflow.com/q/22970921
tagged with: button
has body: Is there a way to remove the maximize button and leave the minimize button and close button without using JDialog. I already know you can set resizable to false like this: frame = new JFrame(); frame.setResizable(false); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); but I want to just get rid of the button. Is that possible at all?
has comment: http://stackoverflow.com/comment/37070928
has comment: http://stackoverflow.com/comment/35078638
score: 0
linked to: http://stackoverflow.com/q/2665355
has comment: http://stackoverflow.com/comment/37294911
answer count: 0
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/35091870
has comment: http://stackoverflow.com/comment/35087431
has comment: http://stackoverflow.com/comment/35075952
has title: How to remove Maximize button in swing designer without JDialog?
tagged with: java
type: Question

http://stackoverflow.com/a/44089383
score: 3
upvote count: 3
downvote count: 0
has body: Open tomcat_users.xml as administrator, you can find it under conf folder like in my case C:\Program Files\Apache Software Foundation\Tomcat 8.0\conf\tomcat_users.xml and find tag &lt;user&gt; and add role manager-script in roles attribute like this &lt;user username="admin" password="admin" roles="admin-gui,manager-gui,manager-script" /&gt; But make sure tomcat is not running.
type: Answer
answers question: http://stackoverflow.com/q/23126867

http://stackoverflow.com/q/23073045
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23073068
has title: Showing a link in Servlet.java
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23073068
has body: I am using the Eclipse IDE, using a Dynamic Web Project. I created a Servlet, HelloServlet.java and an index.jsp file. I need to show a link within the JSP file. I have tried the following: request.getWriter().println("&lt;a href='http://localhost:8080/WebApp-01/'&gt; Test &lt;/a&gt;"); However, nothing produces. What might I do to produce a link in the JSP file?
type: AnsweredQuestion

http://stackoverflow.com/comment/35283157
type: QuestionComment
comment on: http://stackoverflow.com/q/23084533
has text: If I want to generate just AST for more languages, than is it advisable to go with ANTLR3?
type: Comment
score: 1

http://stackoverflow.com/a/23119012
type: Answer
answers question: http://stackoverflow.com/q/23105177
has body: If you ask any specific questions regarding the MonkeyRunner, I am sure people would love to help you. But please avoid asking general broad-range questions that can be easily found by doing some research online.
score: 0

http://stackoverflow.com/comment/35344847
has text: If you have logging configured, turn it to debug level and post it here. Also lets see whats there in your web.xml
score: 0
comment on: http://stackoverflow.com/q/23117797
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23088354
answers question: http://stackoverflow.com/q/23083694
has comment: http://stackoverflow.com/comment/35379771
has comment: http://stackoverflow.com/comment/35385259
has comment: http://stackoverflow.com/comment/35293864
has comment: http://stackoverflow.com/comment/35330389
has body: This doesn't work. Query query = new WildcardQuery(new Term("*", term)); If you want to search across all fields, you'll either need to create a Term for each field you need to search, and combine them (a DisjunctionMaxQuery is usually best for that): Query query = new DisjunctionMaxQuery(0); query.add(new TermQuery(new Term("field1", term))); query.add(new TermQuery(new Term("field2", term))); query.add(new TermQuery(new Term("field3", term))); MultiFieldQueryParser is another good tool for this. Alternatively, a useful pattern is to add all searchable fields into one unstored catch-all field at index time, and when you want to match against anything in the index, you could just query that field instead of enumerate subqueries on all searchable fields. Also, it looks like you want to add the wildcard to the query here, but you haven't done so. WildcardQuery won't assume any wildcards that aren't there in the term. Query query = new WildcardQuery(new Term("field", term + "*")); Since you just need a trailing wildcard, though, I would just use PrefixQuery, which is the standard way of handling a trailing wildcard. Query query = new PrefixQuery(new Term("field", term));
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35334977
has comment: http://stackoverflow.com/comment/35325040
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35381367
accepted answer of: http://stackoverflow.com/q/23083694
has comment: http://stackoverflow.com/comment/35384605
has comment: http://stackoverflow.com/comment/35383550
has comment: http://stackoverflow.com/comment/35296723

http://stackoverflow.com/comment/35235237
comment on: http://stackoverflow.com/a/23041206
type: Comment
score: 0
type: AnswerComment
has text: Oh, it was not clear for me that you wanted to compile C/C++ code using Java! I assumed that you were interested in compiling Java code.

http://stackoverflow.com/q/23008776
has title: Can not access folder which has created by Java application in my PHP application
has comment: http://stackoverflow.com/comment/35143976
type: UnansweredQuestion
tagged with: php
has answer: http://stackoverflow.com/a/23008814
tagged with: java
has body: I have a normal web application which are store user details and their images, we are creating user wise run time folders to store their all profile pictures. example:- upload/user_1/anyimage.jpg Also I have another java process(running as thread in server) which we are using to parse user data in bulk and after parsing we save it in database also we are creating run time folder to store user's profile pictures with same file structure. example:- upload/user_2/anyimage.jpg Now problem is:- when user 2 wanted to change their profile picture using UI(php application) using move_upload_file() we are getting permission denied error. When I have investigate more deeply I found that when folder has created using java application its owner is root and my php application is running under daemon user so that's the reason behind permission denied error. How to overcome this problem, because we neither can change user who is running php application(because its system backend user) nor my java application. As I am very new to this forum, please let me know if this is write place for this.
type: Question
answer count: 1
score: 0

http://stackoverflow.com/q/22995038
has body: I guess I'm having a weird issue since I didn't see anyone having an issue like this. After I click on a button that is supposed to return me a new page, it only returns me the text, no CSS, no images nothing but just text. I wish I could add a screenshot, but it is an internal tool and unfortunately I'm not allowed to post it. Have anyone else had an issue similar to this before? Thanks in advance
has comment: http://stackoverflow.com/comment/35158836
has comment: http://stackoverflow.com/comment/35136460
has comment: http://stackoverflow.com/comment/35158896
type: UnansweredQuestion
tagged with: testng
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/35159992
has title: Selenium doesn't load the entire page
answer count: 0
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/35125640
has comment: http://stackoverflow.com/comment/35119790
type: Question
has comment: http://stackoverflow.com/comment/35120093
score: 0

http://stackoverflow.com/comment/35182436
has text: 403 is the error code for "forbidden" - the website administrator obviously doesn't want you to use a program to scrape their content. You should respect that!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23029749
score: 3

http://stackoverflow.com/q/23096762
upvote count: 0
has title: Java dice random numbers
downvote count: 5
tagged with: dice
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23096980
type: UnansweredQuestion
has body: I posted about this yesterday, but I think I need to make it less involved. I have absolutely no Java experience, and I need to work on this "Dice" program. I've done it twice already, but clearly I still have no idea what I'm doing. I've also been pouring over examples on here and elsewhere online, but none of them exactly match what I'm doing, as they all say "Pair of Dice". Mine says: "Create a class called Dice to represent a SINGLE cube". It should have a method called roll() that randomly selects a number from 1-6 for the value of the dice." It has to use java.util.random, not math.java, and it has to have numberShowing:int, roll():int, and main() all in it. The last part reads "Create a test main method for the Dice class that creates a dice and rolls it many times. Can you keep track of how many times a number comes up? Describe how or implement it in the program." I have started at this computer for hours, and read as much info as I can. I can't tell you how high my anxiety level is right now, nor how much I despise this. Please help me get this code written.
score: -5
tagged with: java
type: Question

http://stackoverflow.com/q/23096698
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35304137
tagged with: swing
type: Question
has title: 2D Array with a custom rows and columns
score: 1
tagged with: java
has body: I need to create 2d array with 5 rows and 6 columns in the first row and then the rest is 5 columns so that would look like this { 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } is there any way to do so? as of now i have only this, it creates 6 rows and 5 columns: private static JButton[][] b = new JButton[6][5]; updtae: I am using Java for this.
has answer: http://stackoverflow.com/a/23096780
upvote count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/23096796
tagged with: awt
has answer: http://stackoverflow.com/a/23096773
has comment: http://stackoverflow.com/comment/35304043
favorite count: 0
has comment: http://stackoverflow.com/comment/35304070
has comment: http://stackoverflow.com/comment/35313767
answer count: 4
has comment: http://stackoverflow.com/comment/35305274
has comment: http://stackoverflow.com/comment/35304351
downvote count: 0
has answer: http://stackoverflow.com/a/23097342

http://stackoverflow.com/q/23094436
favorite count: 0
has comment: http://stackoverflow.com/comment/35360550
linked to: http://stackoverflow.com/q/11435315
type: UnansweredQuestion
tagged with: android
tagged with: java
has title: Programs run fine with LibGDX -desktop but not LibGDX - Android?
tagged with: eclipse
tagged with: gradle
type: Question
score: 5
has answer: http://stackoverflow.com/a/26958674
tagged with: libgdx
has comment: http://stackoverflow.com/comment/35306789
upvote count: 5
has body: So I have just set up Eclipse to work with LibGDX using Gradle. After I installed I noticed there was a problem with the Android package, there was a red cross next to the package. When I opened it further there was a red cross next to src then com.myname.game.android and then in AndroidLauncher.java. When I opened the AndroidLauncher.java, this was the code I got: package com.faturbansloth.game.android; import android.os.Bundle; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.faturbansloth.game.MyGame; public class AndroidLauncher extends AndroidApplication { @Override protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); initialize(new MyGame(), config); } } When I looked at the errors in he code of AndroidLauncher.java they were saying: -The type android.os.Handler cannot be resolved. It is indirectly referenced from required .class files -The import android.os.Bundle cannot be resolved -Multiple markers at this line - The type android.app.Activity cannot be resolved. It is indirectly referenced from required .class files - The hierarchy of the type AndroidLauncher is inconsistent -Bundle cannot be resolved to a type I am using SDK Manager 22.6.2 with the newest Gradle plugin for Eclipse. I have JRE 8 and JDK 7. Is there anyway to fix this problem? Thanks in advance.
has answer: http://stackoverflow.com/a/25426266
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/35159593
has text: Are you sure you want `o.equals(o)` to return false? Is this an academic exercise?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23017162

http://stackoverflow.com/q/22998834
upvote count: 4
has answer: http://stackoverflow.com/a/23012618
answer count: 2
downvote count: 0
tagged with: jsp
tagged with: embedded-jetty
favorite count: 0
has comment: http://stackoverflow.com/comment/35149674
has comment: http://stackoverflow.com/comment/35150727
accepted answer: http://stackoverflow.com/a/23012618
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35126549
type: Question
possible better answer: http://stackoverflow.com/a/49157749
has answer: http://stackoverflow.com/a/49157749
tagged with: java
has body: I am trying to maintain a java web app that is run standalone using embedded jetty, using Java 7 and Jetty 9.1.3. Everything runs except all of the links in one of the JSP pages. Each link on that page is supposed to fetch a png file or a text file and display it below the link. When run through Netbeans, each link just hangs when clicked and the console gives the following errors: Apr 10, 2014 4:23:34 PM org.apache.struts.chain.commands.AbstractExceptionHandler execute WARNING: Unhandled exception java.lang.IllegalStateException: Form too many keys at org.eclipse.jetty.util.UrlEncoded.decodeUtf8To(UrlEncoded.java:526) at org.eclipse.jetty.util.UrlEncoded.decodeTo(UrlEncoded.java:625) at org.eclipse.jetty.server.Request.extractParameters(Request.java:344) at org.eclipse.jetty.server.Request.getParameterNames(Request.java:852) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:426) at org.apache.struts.chain.commands.servlet.PopulateActionForm.populate(PopulateActionForm.java:50) at org.apache.struts.chain.commands.AbstractPopulateActionForm.execute(AbstractPopulateActionForm.java:60) at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:711) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:552) at org.eclipse.jetty.server.handler.ScopedHa…
has title: Webapp with embedded jetty giving exception
score: 4

http://stackoverflow.com/a/23005959
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35142007
score: 1
answers question: http://stackoverflow.com/q/23005822
has comment: http://stackoverflow.com/comment/35141203
upvote count: 1
has comment: http://stackoverflow.com/comment/35139417
has body: From the attached image I can see that you can see firstname and last name value.This is because your input type is hidden &lt;input type="hidden" name="param1" value="&lt;%=resultSet.getString("first_name")%&gt;"&gt;&lt;/td&gt; Also you said here *Now I want first_name and last_name should appear as links and I found this Discussion, so I tried :* so you should do like this &lt;a href="your _link"&gt;&lt;%=resultSet.getString("first_name")%&gt;&lt;/a&gt;
has comment: http://stackoverflow.com/comment/35140601

http://stackoverflow.com/q/23022494
has comment: http://stackoverflow.com/comment/35169900
tagged with: java
has body: Write a Java code of the method that takes an array of strings and a String (S(. The method should return an integer that is the number of strings that starts with S. For example if: array_words = { "All", "Arab", "size", "Almond", "Allowed", "here"} and S= "All", then the method should return 2 what is the idea of searching here ?
has comment: http://stackoverflow.com/comment/35169911
type: Question
has answer: http://stackoverflow.com/a/23022641
has title: Retrieve strings prefixed by a string in an array
has answer: http://stackoverflow.com/a/23022638
favorite count: 0
answer count: 3
downvote count: 4
upvote count: 0
has answer: http://stackoverflow.com/a/23022556
type: UnansweredQuestion
score: -4

http://stackoverflow.com/q/23098111
has title: How to specify random group position, instead of sequence, in Regular Expressions?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23098528
upvote count: 1
linked to: http://stackoverflow.com/q/22937618
has comment: http://stackoverflow.com/comment/35306812
type: Question
has comment: http://stackoverflow.com/comment/35306655
tagged with: grouping
answer count: 1
downvote count: 0
has body: I’m trying to use the available Wiktionary data dump downloads, which I have been translating with Java and its regex classes, specifically Pattern and Matcher, with fair success. The word definition dumps, which are my main interest, are in raw wiki-markup, which is not html nor xml, etc., but its own unique format. There are many different elements, but the most difficult to deal with are the templates. What I’ve come up against are specific templates that have positional fields, as well as optional ones, which can appear in any order. I have been able to come up with regular expressions, which almost do the job, but are not quite adequate to handle every instance I encounter, where fields are switched around or optionally omitted. I am realizing from this, that I do not know how to designate regex group position when order of occurrence is more sophisticated than just a sequence. An example of one of these complicated templates is that of “term”, documented on the following page: http://en.wiktionary.org/wiki/Template:term My best stab at the regex (omitting, for now, the extra escape characters needed to make the string Java compatible) is the following: \{\{term\|(.+?)(?:\|(.*?))?(?:\|([\w, -]+?))?(?:\|lang=([\w-]+?))?(?:\|sc=(\w+?))?(?:\|tr=([\w, -]+?))?(?:\|pos=(\w+?))?(?:\|lit=([\w, -]+))?\}\} This works for genuine examples of term templates encountered such as: But it fails to work properly for the following: There’s got to be a way of specifying that some groups are positional and some can appear randomly, instead of just optionally in a specif…
favorite count: 0
tagged with: wikitext
type: UnansweredQuestion
tagged with: regex
tagged with: markup

http://stackoverflow.com/comment/35130193
type: Comment
type: QuestionComment
has text: does [this](http://wonderfl.net/c/9ug3) help ?
comment on: http://stackoverflow.com/q/23000032
score: 0

http://stackoverflow.com/q/23100657
tagged with: arrays
tagged with: string
tagged with: sorting
has body: Would appreciate some advice, I have create an array of months that I have to sort in order of length using a comparator. I have created two classes the array list and the comparator but it is not returning them in the correct order as May should be the first month that displays and I don't know where I have gone wrong, posting my code below if anyone can tell me what I have done and how to avoid in the future!. Thanks so much!! import java.util.*; public class Q3 implements Comparator.java { //creating array of months to be sorted in order of length public int compare(String x, String y) { if (x == null) return y==null ? 0 : -1; else if (y == null) return +1; else { int lenx = x.length(); int leny = y.length(); if (lenx == leny) return x.compareTo(y); else return lenx &gt; leny ? -1 : +1; } } public static void main(String[] args) { String[] data = { "January", "February", "March", "April", "May", "June", }; Arrays.sort(data); System.out.println(Arrays.toString(data)); } }
has comment: http://stackoverflow.com/comment/35310190
has title: Java sorting an array of strings by increasing length using a comparator
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35310131
type: UnansweredQuestion
downvote count: 1
linked to: http://stackoverflow.com/q/21970719
tagged with: java
has answer: http://stackoverflow.com/a/23100731
score: -1
type: Question
tagged with: comparator
upvote count: 0

http://stackoverflow.com/a/23094132
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35378389
has comment: http://stackoverflow.com/comment/35375735
has comment: http://stackoverflow.com/comment/35378599
type: Answer
has comment: http://stackoverflow.com/comment/35323924
has comment: http://stackoverflow.com/comment/35377190
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23093902
answers question: http://stackoverflow.com/q/23093902
has body: If you want your UI thread to remain active, you need to put this in a separate thread with something like an AsyncTask so that your sleep doesn't freeze your UI. Something like private class MyAsyncTask extends AsyncTask&lt;Integer param, Void, Void&gt;{ private int time = 0; @Override protected Void doInBackground(Integer...time){ this.time = time[0]; try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } } @Override protected void onPostExecute(Void result){ createButton(time-1); } } Then do something like this in your activity private MyAsyncTask task; @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); int time; // Some methodology to get the desired time createButton(time); new MyAsyncTask().execute(time -1); } With your method changed to public void createButton(int time) { Random r = new Random(); int i1 = r.nextInt(300); int i2 = r.nextInt(300); Button myButton = new Button(this); myButton.setText("Push Me"); RelativeLayout ll = (RelativeLayout)findViewById(R.id.rela); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(50, 50); lp.setMargins(i1,i2,0,0); myButton.setLayoutParams(lp); ll.addView(myButton); if(time == 0) return; else new MyAsynCTask().execute(time); }
type: AcceptedAnswer

http://stackoverflow.com/comment/35333563
score: 0
type: Comment
has text: -1,this suggestion was made earlier. No need to clutter the forum with duplicate answers.
comment on: http://stackoverflow.com/a/23113121
type: AnswerComment

http://stackoverflow.com/q/23025733
tagged with: swing
has answer: http://stackoverflow.com/a/23026211
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: arraylist
has title: How I can get an array with 2 items from a selected item in a JComboBox?
accepted answer: http://stackoverflow.com/a/23026211
tagged with: jcombobox
tagged with: netbeans
has comment: http://stackoverflow.com/comment/35176031
has body: I have an ArrayList&lt;ArrayList&lt;Object&gt;&gt; Suppliers. Each ArrayList&lt;Object&gt; has 2 elements, an int (an id and the id may not be sequential with each other.) and a string (a name). Now in a JComboBox, I create a DefaultComboBoxModel, containing the main ArrayList 'Suppliers'. jcbSuppliers.setModel (new DefaultComboBoxModel (suppliersdata.Suppliers.toArray ())); The JComboBox shows me each element such as [1, Local Supplier], [2, External Supplier], [4, Other Supplier]. Capture 1 In NetBeans debug, i put a Watch on jcbSuppliers. The variables window shows me that each element of jcbSuppliers is an ArrayList with 2 Objects. Capture 2 Now my question is: How I can get these 2 items or the array of these 2 objects, but of the selected object or item? I would appreciate the help. Thank you very much.
upvote count: 1

http://stackoverflow.com/a/23005317
type: AcceptedAnswer
downvote count: 0
has body: Use ILaunchManager.getProcesses() to get the list of running processes that the launch manager knows about: ILaunchManager manager = DebugPlugin.getLaunchManager(); IProcess [] processes = manager.getProcesses();
type: Answer
answers question: http://stackoverflow.com/q/23002052
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23002052

http://stackoverflow.com/a/23041138
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23041104
has comment: http://stackoverflow.com/comment/35204212
has body: Yes, it should be. But you need a server on which you have enough control to get sure you got a JDK, not only a JRE. And that's gonna be the most difficult part... If you can get that, afterwards, you can use any scripting language to invoke javac, the compiler. This could even be done within a servlet that would compile some generated java source files.
has comment: http://stackoverflow.com/comment/35203040

http://stackoverflow.com/q/22976484
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/22976526
has title: How to display mouse coordinates in a JPanel?
tagged with: java
tagged with: jpanel
type: Question
has comment: http://stackoverflow.com/comment/35086127
has body: I am trying to get the code below to display the coordinates in info_panel but it is not working. How would I get the coordinates from the mouseListener from SimpleFrameViewWidget to be displayed in the info_panel? I am using setText right now... Thanks! public static void main(String[] args) throws IOException { Frame f = A7Helper.readFromURL("http://www.cs.unc.edu/~kmp/kmp.jpg"); f.setTitle(""); SimpleFrameViewWidget simple_widget = new SimpleFrameViewWidget(f); JFrame main_frame = new JFrame(); main_frame.setTitle("Assignment 7 Pixel Inspector"); main_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel top_panel = new JPanel(); top_panel.setLayout(new BorderLayout()); top_panel.add(simple_widget, BorderLayout.CENTER); main_frame.setContentPane(top_panel); JPanel info_panel = new JPanel(); info_panel.setLayout(new BorderLayout()); top_panel.add(info_panel, BorderLayout.SOUTH); JLabel x_label = new JLabel(""); x_label.setHorizontalAlignment(SwingConstants.CENTER); x_label.addMouseListener(simple_widget); x_label.setText(simple_widget.getStringInfo()); info_panel.add(x_label); main_frame.setContentPane(top_panel); main_frame.pack(); main_frame.setVisible(true); } This is the code that has the mouseListener and mouseClick. Thanks in advance! public class SimpleFrameViewWidget extends JPanel implements MouseListener { private FrameView frame_view; private String stringInfo; public SimpleFrameViewWidget(Frame f) { setLayout(new BorderLayout()); frame_view = new FrameView(f); frame_view.addMouseListener(this); add(frame_view, BorderLayout.CENTER); JLabel title_label = new JLabel(f.getTitle()); add(title_label, BorderLayout.SOUTH); } @Override public void mouseClicked(MouseEvent e) { int x = e.getX(); int y = e.getY(); stringInfo = "X: " + x + "Y: " + y; } public String getStringInfo(){ return stringInfo; }
has comment: http://stackoverflow.com/comment/35086114
has comment: http://stackoverflow.com/comment/35086045
tagged with: mouseevent
score: 0
answer count: 1
tagged with: jframe

http://stackoverflow.com/comment/35123674
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22996846
has text: @BigAl I have tried that already and it's not showing any output. It's just not doing anything… Can it be related to the fact this is an Android application? Anything special needed for that?
score: 0

http://stackoverflow.com/q/23080945
favorite count: 0
accepted answer: http://stackoverflow.com/a/23080994
has title: java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException
upvote count: 21
possible better answer: http://stackoverflow.com/a/48299333
answer count: 4
has answer: http://stackoverflow.com/a/23080994
has body: In order to read an xlsx file I'm using apache POI, I've downloaded the zip and placed the following jsrs in my servlet location webcontent/web-inf/lib and configured build path through eclipse and my code looks as follows, import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; File uploadedFile = new File(fpath, fileName); item.write(uploadedFile); String mimeType = (Files.probeContentType(uploadedFile.toPath())).toString(); System.out.println(mimeType); if(mimeType.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")) { FileInputStream file = new FileInputStream(uploadedFile); XSSFWorkbook workbook = new XSSFWorkbook(file); for (int i =0; i &lt; workbook.getNumberOfSheets(); i++) { XSSFSheet sheet = workbook.getSheetAt(i); Iterator&lt;Row&gt; row = sheet.iterator(); while(row.hasNext()) { Iterator&lt;Cell&gt; cellIterator = ((Row) row).cellIterator(); while(cellIterator.hasNext()) { Cell cell1 = cellIterator.next(); switch(cell1.getCellType()) { case Cell.CELL_TYPE_BOOLEAN: System.out.print(cell1.getBooleanCellValue() + "\n"); break; case Cell.CELL_TYPE_NUMERIC: System.out.print(cell1.getNumericCellValue() + "\n"); break; case Cell.CELL_TYPE_STRING: System.out.print(cell1.getStringCellValue() + "\n"); break; } } Though this does not show and errors on eclipse it shows the following errors when I try to run the code What is my mistake? How to solve this?
tagged with: apache-poi
downvote count: 0
has answer: http://stackoverflow.com/a/59777570
has answer: http://stackoverflow.com/a/23081013
type: AnsweredQuestion
score: 21
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/48299333

http://stackoverflow.com/q/23020009
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/23020462
has body: I have an JEditorPane using styledDocument. My problem is caused by newlines. Because I am making application for windows, newline is represented by (CR LF). Problem is that chartAt(int) method on text extracted form editor kit counts newlines as two characters but setCharacterAttributes(int, int, AttributeSet, boolean) method on styledDocument counts newlines as one character. So suppose I want to apply attribute set on all characters "福". Simple and intuitive: String text; //set to text of JEditorPane StyledDocument doc; //set to doc of JEditorPane int length = text.length(); for (int iii = 0; iii &lt; length; iii++) { if (text.chartAt(iii) == '福') doc.setCharacterAttributes(iii, 1, AttributeSet, boolean); } It will work only until first newline. then it gets one char off, and one more char with each newline. how can I work with consistent character position?
has title: character position ambiguity java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35165574
has answer: http://stackoverflow.com/a/23020462
tagged with: java
has answer: http://stackoverflow.com/a/23020958
has comment: http://stackoverflow.com/comment/35178048
tagged with: swing
type: Question
possible better answer: http://stackoverflow.com/a/23020958

http://stackoverflow.com/comment/35128831
has text: Did all that, and it didn't work. After cleaning the project R.java was not regenerated.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23000090
type: Comment

http://stackoverflow.com/a/23016215
answers question: http://stackoverflow.com/q/23015377
type: Answer
accepted answer of: http://stackoverflow.com/q/23015377
has comment: http://stackoverflow.com/comment/35158222
has comment: http://stackoverflow.com/comment/35157728
score: 0
type: AcceptedAnswer
has body: Not very nice but actually working: StackPanel: import java.util.Random; public class StackPanel extends javax.swing.JPanel { Random rnd = new Random(); MyStack stack = new MyStack(); private int top; public StackPanel() { initComponents(); clearLabels(); } private void clearLabels() { label1.setText(""); label2.setText(""); label3.setText(""); label4.setText(""); label5.setText(""); } private void setTopTextField(String topValue) { if (top == 0) { label1.setText(topValue); } else if (top == 1) { label2.setText(topValue); } else if (top == 2) { label3.setText(topValue); } else if (top == 3) { label4.setText(topValue); } else if (top == 4) { label5.setText(topValue); } } /** * 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() { jTextField6 = new javax.swing.JTextField(); pushButton = new javax.swing.JButton(); popButton = new javax.swing.JButton(); label5 = new javax.swing.JTextField(); label4 = new javax.swing.JTextField(); label3 = new javax.swing.JTextField(); label2 = new javax.swing.JTextField(); label1 = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jTextField6.setText("jTextField6"); pushButton.setText("Push"); pushButton.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { pushButtonMouseClicked(evt); } }); popButton.setText("Pop"); popButton.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { popButtonMouseClicked(evt); } }); jLabel1.setText(" top"); jLabel2.setText("top"); jLabel3.setText("top"); jLabel4.setText("top"); j…

http://stackoverflow.com/comment/35224643
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23052823
type: Comment
has text: @apines Two things. First: `context.getBean()` gets the bean directly from the context. `@Resource`, on the other hand, is processed by a `BeanPostProcessor` (read the various javadoc links). That `BeanPostProcessor` is only registered if the `javax.annotation.Resource` class is found on the classpath at run time. In your case it isn't, so no such `BeanPostProcessor` is registered and therefore the `@Resource` field remains unprocessed. As I said in my answer, it seems you are providing the class at compilation time, but not at run time.

http://stackoverflow.com/comment/35130711
type: AnswerComment
type: Comment
has text: So back to my original comment, pass the reference of `page` to the `constructor` of `button`...
comment on: http://stackoverflow.com/a/23000927
score: 0

http://stackoverflow.com/comment/35538758
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23049498
score: 0
has text: A long shot - it looks from the stacktrace like Hibernate is trying to deserialize a varbinary. Do you have any embedded types?

http://stackoverflow.com/comment/81738769
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23063591
has text: I had a similar problem, but instead of accesing the class with the methods above, I just added in the dependencies, the package which contains the class. Isn't the same scenario?
score: 0

http://stackoverflow.com/comment/35190889
has text: i worked it out! my problem was that it was toggling with every change at modulo 2, so i just needed to make it modulo 4 and increment count every time it creates a new list so it doesnt sit on x % 4 = 0 for ever, creating new lists with each piece of data.. ergh, that was annoying!
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23033263

http://stackoverflow.com/q/22969219
type: Question
tagged with: jakarta-ee
tagged with: ejb
downvote count: 0
accepted answer: http://stackoverflow.com/a/22983362
tagged with: glassfish
answer count: 1
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/22983362
has body: This might be a very noob J2EE question... It's related to how EJB's talk with the "front-end" WAR in Glassfish (or any app server, I suppose). A package called "EJB" has a class called "Car" - it is an @Entity and maps to a table in the database. Easy. From what I see, the EJBs instantiate these Entity objects (e.g. instances of a Car) and fulfill RPC requests from the WAR/servlet. Here's the problem/question... From what I've seen, most people make a "model" package that consists of a bunch of POJO classes that represent the interface between the EJBs and the WAR... This is annoying because now I have to write all of these POJOs by hand. E.g. a rewrite of the "Car" class + a translation from the Entity to the "model" class. Is it not possible to send the Entity (JPA class) directly to the WAR from the EJB??
type: AnsweredQuestion
score: 1
tagged with: java
has title: J2EE - Pass entity directly to WAR

http://stackoverflow.com/comment/35212750
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23045310
type: AnswerComment
has text: No, it's not quite the same. `<T>` doesn't imply a return type; it only indicates that one is allowing a generic type to be passed in. That's also the *only* way you'll get a generic type of anything into that method (unless the class is also declared generic of type `T`). If you don't provide `T` as a type parameter, Java will believe that an object called `T` exists, and will try to find it - only to (hopefully!) fail at compilation time. Or worse - if you left them as raw types, you would have to do type casts since you'd only have `Object` to work with.

http://stackoverflow.com/comment/35270676
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23052480
has text: @СергійТанченко That method you have suggested is not really working for me, I have already tried that method. anyways thank you for your answer. Appreciate a lot.

http://stackoverflow.com/comment/35149063
type: AnswerComment
type: Comment
has text: ok, just editted my answer, check if the output of "tasklist" contains any lines, after your app is closed
comment on: http://stackoverflow.com/a/23011579
score: 0

http://stackoverflow.com/a/23051463
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23049250
answers question: http://stackoverflow.com/q/23049250
type: Answer
upvote count: 1
score: 1
has body: Instead of using SetLinearVelocity, try using ApplyForce or ApplyImpulse to move things around. The problem is that SetLinearVelocity allows you to create unrealistic situations, for example in this case when the ball hits the wall it should stop and the horizontal velocity really should be zero, but you are overriding the natural result and saying that the ball did not stop at all, and it is still moving. Note that you may still get this problem even when using ApplyForce or ApplyImpulse, if the force is strong enough and there is enough friction between the fixtures (just like in the real world, if you push something against a wall hard enough and the surfaces are not too slippery, you can stop it from falling).
has comment: http://stackoverflow.com/comment/35221765

http://stackoverflow.com/comment/35089192
has text: Hmm, works for me. Anyways, use the full path on your system then. Keep in mind that file paths are system *dependent*, so running it on a Windows machine will have different results than a Mac/Unix machine.
type: Comment
comment on: http://stackoverflow.com/a/22978254
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35125420
type: AnswerComment
comment on: http://stackoverflow.com/a/22997954
score: 0
type: Comment
has text: @azar The GC is simply lazy and won't collect anything until it hits an "allocation failure" within Eden Space, whose initial size is many megabytes.

http://stackoverflow.com/comment/35205314
type: Comment
comment on: http://stackoverflow.com/q/23039505
score: 0
type: QuestionComment
has text: thats what i am asking,maybe i ask the right question(my communication skill are poor).

http://stackoverflow.com/q/22988859
tagged with: abstract
answer count: 3
possible better answer: http://stackoverflow.com/a/22988924
has answer: http://stackoverflow.com/a/22988916
accepted answer: http://stackoverflow.com/a/22988916
has title: Multiple object types in one ArrayList
favorite count: 0
tagged with: instanceof
score: 6
has body: I have an abstract class called User, a user can be created either as a Student type or as a Teacher type. I have made an ArrayList of users (of students and teachers) and what I am trying to do is call a method example depending on what the current object is an instance of: for (User user : listOfUsers) { String name = user.getName(); if (user instanceof Student) { // call getGrade(); } else { // it is an instance of a Teacher // call getSubject(); } } The problem I'm having is because it is an ArrayList of User objects, it can't get the Student type method, for example, getGrade(). However, because I am able to determine what the current user is an instance of, I'm curious as to whether or not it is still possible to call a specific method depending on what type of user it is. Is this possible, or do I have to separate the user types into separate lists? Please reply soon, many thanks.
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/22989195
tagged with: java
has answer: http://stackoverflow.com/a/22988924
type: Question
upvote count: 6
tagged with: arraylist
tagged with: abstract-class

http://stackoverflow.com/a/23049914
has body: Maybe you are using Eclipse as IDE and trying to run code that doesn't compile. Check your Problems view in Eclipse, and fix the compilation errors before executing the application.
score: 0
answers question: http://stackoverflow.com/q/23049832
type: Answer

http://stackoverflow.com/a/23090127
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23089850
has comment: http://stackoverflow.com/comment/82420360
answers question: http://stackoverflow.com/q/23089850
has body: Your Socket connection is blocking the Event Dispatch Thread(EDT) so the GUI can't repaint itself. You need to create a separate Thread to do the Socket connection. Read the section from the Swing tutorial on Concurrency for more information and a solution that uses a Swing Worker.
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/23123118
tagged with: maven
accepted answer: http://stackoverflow.com/a/23123301
has body: I'm new to Spring and am trying to set up a project using JPA and Maven. I can't seem to figure out the right configuration between the different xml files needed. I've seen that many questions have been posted on this, and I've tried using code from the posted solutions, but I keep getting different errors all leading up to IllegalStateException: Failed to load ApplicationContext in the JUnit test I'm trying to run. Here is my persistence.xml which I've placed in the META-INF folder of src/main/resources: <?xml version="1.0"?> Here is the production-application.xml file: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <tx:annotation-driven/> <context:component-scan base-package="com.kylewalker.wellness"/> Here is the POM, which might be greatly bloated because I've had a hard time figuring out exactly which dependencies are necessary and which are not: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.kylewalker wellness 1.0 war wellness A business magagement tool for a wellness organization offering services such as massage, nutrition counseling, etc. org.eclipse.persistence org.eclipse.persistence.jpa 2.5.0 junit junit 4.11 test commons-dbcp commons-dbcp 1.4 org.springframework spring-context 4.0.3.RELEASE org.springframework spring-core 4.0.3.RELEASE org.springframework …
tagged with: spring
has comment: http://stackoverflow.com/comment/35351710
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35351593
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35351132
has title: Setting up Spring with JPA and Maven
has comment: http://stackoverflow.com/comment/35351299
type: Question
has comment: http://stackoverflow.com/comment/35364514
has answer: http://stackoverflow.com/a/23123301
score: 0
answer count: 1
tagged with: jpa
linked to: http://stackoverflow.com/q/8961275

http://stackoverflow.com/q/23089700
has answer: http://stackoverflow.com/a/23090313
tagged with: java
upvote count: 26
type: Question
score: 26
downvote count: 0
has answer: http://stackoverflow.com/a/23089939
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/23090313
answer count: 3
has title: Deploy WAR or "fat" JAR?
has body: I'm noticing a lot of projects (DropWizard, Grails, etc.) starting to embrace the notion of a "fat" JAR (using an embedded web server like Jetty or Tomcat) vs. the traditional WAR deploy. Both methods involve a single JVM process (i.e. no matter how many WARs are deployed to Tomcat, it's all the same JVM process). Under what circumstances is either deployment method preferable over the other?
tagged with: deployment
tagged with: jvm
possible better answer: http://stackoverflow.com/a/23089929
favorite count: 0
has comment: http://stackoverflow.com/comment/55545133
has answer: http://stackoverflow.com/a/23089929
has comment: http://stackoverflow.com/comment/55545333
tagged with: war
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/55545330

http://stackoverflow.com/comment/35114217
type: QuestionComment
comment on: http://stackoverflow.com/q/22992039
score: 0
has text: Possible duplicates: http://stackoverflow.com/questions/302977/tomcat-vs-jetty?rq=1 and http://stackoverflow.com/questions/8329254/tomcat-7-vs-jetty?rq=1
type: Comment

http://stackoverflow.com/comment/35258966
comment on: http://stackoverflow.com/a/23071665
type: AnswerComment
has text: I'm sitting here laughing at myself for overlooking that. I figured it was something simple, but completely missed it. Thank you very much! I added the break statements and it works great!
score: 0
type: Comment

image-processing
tags question: http://stackoverflow.com/q/23123336
tags question: http://stackoverflow.com/q/22984465
type: Tag
tags question: http://stackoverflow.com/q/23016194
tags question: http://stackoverflow.com/q/23081625
tags question: http://stackoverflow.com/q/23003753
tag name: image-processing
tags question: http://stackoverflow.com/q/22977986
tags question: http://stackoverflow.com/q/23028037

http://stackoverflow.com/comment/35316209
has text: No the error doens't come from name attribution, I just changed when i posted here bcz it was in french.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23103974
score: 0

http://stackoverflow.com/comment/35104576
type: QuestionComment
comment on: http://stackoverflow.com/q/22987084
score: 1
type: Comment
has text: You need to tell us what happens? (And quite often _explaining_ the problem to someone else leads you to the solution yourself.)

http://stackoverflow.com/q/23025461
type: Question
has body: I am using eclipse Indigo Service Release 2 with JBoss tools installed and created a Seam Web project with Maven integration selected. After the project is created, I got this error in my pom.xml file, does anybody know how to resolve it? thanks Error resolving version for plugin 'org.codehaus.mojo:maven-war-plugin' from the repositories [local (C:\Users\Jon\.m2\repository), jboss-public-repository-group (https://repository.jboss.org/nexus/content/groups/public/), central (http://repo1.maven.org/maven2)]: Plugin not found in any plugin repository I also tried to create a new Seam web project with Maven integration again, this is the step I followed: http://docs.jboss.org/tools/nightly/trunk/en/seam/html/create_mavenized_seam.html#create_mavenized_project After the project is created, I got these error in eclipse api, all are related to pom.xml (with a red sign) Missing artifact org.jboss.tools:Maven2:war:0.0.1-SNAPSHOT Project build error: 'dependencies.dependency.version' for org.jboss.spec.javax.faces:jboss-jsf- api_2.0_spec:jar is missing. Project build error: Non-resolvable import POM: Failure to transfer org.jboss.spec:jboss-javaee-web-6.0:pom:${javaee6.web.spec.version} from https://repository.jboss.org/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss-public-repository-group has elapsed or updates are forced. Original error: Could not transfer artifact org.jboss.spec:jboss-javaee-web-6.0:pom:${javaee6.web.spec.version} from/to jboss-public-repository-group (https://repository.jboss.org/nexus/content/groups/public/): Illegal character in path at index 94: https://repository.jboss.org/nexus/content/groups/public/org/jboss/spec/jboss-javaee-web-6.0/ ${javaee6.web.spec.version}/jboss-javaee-web-6.0-${javaee6.web.spec.version}.pom No sure why I got different error each time, I use eclipse indigo new version 64big downloaded here:https://www.eclipse.org/downloads/packages/eclipse-i…
tagged with: java
tagged with: jboss
tagged with: eclipse
answer count: 1
has answer: http://stackoverflow.com/a/23028004
type: UnansweredQuestion
has title: Error resolving version for plugin 'org.codehaus.mojo:maven-war-plugin' from the repositories
score: 0
has comment: http://stackoverflow.com/comment/35189963
tagged with: maven

http://stackoverflow.com/q/23087533
answer count: 2
has answer: http://stackoverflow.com/a/23089207
downvote count: 1
has body: I was programing in Python but now I want to do the same code in Java. Can you help me please? This is the code that I was working on import random import re a = "y" while a == "y": i = input('Search: ') b = i.lower() word2 = "" for letter in b: lista = [] with open('d:\lista.txt', 'r') as inF: for item in inF: if item.startswith(letter): lista.append(item) word = random.choice(lista) word2 = word2 + word print(word2) a = input("Again? ") Now I want to do the same on Java but Im not really sure how to do it. Its not that easy. Im just a beginner. So far I founded a code that makes the search in a text file but I'm stuck. This is the java code. It finds the position of the word. I've been trying to modify it without the results Im looking for. import java.io.*; import java.util.Scanner; class test { public static void main(String[] args){ Scanner input = new Scanner(System.in); System.out.println("Search: "); String searchText = input.nextLine(); String fileName = "lista.txt"; StringBuilder sb = new StringBuilder(); try { BufferedReader reader = new BufferedReader(new FileReader(fileName)); while (reader.ready()) { sb.append(reader.readLine()); } } catch(IOException ex) { ex.printStackTrace(); } String fileText = sb.toString(); System.out.println("Position in file : " + fileText.indexOf(searchText)); } } What I want is to find an item in a text file, a list, but just want to show the items that begin with the letters of the string I want to search. For example, I have the string "urgent" and the text file contains: baby redman love urban gentleman game elephant night todd So the display would be "urban"+"redman"+"gentleman"+ until it reaches the end of the string.
favorite count: 0
has title: Searching for strings in a text file
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35287458
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35286705
score: -1
has answer: http://stackoverflow.com/a/23088695

http://stackoverflow.com/comment/36257533
type: AnswerComment
comment on: http://stackoverflow.com/a/23089706
score: 0
has text: @Dilshan, I'm not the person who ran into the issue - I'm someone who attempted to help the OP.
type: Comment

http://stackoverflow.com/comment/35345477
type: Comment
has text: i have added the code for the actionListeners
type: QuestionComment
comment on: http://stackoverflow.com/q/23119830
score: 0

http://stackoverflow.com/q/22984625
has answer: http://stackoverflow.com/a/22987178
tagged with: java
accepted answer: http://stackoverflow.com/a/22987178
type: AnsweredQuestion
has title: post image with text to linkedIn from android app
tagged with: linkedin-api
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android
upvote count: 1
answer count: 1
has body: I want to post image from SD Card with text to linkedIn from my android app. I could share text but image is not sharing. I tried with following code: share.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String share = et.getText().toString(); if (null != share && !share.equalsIgnoreCase("")) { OAuthConsumer consumer = new CommonsHttpOAuthConsumer(Config.LINKEDIN_CONSUMER_KEY, Config.LINKEDIN_CONSUMER_SECRET); consumer.setTokenWithSecret(accessToken.getToken(), accessToken.getTokenSecret()); DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost post = new HttpPost("https://api.linkedin.com/v1/people/~/shares"); try { consumer.sign(post); } catch (OAuthMessageSignerException e) { e.printStackTrace(); } catch (OAuthExpectationFailedException e) { e.printStackTrace(); } catch (OAuthCommunicationException e) { e.printStackTrace(); } // here need the consumer for sign in for post the share post.setHeader("content-type", "text/XML"); byte[] data = null; try { ileInputStream fis = new FileInputStream(imgUrl1); Bitmap bi = BitmapFactory.decodeStream(fis); ByteArrayOutputStream baos = new ByteArrayOutputStream() bi.compress(Bitmap.CompressFormat.JPEG, 100, baos); data = baos.toByteArray(); } catch (FileNotFoundException e) { e.printStackTrace(); Log.d("onCreate", "debug error e = " + e.toString()); } String myEntity = " "+ text +" data anyone "; try { post.setEntity(new StringEntity(myEntity)); org.apache.http.HttpResponse response = httpclient.execute(post); Toast.makeText(LinkedInSampleActivity.this, "Shared sucessfully", Toast.LENGTH_SHORT).show(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }else { Toast.makeText(LinkedInSampleActivity.this, "Please enter the text to share", Toast.LENGTH_SHORT).show(); } } }); }

http://stackoverflow.com/comment/35292161
type: QuestionComment
has text: Fake Buttons 2: use a JTable to hold your buttons. This also begs the question of why: why the need for many JButtons as this might affect the approach to your solution.
comment on: http://stackoverflow.com/q/23090427
score: 0
type: Comment

http://stackoverflow.com/comment/35291917
has text: I need sth. like this: (http://stackoverflow.com/questions/370114/how-can-i-add-a-context-menu-to-the-windows-explorer-for-a-java-application). The problem is, as I described above, that my Java prog. is already running. How could I pass the filepath? I already thought about a second Java prog that catches the filepath and communicates with the running prog (about RMI etc.). But I don't really like that kind of solution...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23054989
type: Comment

http://stackoverflow.com/q/23115597
tagged with: overloading
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24730783
tagged with: java
has comment: http://stackoverflow.com/comment/35336655
type: Question
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/23115649
has body: I have been asked this question in an interview. can anyone explain it. public class A{ public void show(List &lt;String&gt;list1,List&lt;Integer&gt;lists2){...} public void show(List &lt;Integer&gt;list1,List&lt;String&gt;lists2){...} } public class B{ public static void main(..){ A a=new A(); List&lt;String&gt; list1; List&lt;Integer&gt;lists2; a.show(list1,lists2); } } I said 2 function would be called.. but when i worte in neatbeans it gave error of same name function been called...??? why so isnt overloading concept used here???
has answer: http://stackoverflow.com/a/23115839
accepted answer: http://stackoverflow.com/a/23115839
has answer: http://stackoverflow.com/a/23115649
has title: Java Overloading

http://stackoverflow.com/comment/35188253
type: AnswerComment
type: Comment
score: 0
has text: I think in the end I will use the same method for code consistency but thanks for your help. I updated how I did it in the end.
comment on: http://stackoverflow.com/a/23022668

http://stackoverflow.com/comment/35195933
comment on: http://stackoverflow.com/a/23027751
type: Comment
has text: It works fine for valid IP Address case. One last question, If the IP Address is not valid, I would like to show some error JSP page meaning you are not authorized to see this page. In your example you only have `ForbiddenException` which just get thrown. Is there any way I can show proper message to the user so that they can understand that they are not authorized to see this page?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35262777
has text: you're right. I meant, getXML().toString() returns null. getXML() is not null. Any ideas why ?
score: 0
comment on: http://stackoverflow.com/q/23073304
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23057310
tagged with: android
has answer: http://stackoverflow.com/a/23064708
has title: Read Ydata from video frame
tagged with: video
tagged with: java
has body: I want to read Y(Luminance data from consecutive frames of an .mp4 file) in java code. How can i be able to do that.It is good if i don't have to use any media library like ffmpeg/opencv.Actually i am applying the following simple blockiness algorithm on the .mp4 file. 1.Luminance gradient image is first segmented into blocks of 32×32 pixels. 2.Each block is then Fast Fourier transformed into frequency domain. 3.Following this, we measure the ratio of the sum of harmonics to the sum of all the AC components,in both the horizontal and vertical orientations. The ratios serve as an indication of the severity of the blocking artefacts. Any pointers on code samples(fft,measuring sum of harmonics of fft) Regards, Mayank
type: Question
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/71007548
has text: I agree with Bex. Sort is actually not a bad idea in my opinion. It's easy to implement and has a O(nlogn) time complexity and O(1) space. While use hashmap and priorityqueue has O(nlogn) time complexity and O(n) space. Since insert into a pq is O(logn), iterate the entries of Hashmap and insert them into pq is O(nlogn) in worst cases. Correct me if I'm wrong. http://docs.oracle.com/javase/7/docs/api/java/util/PriorityQueue.html
type: AnswerComment
comment on: http://stackoverflow.com/a/22990163
score: 0
type: Comment

http://stackoverflow.com/comment/35086406
comment on: http://stackoverflow.com/q/22976698
has text: You also haven't specified a type for certificate... add that, and declare your method's return type to match that. (presumably double)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23105514
accepted answer of: http://stackoverflow.com/q/23103235
answers question: http://stackoverflow.com/q/23103235
has body: You can leverage the @JsonAnySetter/ @JsonAnyGetter annotations, as described in this blog post. Since, as you mentioned, your custom map class must implement a Map interface, you could extract a separate "bean" interface and tell Jackson to use it instead when serializing via @JsonSerialize(as = ...) annotation. I've slightly modified you example to illustrate how it could work. Note that if you want to deserialize the json string back to your map object, you may need to do some other tricks. public class MapSerialize { public static interface MyInterface { String getSpecialInfo(); @JsonAnyGetter Map&lt;String, String&gt; delegate(); } @JsonSerialize(as = MyInterface.class) public static class MyImpl extends ForwardingMap&lt;String, String&gt; implements MyInterface { private String specialInfo; private HashMap&lt;String, String&gt; delegate = new HashMap&lt;String, String&gt;(); public Map&lt;String, String&gt; delegate() { return this.delegate; } @Override public String getSpecialInfo() { return specialInfo; } public void setSpecialInfo(String specialInfo) { this.specialInfo = specialInfo; } @Override public String put(String key, String value) { return delegate.put(key, value); } } public static void main(String[] args) throws IOException { ObjectMapper mapper = new ObjectMapper(); MyImpl objectOfMapImpl = new MyImpl(); objectOfMapImpl.setSpecialInfo("specialInfo"); objectOfMapImpl.put("XXX", "YYY"); String json = mapper.writeValueAsString(objectOfMapImpl); System.out.println(json); } }
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35321172
has comment: http://stackoverflow.com/comment/35319096
has comment: http://stackoverflow.com/comment/36154881
type: Answer
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/36154567

http://stackoverflow.com/a/23088014
type: Answer
answers question: http://stackoverflow.com/q/23087491
has body: Your log cat points to an SQL Syntax Error.So for solving just change this line. private static final String DATABASE_CREATE = "create table " + TABLE_NAME + "( " + ID + " integer primary key autoincrement, " + SERIAL + " text not null, " + OBSERVATIONS + " text not null, " + TIR + " text not null" + ", " + X + " text not null " + Y + " text not null, " + NETWORKNUMBER + " text not null, " + POTENCIA + " text not null, " + COLUMNNR + " text not null, " + COLUMN + " text not null, " + LAMP + " text not null, " + ARMOR + " text not null, " + LAMPSTATE + " text not null);"; WITH THIS private static final String DATABASE_CREATE = "create table " + TABLE_NAME + "( " + ID + " integer primary key autoincrement, " + SERIAL + " text not null, " + OBSERVATIONS + " text not null, " + TIR + " text not null" + ", " + X + " text not null, " + Y + " text not null, " + NETWORKNUMBER + " text not null, " + POTENCIA + " text not null, " + COLUMNNR + " text not null, " + COLUMN + " text not null, " + LAMP + " text not null, " + ARMOR + " text not null, " + LAMPSTATE + " text not null);";
score: 0

http://stackoverflow.com/comment/35382143
type: AnswerComment
score: 0
type: Comment
has text: Ok, just asked because you said that you cleaned up the code and used other commands than setBounds, but nevermind then.
comment on: http://stackoverflow.com/a/23122326

http://stackoverflow.com/a/23110183
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23109953
has comment: http://stackoverflow.com/comment/35497674
downvote count: 0
has body: As I mentioned in my comment to your question: Don't publish file: URIs to HTML documents. Use relative URIs or absolute URIs with respect to the site's root instead. Google on the difference of relative and absolute URIs when it comes to publishing web sites for details. Now, if you are so bent over using file: URIs, then you might want to try to get the canonical path. Hell, the canonical path is the preferred type of path one would want to use to publish file locations (except when publishing on the web as I mentioned before): // java-like pseudocode: String myFile = ... // some path, relative or absolute, to a file in an accessible file system URI = (new File(myFile)).getCanonicalFile().toURI(); Check the Oracle/Sun javadoc information on File and getCanonicalFile/getCanonicalPath for details. This might still not solve the issue since you are mentioning the HTML parser treats file: URIs as relative (but you do not mention what HTML parser you are using.) At the end of the day, you will do better with publishing URLs relative to your documents' root instead of using file: URIs. Those URIs were never meant to be used like that.

http://stackoverflow.com/comment/35117486
type: QuestionComment
type: Comment
has text: @T.J.Crowder Again, what does "from" mean? Does that mean it attempts to connect to a socket server on that port? If so, why not "to"?
score: 0
comment on: http://stackoverflow.com/q/22993938

http://stackoverflow.com/comment/35306083
comment on: http://stackoverflow.com/q/23097890
has text: You haven't imported them?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35237149
type: Comment
type: QuestionComment
has text: Looks like a type conversion error as Pravin says, although without further info, it's impossible to know. But phone numbers aren't really numbers.
comment on: http://stackoverflow.com/q/23048532
score: 0

http://stackoverflow.com/q/23116556
tagged with: pom.xml
has answer: http://stackoverflow.com/a/23116557
has answer: http://stackoverflow.com/a/76019468
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/71858172
score: 20
has answer: http://stackoverflow.com/a/49758047
has answer: http://stackoverflow.com/a/28634824
has answer: http://stackoverflow.com/a/54458150
has answer: http://stackoverflow.com/a/71960195
tagged with: testng
type: AnsweredQuestion
has body: When trying to run a test as a TestNG suite, I would get a very cryptic error message saying that TestNG can't launch because it references a non-existant project. I think my project does exist, I see it in the package explorer!
tagged with: java
accepted answer: http://stackoverflow.com/a/23116557
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/62690796
upvote count: 20
has answer: http://stackoverflow.com/a/51144165
has answer: http://stackoverflow.com/a/47168958
has answer: http://stackoverflow.com/a/40116014
has answer: http://stackoverflow.com/a/36146974
has answer: http://stackoverflow.com/a/62816650
has answer: http://stackoverflow.com/a/46772424
answer count: 14
has title: Eclipse -- Testng references non-existing project XXX, launch configuration
possible better answer: http://stackoverflow.com/a/36146974
downvote count: 0

http://stackoverflow.com/a/23007616
has body: int[] numbers = { 1, 2, 3, 4, 5, 6 }; reverse(numbers, 1); &gt;2,1,3,4,5 reverse(numbers, 2); &gt;3,2,1,4,5 public int[] reverse(int[] numbers, int value) { int index = 0; for (int i = 0; i &lt; numbers.length; i++) { int j = numbers[i]; if (j == value) { index = i; break; } } int i = 0; int[] result = new int[numbers.length]; int forIndex = index + 1; for (int x = index + 2; x &gt; 0; x--) { result[i] = numbers[forIndex--]; ++i; } for (int x = index + 2; x &lt; numbers.length; x++) { result[i] = numbers[x]; ++i; } return result; }
score: 0
answers question: http://stackoverflow.com/q/23006962
type: Answer

http://stackoverflow.com/comment/35166101
comment on: http://stackoverflow.com/q/23020493
type: Comment
type: QuestionComment
has text: Fails to compile on [JDK 7 too](http://ideone.com/Hon4E1). Seems like a bug that has been fixed in Java 8.
score: 1

http://stackoverflow.com/comment/35333370
type: QuestionComment
comment on: http://stackoverflow.com/q/23113668
type: Comment
has text: @Tukajo posted see edit
score: 0

http://stackoverflow.com/q/23010286
has comment: http://stackoverflow.com/comment/35148467
type: UnansweredQuestion
tagged with: selenium
has body: I'd like to run my selenium tests in Internet Explorer but the IE WebDriver not run well. If I pressed the delete button then I got a confirmation popup and in this case, the webdriver loose the control Selenium version: 2.39.0 jUnit version: 4.11 Internet Explorer: 10 Has anyone an idea? Thanks.
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35151428
has title: Selenium InternetExplorer webdriver not run
answer count: 0

http://stackoverflow.com/a/23060253
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: What you probably want to do is extend your "Constructor" from JPanel, not JFrame. And add following to your Init(): add(constructor); JFrame is basically a class for Window creation. As i can see you don't need another window but you want elements to appear in your Init() window.
answers question: http://stackoverflow.com/q/23060067

http://stackoverflow.com/q/23073284
has answer: http://stackoverflow.com/a/23073490
has comment: http://stackoverflow.com/comment/35262075
has comment: http://stackoverflow.com/comment/35262103
answer count: 1
accepted answer: http://stackoverflow.com/a/23073490
has comment: http://stackoverflow.com/comment/35261917
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35262074
score: 0
has body: I am trying to reverse the order of a sub-array between the indices of start and end strictly using recursion. For example, if the subarray is 1,2,3,4 , it will become 4,3,2,1. However, I am getting the following runtime error: java.lang.ArrayIndexOutOfBoundsException: -1 at finalExam.reverse(finalExam.java:13) at finalExam.reverse(finalExam.java:17) I am not sure how to fix this problem. Thanks. double[] reverse (double[] a, int start, int end) { if (start == end) {return a;} else { a[start] = a[end]; a[end] = a[start];} return reverse (a, start+1, end-1); }
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35262154
has title: Reversing the order of sub-array using Recursion

http://stackoverflow.com/q/23121028
tagged with: tomcat
type: UnansweredQuestion
has body: I am developing a web application using jsp in Eclipse. I have put the java files needed by the jsp in a project and set the output folder, so it compiles successfully. My project requires to read data from some dat files, I do not know where to keep them? P.S. Those files are big ~500MB
has comment: http://stackoverflow.com/comment/35346961
tagged with: java
type: Question
tagged with: eclipse
has title: Where to put 'dat' files need by JSP Web Application
score: 0
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/23121206

http://stackoverflow.com/comment/35205077
has text: Do something like this: Create an async task and load the bitmap in doInBackground, pass the bitmap to the onPostExecute method then set the marker with that bitmap.
type: Comment
comment on: http://stackoverflow.com/a/23042491
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35223838
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23052662
type: Comment
has text: Input/OutputStreams operate on bytes. Readers/Writers interpret those bytes as characters and can deal with character encodings. It took me a long time to remember this at first for some reason; an easy way to remember is that you read books and write stories - those ones are for text.

http://stackoverflow.com/comment/35221550
comment on: http://stackoverflow.com/q/23051306
type: Comment
type: QuestionComment
score: 0
has text: @GaryTsui Yes can't be done in less than O(n^2)

http://stackoverflow.com/comment/35339400
score: 0
has text: Thanks Bill. I have one final question, if you want to send some byte arrays, then the answer I suppose is use 1) wrap everything in a MimeMessage , as MimeMultiPart may not serialize/deserialize correctly 2) use getInputStream instead of getRawInputStream ( both of them should be the same for byte arrays in theory).
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23095061

http://stackoverflow.com/q/23117098
score: 0
has body: I am using following code to send E-mail: Properties props = new Properties(); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("sender@gmail.com","123456"); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress("sender@gmail.com")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("reciever@gmail.com")); message.setSubject("Testing Subject"); message.setText("Dear Mail Crawler," + "\n\n No spam to my email, please!"); Transport.send(message); System.out.println("Done"); } catch (MessagingException e) { throw new RuntimeException(e); } I have already required .jar with my android project. No exception was there but i didn't get any Email. Logcat of Android: 04-16 23:40:08.972 18170-18170/com.coderwall.executer W/System.err﹕ android.os.NetworkOnMainThreadException 04-16 23:40:08.972 18170-18170/com.coderwall.executer W/System.err﹕ at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1126) 04-16 23:40:08.972 18170-18170/com.coderwall.executer W/System.err﹕ at java.net.InetAddress.lookupHostByName(InetAddress.java:385) 04-16 23:40:08.972 18170-18170/com.coderwall.executer W/System.err﹕ at java.net.InetAddress.getLocalHost(InetAddress.java:365) 04-16 23:40:08.972 18170-18170/com.coderwall.executer W/System.err﹕ at javax.mail.internet.InternetAddress.getLocalHostName(InternetAddress.java:563) 04-16 23:40:08.972 18170-18170/com.coderwall.executer W/System.err﹕ at javax.mail.internet.InternetAddress._getLocalAddress(InternetAddress.java:542) 04-16 23:40:08.982 18170-18170/com.coderwall.executer W/System.err﹕ at javax.ma…
tagged with: android
has title: Not able to send Email using javax in android app
has answer: http://stackoverflow.com/a/23117228
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jakarta-mail
answer count: 1
accepted answer: http://stackoverflow.com/a/23117228
tagged with: smtp

http://stackoverflow.com/comment/35228845
comment on: http://stackoverflow.com/a/23055536
has text: That means that JPA is definitely being used. Check the rest of my answer to see if Hibernate is being used as well
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/23020629
has body: You'll notice your method is annotated with @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) The consumes is a restriction for the @RequestMapping saying that this method will only handle requests that have a Content-Type of application/json. Your request doesn't seem to have that header. You need to add it.
type: Answer
score: 6
upvote count: 6
answers question: http://stackoverflow.com/q/23020532
downvote count: 0

http://stackoverflow.com/comment/35425844
type: Comment
has text: Try to edit the script file and delimit a line, append the ^ character to the line. Eg: line1 ^ line2 ^
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23114286

http://stackoverflow.com/comment/35082860
type: AnswerComment
type: Comment
has text: @JoroSeksa then tune it up: check if you can add more indexes to database relevant to your query, add more RAM, check for tuning options on your database engine. Note that using concurrency on a database won't accelerate the process that much since, after all, is a disk read operation, which is slow by default.
comment on: http://stackoverflow.com/a/22974370
score: 1

http://stackoverflow.com/comment/35192829
has text: The thing I'm unable to understand is that in my college the applet is running perfectly but not at my laptop .
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23035324
type: Comment

http://stackoverflow.com/a/22970268
has body: I'm going to assume you have a non-english Locale. If you want to parse in English, use the appropriate Locale String input = "Sep 31 2013"; LocalDate localDate = LocalDate.parse(input, DateTimeFormatter .ofPattern("MMM d yyyy").withLocale(Locale.ENGLISH)); Or any other English Locale: US, CANADA, UK, etc. Alternatively, for your Locale, ru_RU, pass a Russian date String, ie. where Sep is in Russian so that it can be parsed appropriately
accepted answer of: http://stackoverflow.com/q/22970229
answers question: http://stackoverflow.com/q/22970229
type: AcceptedAnswer
downvote count: 0
score: 7
type: Answer
upvote count: 7

http://stackoverflow.com/q/23069581
tagged with: regex
has body: I want to find // which is: not preceded by a " not directly followed by a * not directly followed by span The rest of the string should be captured as well, regardless of whether or not the last two tokens are found later in the string. I have tried: //(?!span)|//(?!\\*)|(?&lt;!\")// Here is an example string that I want to find it in: handle//Button(By.xpath("//*[@id='Page1']//span[safdsaf]"), hi);
has comment: http://stackoverflow.com/comment/35255091
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35255045
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35255117
type: Question
has answer: http://stackoverflow.com/a/23069688
tagged with: java
has title: REGEX to match multiple conditions
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23069688
has comment: http://stackoverflow.com/comment/35255022
has comment: http://stackoverflow.com/comment/35255026

http://stackoverflow.com/comment/35132882
type: AnswerComment
type: Comment
has text: The type of `Locale.US` is `Locale`. The type of `t` is `Type` regardless of what `t` describes. So `t.getClass` will tell you what class it _is_, not which type it _describes_ which is `Class` because that is implementing the `Type` interface. Another way to think of it is that `t` is not a `Locale` object. You cannot call `Locale` methods like `getCountry()` on it because it's not an actual `Locale` instance. If it's not a real `Locale` then calling `getClass()` won't say that it is.
score: 0
comment on: http://stackoverflow.com/a/22994960

http://stackoverflow.com/q/23070016
type: Question
has title: In Android (or Java itself), is it possible to a class to inherit from a class referenced by name?
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/35255854
tagged with: android
accepted answer: http://stackoverflow.com/a/23070075
has comment: http://stackoverflow.com/comment/35256043
has body: Times ago, I was looking for a way to start ServiceMode programmatically. The great obstacle was how to understand the parameters that the class must receive (in its case, it is the SECRET CODES). And off course, the device must be rooted. It had demanded plenty of research but I finally figured out how to start a system activity through command line. Now I want to create a class that extends from it. However, I don't have its API reference because it is hidded in Android internals and only accessible through things like reflection. I have only its name: com.sec.android.app.servicemodeapp.ServiceModeApp. So, I'm wondering if Android/Java API let me create a class declaration in the form of: public class MyCustomSystemActivity extends Class.forName("com.sec.android.app.servicemodeapp.ServiceModeApp") { ... } Of course, this sentence is not allowed. Can someone give me a hint if it is possible in other ways? And if yes, how can I declare such thing?
has comment: http://stackoverflow.com/comment/35255851
has answer: http://stackoverflow.com/a/23070075
has comment: http://stackoverflow.com/comment/35256152
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35255953
linked to: http://stackoverflow.com/q/1886785

http://stackoverflow.com/a/23022595
has comment: http://stackoverflow.com/comment/35173208
has comment: http://stackoverflow.com/comment/35170507
type: Answer
score: 0
has body: You need to find out what is null on line 156 of ServiceSocial.java, and either find out why it's null if it's not supposed to be, or accommodate the case where it is null if null is acceptable there. Then read this: How to read and understand the java stack trace?
answers question: http://stackoverflow.com/q/23022096

http://stackoverflow.com/q/23036740
type: AnsweredQuestion
tagged with: list
possible better answer: http://stackoverflow.com/a/23036775
accepted answer: http://stackoverflow.com/a/23036900
score: 0
has answer: http://stackoverflow.com/a/23036910
tagged with: java
has answer: http://stackoverflow.com/a/23036775
type: Question
has answer: http://stackoverflow.com/a/23037096
tagged with: object
has title: Java Converting List<Vehicle> to List<Object>
has comment: http://stackoverflow.com/comment/35195538
has answer: http://stackoverflow.com/a/23036900
has comment: http://stackoverflow.com/comment/35195553
has comment: http://stackoverflow.com/comment/35195159
has body: My applications consists of Vehicle class and Customer class where I have an interface to add delete and search for each. Because of this I implemented my interface for add as follows: public void add(Object newObject, List&lt;Object&gt; myList); and therefore this accepts all objects. However when I am trying to pass a Vehicle list from my application I am getting an error as it is expecting an Object List. How can I convert my List to List and still update the lists. This is my initialized list of allVehicles. List&lt;Vehicle&gt; allVehicles = new ArrayList&lt;Vehicle&gt;(); This is the method I am using to add new Vehicle where I am getting the error on allVehicles. addNewCycle.add(addNewCycle, allVehicles); The method from the Vehicle class implemented from interface. public void add(Object newObject, List&lt;Object&gt; myList) { myList.add((Vehicle)newObject); } My question is how can I cast this list to an Object list and update it on Vehicles List.
answer count: 4

apache-pig
tags question: http://stackoverflow.com/q/23069456
tags question: http://stackoverflow.com/q/23077064
tag name: apache-pig
tags question: http://stackoverflow.com/q/23075987
type: Tag

http://stackoverflow.com/comment/107712799
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24401795
has text: @PrashanD yes it's safe, cert is generally safe to be published.

http://stackoverflow.com/q/23071516
has answer: http://stackoverflow.com/a/23866669
tagged with: jsf
tagged with: java
has title: How to track application state per user
type: Question
tagged with: jakarta-ee
has body: I want to create a state machine to track the user operations in a JavaEE Web Application. The idea is generates states after the user has executed any action on the JSF backing beans. Each new state will be added into a list on the user context and after a while an asynchronous process will persist them into the database. I want to analyse the usability of the application; basically how the user interact with it, what the user likes and what doesn't like. I'll get metrics and improve the most used features. I have researched about that, but I couldn't find any framework or a library that does that for me. Have you got any suggestions? State.java long id long userId String state Date dateTime String className String method String componentId I'm thinking in some kind of annotation and a parser, but anyway I didn't find the right answer for this requirement.
score: 0
has comment: http://stackoverflow.com/comment/35281493
answer count: 1
has comment: http://stackoverflow.com/comment/35345691
type: UnansweredQuestion

http://stackoverflow.com/comment/35076259
comment on: http://stackoverflow.com/a/22970839
has text: Thank you a lot that works. But I'm still not really getting why this doesn't work. When i am initializing a field of the type `Class<? extends Event>` with an object of the type `Class<T extends Event>` what actually works, wouldn't that have the same error?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22975152
has comment: http://stackoverflow.com/comment/35085309
has body: It depends on the data you want to store in the tree. Let's assume you want to store an object, string or some other complex data type in the tree. Then you have 2 pointers (one for ever object) and 3 pointers for the children. The node needs the space even though the pointer are not initialized/point to null. So you have a memory usage of 1/5. Example: Image you have the following class: class Node { Object data1 = new Data(); Object data2 = null; Node child1 = null; Node child2 = null; Node child3 = null; } When you create an object of this class the VM needs to reserve memory for the new object. So the VM knows that there are 5 different attributes in this class. Each attribute is a Object, so there needs to be space for 5 pointers. Where the pointer is actually pointing to doesn't matter because it is just the value that stands in the pointer. A null pointer is just a pointer that points to a invalid address (for example 0x00000000, but this depends on the operating system). So the memory for storing data1 and data2 are exactly the same. Of course data1 points to a valid address and there is an other object that also needs memory. So what happens exactly, when the object is created? Let's assume the object is created on the stack (on the heap it would be exactly the same). The VM 'pushes' each attribute after each other on the stack. I am not sure about the exact order, but I would assume it is data1, data2, child1,..., from top to bottom. In this case 5 times 32bit or 64bit (depends on your architecture) are reserved. I'll just call them word, I can't remember the correct expression for it. The value of each word is now a random value (the value that was stored in these memory cells). Next for each word the correct values are added, so for null 0x00000000 is written in the memory cells. For data1 a free address is searched and there it starts all over again. I hope it is clear what I am trying to say.
type: Answer
answers question: http://stackoverflow.com/q/22975032
has comment: http://stackoverflow.com/comment/35084943
has comment: http://stackoverflow.com/comment/35084802
has comment: http://stackoverflow.com/comment/35084783
has comment: http://stackoverflow.com/comment/35083913
has comment: http://stackoverflow.com/comment/35084577
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/35084020
accepted answer of: http://stackoverflow.com/q/22975032
has comment: http://stackoverflow.com/comment/35084164

http://stackoverflow.com/a/23144266
accepted answer of: http://stackoverflow.com/q/23129561
type: Answer
answers question: http://stackoverflow.com/q/23129561
has body: And there is working solution: use library https://code.google.com/p/mp4parser/ download jars isoparser-1.0.1.jar aspectjrt-1.7.4.jar constants mFileNameFromRec = context.getCacheDir().getAbsolutePath(); mFileNameFromRec += "/audiorecordtest.mp4"; mFileNameToUse = context.getCacheDir().getAbsolutePath(); mFileNameToUse += "/audioToUse.mp4"; code private void mergeSongs() throws Exception { File merge = new File(mFileNameToUse); String f1 = mFileNameFromRec; String f2 = mFileNameToUse; if (!merge.exists()) { InputStream in = new FileInputStream(new File(f1)); OutputStream out = new FileOutputStream(new File(f2)); // Transfer bytes from in to out byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) &gt; 0) { out.write(buf, 0, len); } in.close(); out.close(); Log.d("audio concatenation", "was copied"); } else { Movie[] inMovies; inMovies = new Movie[] { MovieCreator.build(f2), MovieCreator.build(f1), }; List&lt;Track&gt; videoTracks = new LinkedList&lt;Track&gt;(); List&lt;Track&gt; audioTracks = new LinkedList&lt;Track&gt;(); for (Movie m : inMovies) { for (Track t : m.getTracks()) { if (t.getHandler().equals("soun")) { audioTracks.add(t); } if (t.getHandler().equals("vide")) { videoTracks.add(t); } } } Movie result = new Movie(); if (videoTracks.size() &gt; 0) { result.addTrack(new AppendTrack(videoTracks .toArray(new Track[videoTracks.size()]))); } if (audioTracks.size() &gt; 0) { result.addTrack(new AppendTrack(audioTracks .toArray(new Track[audioTracks.size()]))); } Container out = new DefaultMp4Builder().build(result); RandomAccessFile ram = new RandomAccessFile(String.format(context .getCacheDir() + "/output.mp4"), "rw"); FileChannel fc = ram.getChannel(); out.writeContainer(fc); ram.close(); fc.close(); // IsoFile out = (IsoFile) new DefaultMp4Builder().build(result); // FileOutputStream fos = new FileOutputStream(new File( // String.format(context.getCacheDir() + "/output.mp4"))); // out.getBox(fos.getChannel()); // fos.close(); String mergedFilep…
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/22978193
has comment: http://stackoverflow.com/comment/35089083
has body: I'm making a program where it takes a list of elements in an arraylist and using recursion, gets the even and odd elements. For instance, if it were {1,2,3,4,5,6}. It would return {1,3,5} because they have an even element placement. I figured out how to do it for even numbers without a hitch, but I can't seem to make it work for odds. Here is the error: java.lang.ArrayIndexOutofBoundsException: -1 (in java.util.ArrayList) Here is my even code: public static ArrayList&lt;Integer&gt; even(ArrayList&lt;Integer&gt; tList) { ArrayList&lt;Integer&gt; newList = ListMethods.deepClone(tList); int temp = newList.size(); if (newList.size()&lt;=0)// The list is empty or has one element) { return newList;// Return the list as is – no need to reverse! } else { if(newList.size()%2==0) temp = newList.remove(newList.size()-2); newList.remove(newList.size()-1); newList = ListMethods.even(newList); if (temp!=0) newList.add(temp); } return newList; } Odd Code: (this is where I get the error) public static ArrayList&lt;Integer&gt; odd(ArrayList&lt;Integer&gt; tList) { ArrayList&lt;Integer&gt; newList = ListMethods.deepClone(tList); int temp = newList.size(); if (newList.size()&lt;=0)// The list is empty or has one element) { return newList;// Return the list as is – no need to reverse! } else { if(newList.size()%2==1) temp = newList.remove(newList.size()-1); newList.remove(newList.size()-1); newList = ListMethods.odd(newList); if (temp!=0) newList.add(temp); } return newList; } Deep Clone: public static ArrayList&lt;Integer&gt; deepClone(ArrayList&lt;Integer&gt; tList) { ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); for (Integer i : tList) { list.add(new Integer(i)); } return list; } My Tester Code: import java.util.ArrayList; import java.util.Scanner; public class ListMethodsRunner { public static void main(String[] args) { ArrayList&lt;Integer&gt; tempList = ListMethods.makeList(100); System.out.println("What would you like to do to this ArrayList? Type the number.")…
has comment: http://stackoverflow.com/comment/35089050
has comment: http://stackoverflow.com/comment/35089077
has comment: http://stackoverflow.com/comment/35089220
score: 0
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/35089024
has comment: http://stackoverflow.com/comment/35089117
tagged with: recursion
has title: Getting odd/even elements of an arraylist by recursion
has comment: http://stackoverflow.com/comment/35088998
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35089036
has answer: http://stackoverflow.com/a/22982674
tagged with: arraylist
has answer: http://stackoverflow.com/a/22978372
has comment: http://stackoverflow.com/comment/35089268
type: Question

http://stackoverflow.com/a/23069565
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/35255077
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35254952
has body: If you want a value you can access later, do this: StringBuilder sb = new StringBuilder(); for (int i : binary) { sb.append(i); } String result = sb.toString(); And if you want an actual binary number out, just parse it using int binaryValue = parseInt(result, 2);
answers question: http://stackoverflow.com/q/23069478

http://stackoverflow.com/a/23909347
has body: I would suggest you to take a more mathematical approach to it, find the height of the image by using getTop()-getBottom(). Then , you should shift the images down by that amount of height Downwards. This will ensure that it is aligned properly.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22993209
score: 1
answers question: http://stackoverflow.com/q/22993209
upvote count: 1

http://stackoverflow.com/a/23123825
answers question: http://stackoverflow.com/q/23123785
score: 0
has body: you need check input number not x. like for(x=0;x&lt;10;++x){ int t = scan.nextInt(); if(t&gt;=0){ if(t%2 == 0 ){ evenList[x] = t; even++; } else{ oddList[x] = t; odd++; } }else { negativeList[x] = t; neg++; } }
type: Answer

http://stackoverflow.com/q/22969869
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22969953
tagged with: java
tagged with: timertask
has body: I use timer.schedule(new DoReassignement(), delay, controlInterval); And want to add timer.scheduleAtFixedRate(fetchMail, getTomorrowMorning4am(), fONCE_PER_DAY); Should I use different Timer object for new task or I shouldnt ? Thanks in advance. Edit: my tasks sometimes could be(and should be) executed at the same time, but I dont want for each of them to delay or wait.
possible better answer: http://stackoverflow.com/a/22969953
type: Question
score: 0
has title: Different Timer object for new Task?
answer count: 2
has answer: http://stackoverflow.com/a/22969949
tagged with: timer
accepted answer: http://stackoverflow.com/a/22969949

http://stackoverflow.com/comment/35127490
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22999395
has text: You could also do `if (!isOwned)`

http://stackoverflow.com/a/23110056
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has body: If you look at the stacktrace, you can see that BufferedReader.readLine() ultimately leads to the creation of a very large array, which is causing the OutOfMemoryError. Since readLine() keeps reading the input until it reaches a line break, this indicates that there are no (or very few) line breaks in the zipped input file.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23071656
answers question: http://stackoverflow.com/q/23071656

http://stackoverflow.com/comment/35127525
type: Comment
comment on: http://stackoverflow.com/a/22994749
has text: I didn't try a different port but it worked for me on port 465
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35167924
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23021406
has text: @UsmanTariq you can wait for java 9, 10 and so on...!!!

http://stackoverflow.com/comment/35205174
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23041905
has text: Aside: See also [*Initial Threads*](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html).
score: 0

http://stackoverflow.com/a/23023391
has comment: http://stackoverflow.com/comment/35171652
has body: Try Thread.currentThread().getName()
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23023389
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35171606
type: Answer
accepted answer of: http://stackoverflow.com/q/23023389
has comment: http://stackoverflow.com/comment/35171659

http://stackoverflow.com/q/22990581
tagged with: arrays
has comment: http://stackoverflow.com/comment/35111416
has comment: http://stackoverflow.com/comment/35111197
has comment: http://stackoverflow.com/comment/35111326
score: 0
has comment: http://stackoverflow.com/comment/35110988
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35111510
has comment: http://stackoverflow.com/comment/35110881
has comment: http://stackoverflow.com/comment/35111446
has comment: http://stackoverflow.com/comment/35111194
has comment: http://stackoverflow.com/comment/35111056
tagged with: spring
tagged with: put
has body: I have a method that receives the inputstream via HTTP Put and converts it into byte[] and sends it to another method called verifysignature. I have been having a weird problem with it. The code is all right, but however the message digests don't match. After debugging, I found out it works fine if my inpustream has a single line of text but fails when there are multiple lines. The request body of Http PUT looks like : { "Url":"http://live.dev:3000/access_tokens", "AuthorizationUrl":"http://live.dev:3000/client_access_tokens", "Cert":"test" } The method that responds to PUT request: public @ResponseBody Map&lt;String,String&gt; createAuthorizationServer(HttpServletRequest request)throws IOException { // This method converts inputstream to byte[] byte[] inputStream = toBodyBytes(request.getInputStream()); X509Certificate signingCert = null; //..... stuff // Here I am using the byte array signingCert = engine.verifySignature(signature,inputStream); This works fine when the payload in request body is something in one line: "test:;sample" But fails when it has a multiple lines, like: "test:;" "sample" Can someone please throw some light at this? toBodyBytes method for your reference: private static byte[] toBodyBytes(InputStream inputStream) throws IOException { final int MAX_PAYLOAD_SIZE = 10240; byte[] buf = new byte[MAX_PAYLOAD_SIZE]; // protect against OutOfMemoryError in case of misconfiguration (accidentally filtering uploads) int bodySize = read(inputStream, buf, 0, buf.length); checkState(bodySize &lt; MAX_PAYLOAD_SIZE, "Looking for signature on upload payload?"); return copyOf(buf, bodySize); } Thank you!
has comment: http://stackoverflow.com/comment/35111143
answer count: 0
tagged with: java
has title: Multiple lines in HTTP PUT Body (Inpustream) causes problems
tagged with: inputstream
has comment: http://stackoverflow.com/comment/35111626
type: Question

http://stackoverflow.com/q/23129293
tagged with: java
has comment: http://stackoverflow.com/comment/35363423
type: Question
possible better answer: http://stackoverflow.com/a/23129428
has answer: http://stackoverflow.com/a/23129389
accepted answer: http://stackoverflow.com/a/23129389
has body: How to show Alert Dialog in static method, i am trying to put a condition, in which i am checking for the folder inside the SD Card, if exist then listing Items, otherwise i want to show AlertDialog - with message no folder found with Church Name public static List &lt;String&gt; fromSDCard() { List &lt;String&gt; listChurchWall = new ArrayList &lt;String&gt;(); // listing Wallpaper using church names String string = "/mnt/sdcard/Church/Wallpaper/"; f = new File (string+name+"/"); if (f.exists()) { files = f.listFiles (); }else{ // here i want to put AlertDialog } return listChurchWall; }
has comment: http://stackoverflow.com/comment/35362688
upvote count: 2
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/23129428
tagged with: static
tagged with: android
has title: How to put AlertDialog in static method
has comment: http://stackoverflow.com/comment/35362769
tagged with: android-alertdialog
score: 2
has answer: http://stackoverflow.com/a/23129538
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/35288886
type: QuestionComment
has text: @JimGarrison XY relative to the grid in the example image. There's an example of expected results that gives an idea. Doesn't have to be precise, i'll tweak it later.
comment on: http://stackoverflow.com/q/23088407
score: 0
type: Comment

http://stackoverflow.com/q/23033893
accepted answer: http://stackoverflow.com/a/23037875
favorite count: 0
tagged with: java.util.scanner
tagged with: delimiter
has title: How to use Scanner's delimiter method
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23036500
score: 1
has answer: http://stackoverflow.com/a/23036500
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23037875
type: Question
answer count: 2
tagged with: hashmap
has comment: http://stackoverflow.com/comment/35190285
downvote count: 0
has comment: http://stackoverflow.com/comment/35189964
has body: I am currently working on an implementation of the game Risk. In my Board class which constructs the countries, continents, and their adjacencies, I am reading in three different text files. When I construct a new continent, its' constructor expects the following (String name, int bonusArmies , ArrayList memberCountries). Now, I am using a Scanner to read from a text file that is organized as so, The name, bonus army that it has, and the rest on each line is its member countries. North America,5,Alaska,Alberta,Central America,Eastern United States,Greenland,Northwest Territory,Ontario,Quebec,Western United States South America,2,Argentina,Brazil,Venezuela Europe,5,Great Britain,Iceland,Northern Europe,Scandinavia,Southern Europe,Ukraine,Western Europe Africa,3,Congo,East Africa,Egypt,Madagascar,North Africa,South Africa Asia,7,Afghanistan,China,India,Irkutsk,Japan,Kamchatka,Middle East,Mongolia,Siam,Siberia,Ural,Yakutsk Australia,2,Eastern Australia,Indonesia,LotR,New Guinea,Western Australia I know I need to set a delimiter for Scanner which I have tried multiple approaches but, to no avail.Here is an example of what I tried for creating the Continents hashmap. public void createContinents() { Scanner inputTwo = new Scanner( new File( "continents.txt"); while( inputTwo.hasNext()) //continues to create and add countries until their are none next { String line = inputTwo.nextLine(); //stores the entire line Scanner lineScan = new Scanner( line); //passes the entire line into Scanner lineScan.useDelimiter(","); //sets the Scanner's delimiter pattern String name = inputTwo.next(); //stores the first String which is the name of the current continent being created System.out.println( " the name is" + name); int bonusArmies = inputTwo.nextInt(); //stores the second String which is casted into an int for the continent bonus armies System.out.println(" the number of bonus armies is" + bonusArmies); ArrayList&lt;Country&gt; memberCountries = new ArrayList&lt;Country&gt;(); /…
tagged with: file-io

http://stackoverflow.com/q/22977955
has title: How to use setQ() method in google calendar api v3 java
answer count: 1
has answer: http://stackoverflow.com/a/23801583
accepted answer: http://stackoverflow.com/a/23801583
tagged with: google-calendar-api
has body: Can someone give me an example on how to use the setQ() method on google calendar v3 api for calendar events in Java? I try the setQ() method in google drive and it's worked fine, so I want to know how to do the same thing in google calendar events. So for example, I have an event description in my 'primary' calendar that contains the word 'event test' and I want to retrieve all events in this 'primary' calendar that has its description contains the word 'event test'. Because I want to avoid looping all the hundreds or thousands of events in my calendar to find a specific event. Thanks.
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35088889
type: Question
score: 0

http://stackoverflow.com/comment/35228568
type: Comment
has text: Accessing database columns based on their order is a very bad idea!
comment on: http://stackoverflow.com/a/23055135
type: AnswerComment
score: 0

http://stackoverflow.com/q/22984729
tagged with: jframe
tagged with: swing
type: AnsweredQuestion
tagged with: java
has title: How do i seperate Jpanel in Jframe
has answer: http://stackoverflow.com/a/22984951
type: Question
tagged with: debugging
answer count: 2
tagged with: jpanel
score: 0
has body: I am trying to achieve this layout i dont know why i am getting this This is my code package testing; import java.io.*; import java.util.*; import java.security.*; import javax.xml.bind.DatatypeConverter; import java.lang.*; import java.awt.*; import javax.swing.*; public class Testing { public static class GridPanel extends JPanel { public GridPanel() { setLayout(new GridLayout(4,4)); setBackground(Color.GREEN); this.setPreferredSize(new Dimension(500,100)); JButton b1 = new JButton ("Button 1"); JButton b2 = new JButton ("Button 2"); JButton b3 = new JButton ("Button 3"); JButton b4 = new JButton ("Button 4"); JButton b5 = new JButton ("Button 5"); JButton b6 = new JButton ("Button 6"); JButton b7 = new JButton ("Button 7"); JButton b8 = new JButton ("Button 8"); JButton b9 = new JButton ("Button 9"); JButton b10 = new JButton ("Button 10"); JButton b11 = new JButton ("Button 11"); JButton b12 = new JButton ("Button 12"); JButton b13 = new JButton ("Button 13"); JButton b14 = new JButton ("Button 14"); JButton b15 = new JButton ("Button 15"); JButton b16 = new JButton ("Button 16"); add(b1); add(b2); add(b3); add(b4); add(b5); add(b6); add(b7); add(b8); add(b9); add(b10); add(b11); add(b12); add(b13); add(b14); add(b15); add(b16); } } public static void main(String[] args) { JPanel primary = new JPanel(); primary.setPreferredSize(new Dimension(500,500)); JPanel jp1 = new JPanel(); jp1.setPreferredSize(new Dimension(500,100)); JTextField jt1 = new JTextField(8); jp1.add(jt1); GridPanel gp = new GridPanel(); primary.add(jp1); primary.add(gp); JFrame jf = new JFrame(); jf.setPreferredSize(new Dimension(500,500)); jf.add(primary); jf.pack(); jf.setVisible(true); } } I am not sure how to separate the two panels in the frame , how am i doing wrong ??
possible better answer: http://stackoverflow.com/a/22984951
has answer: http://stackoverflow.com/a/22985177
accepted answer: http://stackoverflow.com/a/22985177

http://stackoverflow.com/comment/35154084
type: Comment
type: QuestionComment
score: 1
has text: What's the problem? Don't forget to override the `toString` method if you want a decent String representation for your `Customer` class.
comment on: http://stackoverflow.com/q/23014359

http://stackoverflow.com/comment/35334021
type: QuestionComment
type: Comment
has text: @saplingPro: You mean it return false for the FIRST request?
comment on: http://stackoverflow.com/q/23113492
score: 0

http://stackoverflow.com/q/23049833
has body: Are Compare and Swap/Compare and Set methods an overhead in a highly concurrent environment ?
type: Question
has comment: http://stackoverflow.com/comment/35343388
has title: Are Compare and Swap/Compare and Set methods an overhead in highly concurrent environment
score: 0
has comment: http://stackoverflow.com/comment/35234178
has comment: http://stackoverflow.com/comment/35222272
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35284575
has comment: http://stackoverflow.com/comment/35284789
answer count: 0
tagged with: java
tagged with: concurrency

http://stackoverflow.com/comment/35314588
has text: Well it seems you need a GraphDB....why not to consider Neo4J http://www.neo4j.org/ ?
score: 1
comment on: http://stackoverflow.com/q/23103315
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35250176
type: Comment
score: 2
comment on: http://stackoverflow.com/q/23066586
has text: Making the GridLayout(5, 4) doesn't make sense. You should NOT be making the frame visible BEFORE you add components to the frame. The code is way too complicated for such a simple task. There is no need for all the classes you created. Read the tutorial and look at the examples for a much simpler approach. Finally you still haven't posted a `SSCCE` which demonstrates the problem.
type: QuestionComment

http://stackoverflow.com/q/23072388
answer count: 2
tagged with: for-loop
has answer: http://stackoverflow.com/a/23072470
tagged with: class
has title: Class Issues involving an Array
score: 0
has body: I'm attempting to make an array of WordCounts, then iterate through a file line by line separating it into tokens using a split method. Then for each token, if it's in wordList, increment count, and if it's not in wordList just simply add it to the list. Hmwk class - public class Hmwk { public static void main(String[] args) throws FileNotFoundException { int n=0; WordCount[] wordList= new WordCount[10000]; Scanner words = new Scanner(new File("input.txt")); while (words.hasNextLine() &amp;&amp; n &lt; 10000) { String line = words.nextLine(); String[] tokens = line.split("[^\\p{Alpha}]"); for (int i = 0; i &lt; tokens.length; i++) { if (tokens[i].length() &gt; 0) { WordCount word = new WordCount(tokens[i]); int foundAt = search(wordList, word, n); if (foundAt &gt;= 0) { word.increment(); } else { wordList[n]=word; n++; } } } } //Arrays.sort(wordList); String alphabeticFileName = "alphabetic.txt"; String frequencyFilename = "frequency.txt"; PrintWriter output = new PrintWriter(alphabeticFileName); for (int i=0; i &lt; n;i++) { output.println(wordList[i].toString()); } output.close(); //Sort on frequency somehow PrintWriter output2 = new PrintWriter(frequencyFilename); for (int i=0; i &lt; n; i++) { output2.println(wordList[i].toString()); } output2.close(); } public static int search(WordCount[] list,WordCount word, int n) { int result = -1; int i=0; while (result &lt; 0 &amp;&amp; i &lt; n) { if (word == list[i]) { result = i; } i++; } return result; } } WordCount class - class WordCount { String word; int count; static boolean compareByWord; public WordCount(String aWord) { setWord(aWord); count = 1; } private void setWord(String theWord) { word = theWord; } public void increment() { count += 1; } public static void sortByWord() { compareByWord = true; } public static void sortByCount() { compareByWord = false; } public String toString() { String result = String.format("%s (%d)", word, count); return result; } } It compiles and runs fine, but for some reason I'm gi…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23072441
type: Question
tagged with: java
tagged with: search

http://stackoverflow.com/comment/35094118
score: 2
comment on: http://stackoverflow.com/q/22981210
has text: @MarounMaroun What exactly is the purpose of your comment? I am clever enough to assume that by myself, but since I am no visionary, I have to ask him. Are you a visionary?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23123656
tagged with: binary
possible better answer: http://stackoverflow.com/a/23123666
linked to: http://stackoverflow.com/q/2473597
has answer: http://stackoverflow.com/a/23123666
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/35351462
has comment: http://stackoverflow.com/comment/35351377
downvote count: 0
has answer: http://stackoverflow.com/a/23123809
score: 4
has title: How to input an integer's binary expression into a bitSet in java
accepted answer: http://stackoverflow.com/a/23123809
has body: How to input an integer's binary expression into a bitSet in java? say a = 15 I want put 1111 into a bitSet, is there a function for this?
favorite count: 0
tagged with: bitset

http://stackoverflow.com/comment/35290299
type: Comment
has text: Ok, I will give you a different method.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23089348

http://stackoverflow.com/comment/35234412
type: Comment
comment on: http://stackoverflow.com/a/23058286
has text: Right you are, I was thinking about an older version of the language. I've edited my answer with an example of a comparator
type: AnswerComment
score: 0

http://stackoverflow.com/a/23069064
score: 2
has comment: http://stackoverflow.com/comment/35255076
downvote count: 0
has comment: http://stackoverflow.com/comment/35254383
has comment: http://stackoverflow.com/comment/35254198
has comment: http://stackoverflow.com/comment/35255525
has comment: http://stackoverflow.com/comment/35255407
has comment: http://stackoverflow.com/comment/35254233
has comment: http://stackoverflow.com/comment/35254230
has comment: http://stackoverflow.com/comment/35253979
has comment: http://stackoverflow.com/comment/35254165
upvote count: 2
has comment: http://stackoverflow.com/comment/35254164
has comment: http://stackoverflow.com/comment/35254271
has body: Your error is in scores[m]. If you select an array position beyond the length (or less than) of scores, then you will get an Out of Bounds Exception. You need to check the length of your array first. The calculation j - 'a' is producing a negative number. Finally, ensure that m is not less than zero. You are checking if it is less than 25. Here is a link to an ASCII table. There are char less than 'a' in the table. Therefore, you need to adjust your logic. Since you are only working with presumably lower case letters, you need to make sure that your character value is between 97 and 122 before subtracting. So, you can compare the letters by saying: if (j &lt; 'a' || j &gt; 'z') { continue; }
has comment: http://stackoverflow.com/comment/35253993
answers question: http://stackoverflow.com/q/23069006
has comment: http://stackoverflow.com/comment/35254333
has comment: http://stackoverflow.com/comment/35255589
has comment: http://stackoverflow.com/comment/35254138
has comment: http://stackoverflow.com/comment/35255326
type: Answer
has comment: http://stackoverflow.com/comment/35254041
has comment: http://stackoverflow.com/comment/35254763

http://stackoverflow.com/comment/35210491
comment on: http://stackoverflow.com/q/23044300
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Java KeyListener Not Registering Arrow Keys](http://stackoverflow.com/questions/8961938/java-keylistener-not-registering-arrow-keys)

http://stackoverflow.com/comment/35279808
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23069291
has text: Versions is 40 nodes, so, not big at all. I'll try looping over the iterator.
score: 0

http://stackoverflow.com/a/23027067
type: Answer
score: 2
downvote count: 0
has body: Without any assertions against the correctness or validity of your existing query... There's a simple way to do it: if you're expecting that only one Place exists ever, then you can use uniqueResult, which will either return the instance of the entity if it exists, or null if it doesn't: @Tranasctional public boolean alreadyExists(String place) { return sessionFactory.getCurrentSession() .createQuery("from Place where place_Name=:place") .setParameter("place", place) .uniqueResult() != null; } You could also get the result as a list, and check to see if the list is not empty (thus meaning that there is a result). @Tranasctional public boolean alreadyExists(String place) { List result = sessionFactory.getCurrentSession() .createQuery("from Place where place_Name=:place") .setParameter("place", place) .list(); return !result.isEmpty(); }
upvote count: 2
answers question: http://stackoverflow.com/q/23026973
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23026973

http://stackoverflow.com/comment/35248851
comment on: http://stackoverflow.com/a/23066011
type: AnswerComment
score: 0
type: Comment
has text: Glad I could help! Sorry it took a million comments

http://stackoverflow.com/a/23117179
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23116634
has body: In my opinion, the second way is more better than the first. Because in the second way, created Set object only once but in the first way create Set object in every looping. That why second is more better.

http://stackoverflow.com/q/23129754
has body: I have trouble with understanding the logic behind this error, so i have a comparision method: public int compareTo(osobnik obj) { if (this.fitness == -1 &amp;&amp; obj.fitness==-1) return 0; if (this.fitness == -1) return 1; if (obj.fitness == -1) return -1; if (this.fitness &gt; obj.fitness) return 1; if (this.fitness &lt; obj.fitness) return -1; return 0; } and until the fittnes is calculeted as absolut value of 1/(x^5 + x^4+3x^2+x-5) everything is fine (witha catch, that if the value of denominator is 0, then fittnes is -1). But if i change the function to 1/(x^5 + x^4-3x^2+x-5) (as a sign change next to 3x^2) i get the "Comparison method violates its general contract". Why? Why dose it work for one set of numbers and it dose not for the second? [Solved] As it turns out the Compare functions is all right. The criminal hides in 1/x turning to NaN.
has comment: http://stackoverflow.com/comment/35362423
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35362131
answer count: 2
has title: "Comparison method violates its general contract" when I change the method of calculation
upvote count: 1
has answer: http://stackoverflow.com/a/23130244
has answer: http://stackoverflow.com/a/23130800
has comment: http://stackoverflow.com/comment/35362312
tagged with: artificial-intelligence
favorite count: 0
has comment: http://stackoverflow.com/comment/35362214
downvote count: 0
has comment: http://stackoverflow.com/comment/35362190
tagged with: genetic-algorithm
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/35254920
score: 1
has text: What do you think the error means?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23069536

http://stackoverflow.com/a/23021872
answers question: http://stackoverflow.com/q/23019214
type: Answer
has comment: http://stackoverflow.com/comment/35628257
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/35621413
has comment: http://stackoverflow.com/comment/35620462
has body: The onejar plugin adds all artifacts from maven's runtime scope, as it should be. The command mvn dependency:tree does not seem to list all runtime dependencies properly though. Could be a bug, I don't know why. Luckily, by adding a few parameters you can have all runtime scope dependencies listed. mvn dependency:tree -Dscope=runtime -Ddebug=true This will show that cxf-rt-core also has geronimo-javamail as dependency. So, your solution would be to explicitly add the core jar with an exclusion to your dependencies. org.apache.cxf cxf-rt-core 2.7.1 org.apache.geronimo.specs geronimo-javamail_1.4_spec
has comment: http://stackoverflow.com/comment/35619695
upvote count: 7
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23019214

http://stackoverflow.com/q/23045856
favorite count: 0
has comment: http://stackoverflow.com/comment/35222615
type: UnansweredQuestion
upvote count: 1
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/35215961
has answer: http://stackoverflow.com/a/47112055
tagged with: spring-boot
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35259870
type: Question
has comment: http://stackoverflow.com/comment/35222859
has comment: http://stackoverflow.com/comment/69777889
tagged with: cloud-foundry
has comment: http://stackoverflow.com/comment/35218999
has title: Deploying and Connecting cloud foundry service (MongoDB, Java, Spring Boot)
answer count: 1
downvote count: 0
has body: How to connect cloud foundry services to a spring boot maven project? I thought putting spring.data.mongodb.uri = uri to the property file will solve the problem. Is there additional step to connect to the services created in cloud foundry? Thanks. btw i add service using sts by checking the service in the deploying step. @Bean public MongoDbFactory mongoDbFactory() { CloudEnvironment cloudEnvironment = new CloudEnvironment(); MongoServiceInfo serviceInfo = cloudEnvironment.getServiceInfo("servicename", MongoServiceInfo.class); MongoServiceCreator serviceCreator = new MongoServiceCreator(); return serviceCreator.createService(serviceInfo); } so i add this code but it still hangs in the deployment. Is the service name is the service instance name?

http://stackoverflow.com/a/23098445
score: 2
has comment: http://stackoverflow.com/comment/35307120
has body: methods are inherited only if they are public or protected or has no access modifier. private cannot be inherited. I think what the book meant Teacher can 'override' private method of Person via creating a similar method name with broader or similar access modifier, since Teacher does not see the method. This is called Method Shadowing. it's either the book chose the wrong word using override instead of shadowing, or gave wrong answer. Example: public class Person(){ private void sayHello(){...} } public class Teacher extends Person{ public void sayHello(){...} }
downvote count: 0
has comment: http://stackoverflow.com/comment/35307145
has comment: http://stackoverflow.com/comment/35307203
has comment: http://stackoverflow.com/comment/35307067
answers question: http://stackoverflow.com/q/23098385
type: Answer
has comment: http://stackoverflow.com/comment/35307050
upvote count: 2
has comment: http://stackoverflow.com/comment/35307246

http://stackoverflow.com/comment/35349156
has text: i made a simple change to your code and it was running on my system. `Process x = Runtime.getRuntime().exec("C:\\xampp\\mysql\\bin\\mysql -u root -p -e \"show databases\\G\"| findstr \"Last_SQL\"");`
type: QuestionComment
comment on: http://stackoverflow.com/q/23121963
score: 0
type: Comment

http://stackoverflow.com/comment/35095164
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22981899
has text: So before Inserting, check if the values are already stored with a Select statement.
type: AnswerComment

http://stackoverflow.com/a/23003356
accepted answer of: http://stackoverflow.com/q/23003283
type: AcceptedAnswer
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23003283
has body: If you do not want to specify the length of the array then you will have to use a list... ArrayList&lt;Integer&gt; array_angka = new ArrayList&lt;Integer&gt;(); You will then add to it as follows array_angka.add(posisi_huruf); You can retrieve from your ArrayList as follows array_angka.get(0); Remember if you do not know ahead of time the length of the array you are recreating the entire array every time you increase the size of the array, this is what ArrayList is for to give you a dynamically growing Array.
has comment: http://stackoverflow.com/comment/35134708
score: 1

http://stackoverflow.com/q/23075689
has comment: http://stackoverflow.com/comment/35266282
score: 1
has body: Can someone help me with a psuedocode or even the recursive formula that describes the recursive search for a word in the Boggle board so I can get started?
tagged with: java
has title: How to do a recursive search for a word in the Boggle game board?
has answer: http://stackoverflow.com/a/23100156
has answer: http://stackoverflow.com/a/52825057
type: Question
tagged with: recursion
linked to: http://stackoverflow.com/q/40558761
has comment: http://stackoverflow.com/comment/35266237
upvote count: 2
has answer: http://stackoverflow.com/a/23078632
answer count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/92567044
tagged with: boggle
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35179277
type: AnswerComment
has text: However, maybe this will be useful to you: [chronon debugger](http://blog.jetbrains.com/idea/2014/03/try-chronon-debugger-with-intellij-idea-13-1-eap/)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23013928

http://stackoverflow.com/comment/35155822
comment on: http://stackoverflow.com/q/23015231
score: 0
type: Comment
type: QuestionComment
has text: what are you exactly trying to do? The question lacks information. You get ClassNotFoundException in a lot of cases. You already had a running code in eclipse and suddenyl you got this error or you imported a project and then you couldn't run it. what kind of project is it?

http://stackoverflow.com/comment/35132444
has text: @Pants: At least use an `if` instead of a `while`. You're not actually looping.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23002218

http://stackoverflow.com/comment/35218917
type: QuestionComment
has text: Exception in thread "main" java.lang.Error: Unresolved compilation problem: at wk12a.Accounting.main(Accounting.java:18)
comment on: http://stackoverflow.com/q/23049832
score: 0
type: Comment

http://stackoverflow.com/comment/35294746
comment on: http://stackoverflow.com/q/23091677
score: 0
type: QuestionComment
has text: How about registering an event listener to the textfield's changed event?
type: Comment

http://stackoverflow.com/a/23030739
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/35186021
upvote count: 3
has body: Not sure the exact result you want, so I didn't even try. But the problem you're facing, is one of the reasons, you want to pack() your frame, and not setSize(). You're constricting the preferred sizes of the component. pack() respects the preferred size of all your components, and should be used, rather than setSize() bottomPanel.setLayout(new GridLayout(6,0)); //doesn't work.. // with pack(), now it does. pack(); //setSize(400,400); // if you increase the size it'll work also, but just pack() You just need to work on the laying out of your components now to get your desired look :) A more detailed explanation of your problem. This is how you code currently looks when I set the background. Note: you can already see the setSize() is taking a toll on your top panel's preferred size (200, 200). The top CYAN is your image panel. The BLUE is the subPanel with 4 row. With GridLayout, all the rows will be at least the size of it largest component. In this case it's the label. You can see the blue area is 4 times the height of the label (as it should be) Not the RED, which is the bottomPanel. This has 5 rows. The largest component is the subPanel, so the total size of the bottomPanel is the size of the subPanel x 5, as you can also see. Once you add another row, the top panel gets pushed out.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23030439
answers question: http://stackoverflow.com/q/23030439

http://stackoverflow.com/a/23129408
upvote count: 0
score: -1
type: Answer
downvote count: 1
has body: You can also use org.apache.commons.lang.StringUtils#repeat for this. For example repeat for 5 times: String result = StringUtils.repeat("repeat this string", ", ", 5); The version without the second argument (the separator ", ") is also available.
answers question: http://stackoverflow.com/q/23129235

http://stackoverflow.com/q/22991150
linked to: http://stackoverflow.com/q/20923888
has answer: http://stackoverflow.com/a/22991582
score: 7
tagged with: java
has title: When using overloading with type promotion, why method calling is ambiguous?
possible better answer: http://stackoverflow.com/a/22991582
accepted answer: http://stackoverflow.com/a/22991272
downvote count: 0
favorite count: 0
has body: public class aman { void m(double a , int b, int c) { System.out.println("second"); } void m(float a , int b, double c) { System.out.println("first"); } public static void main(String[] args) { aman obj = new aman(); obj.m(23, 12, 1); } } Here, method m() has been overloaded but i am not understanding why the call is ambigous because in first method only 1 conversion needs to take place whereas in second method, two conversions are required. So, definitely first method should have been called. Please give the reason why this is not happening or if i am missing some rule.
has answer: http://stackoverflow.com/a/22991233
answer count: 5
has answer: http://stackoverflow.com/a/38449844
has answer: http://stackoverflow.com/a/42241634
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22991272
upvote count: 7
type: Question

speech-recognition
tags question: http://stackoverflow.com/q/23119717
tags question: http://stackoverflow.com/q/23111368
tag name: speech-recognition
type: Tag
tags question: http://stackoverflow.com/q/22973788

http://stackoverflow.com/a/22998189
downvote count: 0
answers question: http://stackoverflow.com/q/22998128
type: Answer
accepted answer of: http://stackoverflow.com/q/22998128
upvote count: 1
has body: "\n" means line breaking, in the following example the output will be a b ex code: StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("a"); stringBuffer.append("\n"); stringBuffer.append("b"); System.out.println(stringBuffer.toString());
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/22982111
has answer: http://stackoverflow.com/a/22982302
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35097642
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: this is an example of my JSON-file: { "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "features": [ { "type": "Feature", "properties": { "KKOD": 414, "KATEGORI": "Kommun", "KOMMUNKOD": 2584, "KOMMUNNAMN": "Kiruna", "LANSKOD": 25, "LANSNAMN": "Norrbottens län", "KOM_KOD": "2584", "LAN_KOD": "25" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 20.468899715356947, 69.0576379270828 ], [ 20.54863836554442, 69.05997605732921 ] ] ] } }, { "type": "Feature", "properties": { "KKOD": 414, "KATEGORI": "Kommun", "KOMMUNKOD": 1262, "KOMMUNNAMN": "Lomma", "LANSKOD": 12, "LANSNAMN": "Skåne län", "KOM_KOD": "1262", "LAN_KOD": "12" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 13.11196493557692, 55.702721301997265 ], [ 13.112159474347964, 55.69989518845077 ], [ 13.111027902960512, 55.69899875723693 ] ] ] } } ] } I would like to get the array of coordinates parsed to either a Double or String array in Java. This is how I managed to get the String from the property "KOMMUNNAMN": JSONObject json = new JSONObject(readInput()); //readInput() returns the JSON document as String JSONArray jsonarr = json.getJSONArray("features"); json = jsonarr.getJSONObject(0); json = json.getJSONObject("properties"); String namn = json.getString("KOMMUNNAMN"); How do I proceed from here? Thanks!
type: Question
has comment: http://stackoverflow.com/comment/35099213
has comment: http://stackoverflow.com/comment/35096161
has comment: http://stackoverflow.com/comment/35096022
has answer: http://stackoverflow.com/a/22985377
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22985377
tagged with: parsing
possible better answer: http://stackoverflow.com/a/22982302
has title: How to get nested arrays with JSONObject (org.json)

http://stackoverflow.com/q/23002343
has comment: http://stackoverflow.com/comment/35134120
has comment: http://stackoverflow.com/comment/35134209
has answer: http://stackoverflow.com/a/23003375
has comment: http://stackoverflow.com/comment/35133801
has comment: http://stackoverflow.com/comment/35134288
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35133502
favorite count: 0
has title: Check Java Project for Android compatibility
has comment: http://stackoverflow.com/comment/35134079
has body: Within an Android project in Eclipse, code that is only available in certain API versions usually throws a warning for me. I don't think non-android projects I am referencing from my Android project are being checked in this way. This has caused some problems for me as I've accidentally used some functions not available on older versions of Android. How do I check whether a non-android project is using Android API in a lower version than what I've targeted in my manifest?
has comment: http://stackoverflow.com/comment/35134116
has comment: http://stackoverflow.com/comment/35134090
tagged with: android
has comment: http://stackoverflow.com/comment/35134376
has comment: http://stackoverflow.com/comment/35134059
has comment: http://stackoverflow.com/comment/35133996
has comment: http://stackoverflow.com/comment/35133911
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35134080
accepted answer: http://stackoverflow.com/a/23003375
has comment: http://stackoverflow.com/comment/35134245
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35134167
has comment: http://stackoverflow.com/comment/35134208
has comment: http://stackoverflow.com/comment/35134150
has comment: http://stackoverflow.com/comment/35134037

http://stackoverflow.com/comment/35169116
comment on: http://stackoverflow.com/a/23022042
type: Comment
score: 0
type: AnswerComment
has text: I think first method is more specific then second one because all values that can pass first method can also pass second one. From the document : **one method is more specific than another if any invocation handled by the first method could be passed on to the other one without a compile-time type error.**

android-fragments
tags question: http://stackoverflow.com/q/23044691
tags question: http://stackoverflow.com/q/23064525
tags question: http://stackoverflow.com/q/23096641
tags question: http://stackoverflow.com/q/23005586
tags question: http://stackoverflow.com/q/23002041
tags question: http://stackoverflow.com/q/23103028
tags question: http://stackoverflow.com/q/23025527
type: Tag
tags question: http://stackoverflow.com/q/23035271
tags question: http://stackoverflow.com/q/22990904
tags question: http://stackoverflow.com/q/23038131
tags question: http://stackoverflow.com/q/22969889
tags question: http://stackoverflow.com/q/23014133
tags question: http://stackoverflow.com/q/23045001
tags question: http://stackoverflow.com/q/22999398
tags question: http://stackoverflow.com/q/23076696
tags question: http://stackoverflow.com/q/23123321
tags question: http://stackoverflow.com/q/23046048
tags question: http://stackoverflow.com/q/22989369
tags question: http://stackoverflow.com/q/23033072
tags question: http://stackoverflow.com/q/22990158
tags question: http://stackoverflow.com/q/23124610
tags question: http://stackoverflow.com/q/23049842
tag name: android-fragments
tags question: http://stackoverflow.com/q/23115924

http://stackoverflow.com/comment/35107854
comment on: http://stackoverflow.com/q/22988792
has text: @AlexFlorescu you would have to see their binary representations, do the binary substraction and see where's the difference, it probably comes from rounding
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23006241
type: Question
upvote count: 9
possible better answer: http://stackoverflow.com/a/23026354
tagged with: jackson
score: 9
tagged with: playframework
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23486543
has body: I'm writing a typical Play Framework app where I want to return a JsonNode from my Controller's methods, using Jackson. This is how I'm doing it right now: public static Result foo() { MyPojoType myPojo = new myPojo(); String tmp = new ObjectMapper().writerWithView(JSONViews.Public.class).writeValueAsString(myPojo); JsonNode jsonNode = Json.parse(tmp); return ok(jsonNode); } Is it possible to avoid the "String tmp" copy and convert directly from MyPojoType to JsonNode using a view? Maybe I can use ObjectMapper.valueToTree, but I don't know how to specify a JSonView to it.
has answer: http://stackoverflow.com/a/27923637
has answer: http://stackoverflow.com/a/27465325
answer count: 4
type: AnsweredQuestion
tagged with: playframework-2.0
tagged with: java
accepted answer: http://stackoverflow.com/a/23486543
has answer: http://stackoverflow.com/a/23026354
has title: Converting POJO to JsonNode using a JsonView

http://stackoverflow.com/q/23119711
answer count: 4
has comment: http://stackoverflow.com/comment/35344536
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3463658
upvote count: 3
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35344643
has comment: http://stackoverflow.com/comment/81445471
has answer: http://stackoverflow.com/a/23121087
type: Question
has comment: http://stackoverflow.com/comment/35344568
score: 3
has answer: http://stackoverflow.com/a/23121213
linked to: http://stackoverflow.com/q/12159
tagged with: java
possible better answer: http://stackoverflow.com/a/23119827
tagged with: concurrency
has comment: http://stackoverflow.com/comment/35344530
has answer: http://stackoverflow.com/a/23119827
has answer: http://stackoverflow.com/a/23119824
has comment: http://stackoverflow.com/comment/35344596
has comment: http://stackoverflow.com/comment/35344537
linked to: http://stackoverflow.com/q/3964211
downvote count: 0
accepted answer: http://stackoverflow.com/a/23121087
has title: Breaking Concurrent Code
favorite count: 0
tagged with: synchronized
has body: Let's say I have the following class: public class BuggyClass { private String failField = null; public void create() { destroy(); synchronized (this) { failField = new String("Ou! la la!"); } } public void destroy() { synchronized (this) { failField = null; } } public long somethingElse() { if (failField == null) { return -1; } return failField.length(); } } It's easy to see that in a multithreaded execution of the above code we could get a NullPointerExeption in somethingElse. For example, it could be that failField != null and before returning failField.length() destroy gets called therefore making failField to null. I want to create a multithreaded program that is going to be able to "throw" a NullPointerException when using BuggyClass. I know, that since the program is multithreaded, it could be that this never happens but I guess there should be some better test that increases the probability of getting an exception. Right? I tried the following: final BuggyClass bc = new BuggyClass(); final int NUM_OF_INV = 10000000; int NUM_OF_THREADS = 5; ExecutorService executor = Executors.newFixedThreadPool(3 * NUM_OF_THREADS); for (int i = 0; i &lt; (NUM_OF_THREADS); ++i) { executor.submit(new Runnable() { public void run() { for(int i = 0; i&lt; NUM_OF_INV; i++){ bc.create(); } } }); } for (int i = 0; i &lt; (NUM_OF_THREADS); ++i) { executor.submit(new Runnable() { public void run() { for(int i = 0; i&lt; NUM_OF_INV; i++){ bc.destroy(); }} }); } for (int i = 0; i &lt; (NUM_OF_THREADS); ++i) { executor.submit(new Runnable() { public void run() { for(int i = 0; i&lt; NUM_OF_INV; i++){ bc.somethingElse(); }} }); } executor.shutdown(); executor.awaitTermination(1, TimeUnit.DAYS); I executed the above code (method) multiple times with different NUM_OF_INV and NUM_OF_THREADS but NEVER managed to get a NullPointerException. Any ideas on how I can create a test that increases my chances of getting an exception without changing BuggyClass?
has comment: http://stackoverflow.com/comment/35344720
has comment: http://stackoverflow.com/comment/35344755
tagged with: executorservice

http://stackoverflow.com/comment/35306298
type: Comment
comment on: http://stackoverflow.com/q/23098014
type: QuestionComment
has text: `printStackTrace` doesn't return anything -- that's what `void` for a return type means.
score: 0

http://stackoverflow.com/q/23058687
tagged with: multicastsocket
has title: Multicast packets come in dirty
has answer: http://stackoverflow.com/a/23058847
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/23058847
tagged with: multicast
possible better answer: http://stackoverflow.com/a/23059070
has answer: http://stackoverflow.com/a/23059070
linked to: http://stackoverflow.com/q/13574436
type: AnsweredQuestion
tagged with: java
has body: I'm making a very simple multicast application where a controller locks and unlocks a station via simple messages. The controller and the station both have receiver threads. For some reason, when the first message is sent, it is received well, but when the second message is sent, it is received incorrectly, with some of the first message attached to it. For example, Station 1 sends a "Locked: 1001" message. The controller receives this message correctly. The controller sends a "Unlock: 1001" message. Station 1 receives something like "Unlock: 1ocked: 1001" Here's the station's receiver: public class VotingStationReceiver implements Runnable{ private DummyVotingStation votingStation; private MulticastSocket s; private Thread listener = new Thread(this); public VotingStationReceiver(MulticastSocket s, DummyVotingStation votingStation){ this.s = s; this.votingStation = votingStation; listener.start(); } public void run() { byte[] buf = new byte[1024]; while(true) try { DatagramPacket pack = new DatagramPacket(buf, buf.length); s.receive(pack); String msg = ""; msg = new String(pack.getData()); msg = msg.trim(); System.out.println(msg); System.out.println("Voting Station: message received"); votingStation.processMessage(msg); } catch(IOException e) { break; } } } And here's where the controller's message is sent: private String unlockMsg = "Unlock: "; public void unlockStation(int lockedID) { //send packet telling station to unlock String completeMsg = unlockMsg+lockedID; byte buf[] = completeMsg.getBytes(); // Create and send the DatagramPacket DatagramPacket pack; try { pack = new DatagramPacket(buf, buf.length, InetAddress.getByName(group), port); int ttl = s.getTimeToLive(); s.setTimeToLive(ttl); s.send(pack); System.out.println("Control Station: message sent"); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } I know this is probably a beginner's problem, but I don't have …
type: Question

wildfly
tags question: http://stackoverflow.com/q/23023817
tags question: http://stackoverflow.com/q/23081092
tags question: http://stackoverflow.com/q/23079492
type: Tag
tags question: http://stackoverflow.com/q/23066125
tags question: http://stackoverflow.com/q/23007323
tag name: wildfly
tags question: http://stackoverflow.com/q/22971661
tags question: http://stackoverflow.com/q/23082755
tags question: http://stackoverflow.com/q/23015494

http://stackoverflow.com/a/22991870
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22991725
answers question: http://stackoverflow.com/q/22991725
type: Answer
upvote count: 2
has body: I need to get my item list like this, but i can't do that until 90th item(position). How can i write these codes for infinite times. You can do it in that way: article = getItem((position * 3)); article2 = getItem((position * 3) + 1); article3 = getItem((position * 3) + 2); This is simple solution and will make a trick for you.
score: 2
type: AcceptedAnswer

http://stackoverflow.com/q/23036927
has comment: http://stackoverflow.com/comment/35195645
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26951727
type: Question
has body: I'm trying to calculate conditional entropy in order to calculate information gain for decision trees. I'm having a little trouble with the implementation in Java. An example may look like: X Y f(x) 1 0 A 1 0 A 0 1 B Given this example, how would I go about calculating conditional entropy in Java? I understand the math behind it but am just confused on the implementation. An example can be found here: http://en.wikipedia.org/wiki/Conditional_entropy
tagged with: entropy
upvote count: 1
answer count: 1
favorite count: 0
has title: Calculating conditional entropy for a decision tree
type: UnansweredQuestion

http://stackoverflow.com/comment/35104052
type: QuestionComment
comment on: http://stackoverflow.com/q/22986634
score: 0
has text: Please note that regex is not a java exclusive thing. Start here: http://www.regular-expressions.info/tutorial.html :)
type: Comment

http://stackoverflow.com/q/23021195
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35167284
has comment: http://stackoverflow.com/comment/35167965
type: UnansweredQuestion
has title: clean up big Java set/list to easy memory usage
has answer: http://stackoverflow.com/a/23021810
tagged with: java
tagged with: set
has comment: http://stackoverflow.com/comment/35167627
type: Question
has body: I have a big Integer Set, containing about 5.3M Integer, then I pass this Set to method-1 to process. after that i have lots of more steps to go, my question is with this big Integer set, it consumes lots of memory. is there any way i can release those memory after method-1 so the following method can execute without out of memory? I tried the followings: myBigIntegerSet.clear() and myBigIntegerSet = null I don't know if this is gotta help the memory usage at all, and if they are, which one works better? Thanks!
has comment: http://stackoverflow.com/comment/35168137

http://stackoverflow.com/a/22989501
has comment: http://stackoverflow.com/comment/95992819
has comment: http://stackoverflow.com/comment/95991318
has comment: http://stackoverflow.com/comment/50555375
has body: RestTemplate is thread safe (emphasis added): Conceptually, it is very similar to the JdbcTemplate, JmsTemplate, and the various other templates found in the Spring Framework and other portfolio projects. This means, for instance, that the RestTemplate is thread-safe once constructed Objects of the RestTemplate class do not change any of their state information to process HTTP: the class is an instance of the Strategy design pattern, rather than being like a connection object. With no state information, there is no possibility of different threads corrupting or racing state information if they share a RestTemplate object. This is why it is possible for threads to share these objects. If you examine the source code of RestTemplate you will see that it does not use synchronized methods or volatile fields to provide thread-safety after construction of the object. So it is not safe to modify a RestTemplate object after construction. In particular, it is unsafe to add a message converter. To provide it with a list of message converters you must do one of the following: Use the RestTemplate(List&lt;HttpMessageConverter&lt;?&gt;&gt; messageConverters) constructor. As the internal list of messageConverters is final, this safely publishes the list of message converters. Use the setMessageConverters(List&lt;HttpMessageConverter&lt;?&gt;&gt; messageConverters) mutator and then safely-publish the changed RestTemplate object. Using a Spring bean definition that has a &lt;property name="messageConverters"&gt;&lt;list&gt;... does this, as the bean will be safely published by the thread setting up the container in most practical use cases. Use List.add on the reference returned by getMessageConverters() and then safely publish the changed RestTemplate object. However, the documentation for RestTemplate does not explicitly state that it returns a reference that can be used to alter the list of message converters. The current implementation does, but possibly the implementation might…
has comment: http://stackoverflow.com/comment/82928855
has comment: http://stackoverflow.com/comment/59457671
has comment: http://stackoverflow.com/comment/59457894
accepted answer of: http://stackoverflow.com/q/22989500
has comment: http://stackoverflow.com/comment/49517596
upvote count: 112
has comment: http://stackoverflow.com/comment/46192077
score: 112
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/49515310
downvote count: 0
has comment: http://stackoverflow.com/comment/88612332
has comment: http://stackoverflow.com/comment/82927162
answers question: http://stackoverflow.com/q/22989500
has comment: http://stackoverflow.com/comment/59515537
type: Answer

http://stackoverflow.com/q/23089458
has comment: http://stackoverflow.com/comment/35290420
possible better answer: http://stackoverflow.com/a/23089607
answer count: 3
score: 1
has body: import android.graphics.Rect; Rect r1 = Rect(10,10,20,20); Rect r2 = Rect(20,20,30,30); Rect.intersects(r1, r2); //returns FALSE Why? In my world the rectangles should intersect at 20,20
favorite count: 0
has comment: http://stackoverflow.com/comment/35290424
has answer: http://stackoverflow.com/a/23089601
tagged with: android
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35290483
tagged with: java
has answer: http://stackoverflow.com/a/23089682
type: Question
accepted answer: http://stackoverflow.com/a/23089601
has title: Why does Rect(10,10,20,20) NOT intersect with Rect(20,20,30,30)
has answer: http://stackoverflow.com/a/23089607
downvote count: 0

http://stackoverflow.com/a/23101380
has comment: http://stackoverflow.com/comment/115585712
has comment: http://stackoverflow.com/comment/113722334
upvote count: 197
score: 189
has comment: http://stackoverflow.com/comment/35312111
has comment: http://stackoverflow.com/comment/79258427
has comment: http://stackoverflow.com/comment/124894566
answers question: http://stackoverflow.com/q/23101260
downvote count: 8
has comment: http://stackoverflow.com/comment/115620269
has comment: http://stackoverflow.com/comment/121462195
type: Answer
has body: Add the @JsonIgnoreProperties("fieldname") annotation to your POJO. Or you can use @JsonIgnore before the name of the field you want to ignore while deserializing JSON. Example: @JsonIgnore @JsonProperty(value = "user_password") public String getUserPassword() { return userPassword; } GitHub example
has comment: http://stackoverflow.com/comment/79258281
has comment: http://stackoverflow.com/comment/113661102
has comment: http://stackoverflow.com/comment/97078961
has comment: http://stackoverflow.com/comment/64561356
has comment: http://stackoverflow.com/comment/113660558
has comment: http://stackoverflow.com/comment/35311929
has comment: http://stackoverflow.com/comment/79257369
has comment: http://stackoverflow.com/comment/79258384
has comment: http://stackoverflow.com/comment/79191093
has comment: http://stackoverflow.com/comment/113676380
has comment: http://stackoverflow.com/comment/115601960
has comment: http://stackoverflow.com/comment/35311981

http://stackoverflow.com/q/22992757
tagged with: guava
tagged with: java
has comment: http://stackoverflow.com/comment/35122530
has answer: http://stackoverflow.com/a/22993912
possible better answer: http://stackoverflow.com/a/22997374
has answer: http://stackoverflow.com/a/22997374
answer count: 2
has comment: http://stackoverflow.com/comment/35120429
tagged with: null
accepted answer: http://stackoverflow.com/a/22993912
favorite count: 0
has title: Why does Guava's Optional use abstract classes when Java 8's uses nulls?
score: 2
has body: When Java 8 was released, I was expecting to find its implementation of Optional to be basically the same as Guava's. And from a user's perspective, they're almost identical. But Java 8's Optional uses null internally to mark an empty Optional, rather than making Optional abstract and having two implementations. Aside from Java 8's version feeling wrong (you're avoiding nulls by just hiding the fact that you're really still using them), isn't it less efficient to check if your reference is null every time you want to access it, rather than just invoke an abstract method? Maybe it's not, but I'm wondering why they chose this approach.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35116358
upvote count: 3
downvote count: 1
tagged with: java-8
type: Question

http://stackoverflow.com/a/23080972
has comment: http://stackoverflow.com/comment/35275807
answers question: http://stackoverflow.com/q/23080563
has comment: http://stackoverflow.com/comment/35276582
score: 1
has body: What's probably happening is that since you set the layout of panel to BorderLayout, any preferred size you set for ball doesn't matter, as BorderLayout doesn't respect preferred sizes. That being said, when you add ball, it extends to the size of the panel. Since JPanel is opaque by default, you can set the background to the panel, but you won't see it, because it's being covered by the ball panel. So a solution would just be to setOpaque(false) to ball. Also, unless you don't plan on doing anything to the new ball you're adding to the panel. You may want to give it a reference. ball someBall = new ball(); panel1.add(someBall ,BorderLayout.CENTER); It looks like you're trying to change the background of b, which is supposedly the ball in the panel, but you add a new ball() to the panel with no reference. So if you expect whatever b is to change the color of the new ball() you added, think again. You can, with the reference above, do someBall.setBackground() Also you should follow Java naming convention, class names begin with capital letters class ball &rarr; class Ball
has comment: http://stackoverflow.com/comment/35304446
downvote count: 0
has comment: http://stackoverflow.com/comment/35276411
type: Answer
has comment: http://stackoverflow.com/comment/35276490
has comment: http://stackoverflow.com/comment/35304572
upvote count: 1

http://stackoverflow.com/comment/35318833
has text: Hm, If I say that I want to learn the networking way that is best suitable for a bigger game (Like real multiplayer games...), does that make my decision easier? I looked at JInterface and that seems to be a good way to communicate between the languages. Does that do both network communication and language communication at the same time?
comment on: http://stackoverflow.com/a/23104190
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35186856
score: 0
comment on: http://stackoverflow.com/q/23031905
type: Comment
type: QuestionComment
has text: Over a period of 500ms :)

http://stackoverflow.com/q/23100725
upvote count: 1
tagged with: swing
type: Question
tagged with: graphics
tagged with: keylistener
has body: For a homework assignment I need to create a program that essentially displays a ball and the user should be able to move it using the left and right keys. However, the program isn't responding to the keys. I don't know where the bug is, and I'd appreciate it very much if someone could help! This is the code: public class GraphicsComponent extends JComponent { Ellipse2D.Double ball = new Ellipse2D.Double(200, 400, 80, 80); public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.RED); g2.fill(ball); g2.draw(ball); } } public class BallViewer { public static void main(String[] args) { JFrame frame = new JFrame(); //creates a new JFrame called frame frame.setSize(600,600); //invokes the method setSize on the implicit parameter frame frame.setTitle("Move this Ball"); //sets the title of the fram frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final GraphicsComponent g = new GraphicsComponent(); //creates a new GraphicsComponent called g, is final so that the inner class can access it frame.add(g);//adds component g to the frame frame.setVisible(true); //sets the visibility of the frame class PressListener implements KeyListener //creates an inner class that implements MouseListener interface { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_LEFT) { System.out.println("Left key pressed"); } if (e.getKeyCode() == KeyEvent.VK_RIGHT) { System.out.println("Right key pressed"); } } public void keyReleased(KeyEvent e) { } public void keyTyped(KeyEvent e) { } } PressListener listener = new PressListener(); g.addKeyListener(listener); } }
downvote count: 0
answer count: 1
tagged with: event-handling
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23100795
score: 1
tagged with: java
has title: Using KeyListener with Java

http://stackoverflow.com/comment/35262012
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23073357
has text: And call `super.paint`...
type: Comment

http://stackoverflow.com/q/23108223
tagged with: c#
answer count: 1
tagged with: wsdl
downvote count: 0
has comment: http://stackoverflow.com/comment/35323491
favorite count: 0
type: UnansweredQuestion
tagged with: soap
tagged with: web-services
has comment: http://stackoverflow.com/comment/35325034
score: 3
upvote count: 3
tagged with: java
has title: C# SOAP: The specified type was not recognized: name='arrayList'
has body: I have a client application in C# which is calling some methods from external SOAP service. To work with this service I have generated the proxy class from service WSDL. Everything is working fine except one operation. When I'm trying to call this operation it's throwing me CommunicationException with the following message: Error in deserializing body of reply message for operation 'my-operation-name' The InnerException is the following: The specified type was not recognized: name='arrayList', namespace='http://www.oracle.com/webservices/internal/literal', at &lt;validationErrors xmlns='http://view.label.com/types/'&gt;. I found the description of this element at WSDL file: &lt;element name="validationErrors" type="ns1:list" nillable="true" /&gt; but I can't see any references to arrayList datatype. This is the response from service: &lt;env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://view.label.com/" xmlns:ns1="http://view.label.com/types/" xmlns:ns2="http://www.oracle.com/webservices/internal/literal"&gt; &lt;env:Body&gt; &lt;ns0:getLabelResponseElement&gt; &lt;ns0:result&gt; &lt;ns1:statusMessage&gt;Error while reading xml label request.&lt;/ns1:statusMessage&gt; &lt;ns1:requestId/&gt; &lt;ns1:payload/&gt; &lt;ns1:labelId/&gt; &lt;ns1:status&gt;Error&lt;/ns1:status&gt; &lt;ns1:validationErrors xsi:type="ns2:list" xsi:nil="1"/&gt; &lt;ns1:statusCode&gt;LabelAssembler_03&lt;/ns1:statusCode&gt; &lt;/ns0:result&gt; &lt;/ns0:getLabelResponseElement&gt; &lt;/env:Body&gt; &lt;/env:Envelope&gt; Can you please point me to the possible source of this issue? If it's a problem at my client application part or it's a problem of compatibility because the service is written in Java and my client app in C#? Thanks in advance.
type: Question
has answer: http://stackoverflow.com/a/23112530

http://stackoverflow.com/a/23133311
score: 3
has body: For anybody that has a similar problem in the future, after cleaning the project, ensure that the build automatically box is checked under the project drop down menu as this is required to rebuild after clean, mine was unchecked by default for some reason. Also I made a small error in the code, I used annotations (@webservlet) in my servlet and I also added the servlet to my web.xml which caused a conflict. This is now done automatically with annotations.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23119018
answers question: http://stackoverflow.com/q/23119018
upvote count: 3

http://stackoverflow.com/q/23069381
has comment: http://stackoverflow.com/comment/35254987
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23076875
tagged with: spring
has title: NoSuchMethodError while using Generic DAO
tagged with: genericdao
tagged with: java
has answer: http://stackoverflow.com/a/23075741
tagged with: nosuchmethoderror
type: Question
tagged with: mongodb
has comment: http://stackoverflow.com/comment/35863675
has comment: http://stackoverflow.com/comment/35254640
has comment: http://stackoverflow.com/comment/35254768
has comment: http://stackoverflow.com/comment/35255047
has comment: http://stackoverflow.com/comment/35255386
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35254737
has comment: http://stackoverflow.com/comment/35255753
has comment: http://stackoverflow.com/comment/35255504
has comment: http://stackoverflow.com/comment/35256185
has comment: http://stackoverflow.com/comment/35255690
has body: I'm trying to use GenericDAO in a project : public class GenericDao&lt;T&gt; { ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringMongoConfig.class); MongoOperations mongoOperation = (MongoOperations) ctx.getBean("mongoTemplate"); public void save(T t) { mongoOperation.save(t); } public void delete(final T t) { mongoOperation.remove(t); } } The child class NoteDAO extends GenericDao and there's no need to override save/delete methods. But when I'm trying to use them I get: java.lang.NoSuchMethodError: com.example.dao.NoteDAO.save(Lcom/example/model/Note;)V Here is my NoteDAO, it's empty: public class NoteDAO extends GenericDao&lt;Note&gt; { public static Logger LOG = Logger.getLogger(NoteDAO.class); public static int counter = 0; } Why doesn't it work?

http://stackoverflow.com/comment/35255635
comment on: http://stackoverflow.com/q/23069902
score: 0
type: QuestionComment
type: Comment
has text: You need to remove the `String` and `Stack` from the parameters in your method call. You should be able to see the problem from there.

http://stackoverflow.com/q/23012328
has answer: http://stackoverflow.com/a/23012373
has answer: http://stackoverflow.com/a/23012481
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23015823
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35151221
has comment: http://stackoverflow.com/comment/35153233
has body: Is there any way using JTextArea to hide the text when user types?? Kind of like password.. in JTextArea i have.. password: in last line and whatever user types in that line shouldn't be visible. I have tried with setForeground method to set font colour to textarea colour which makes text invisible but allows user to copy and paste. is there any workaround or how can i achieve this?? Please help
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/35152642
accepted answer: http://stackoverflow.com/a/23015026
possible better answer: http://stackoverflow.com/a/23012481
has title: Password in JTextArea
upvote count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/23015026
favorite count: 0
tagged with: swing
answer count: 4

http://stackoverflow.com/comment/35337843
type: Comment
comment on: http://stackoverflow.com/a/23088889
has text: @user3536652 I've edited my post to only include `distinct` rows. This gets rid of your first problem. As for the second: it's normal behavior for Hibernate to return all elements of the set. You need an additional result transformer or filter code in java.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23045804
upvote count: 0
tagged with: java
downvote count: 2
has body: I need to validate if string is type alfanumric with dot I try with @"^[a-zA-Z0-9]+$" which is not working the string can be like abc.abc abc abc.abc not other special char like ^ or &amp; ( etc what am I doing wrong
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/23045826
score: -2
accepted answer: http://stackoverflow.com/a/23045826
has title: Validate alfanumric with dot
answer count: 1
favorite count: 0
tagged with: regex
type: AnsweredQuestion

http://stackoverflow.com/comment/35341236
has text: Thank you. Now I learn another way of using lambda expression. The function Math.sqrt() should be applied to the denominator only after the summation. I guess that's why you wrote the ... But does that imply I have to calculate the denominator in another Stream?
comment on: http://stackoverflow.com/a/23116690
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/40779117
has body: I don't think you should be calling: chain.doFilter(request, response); If all you want to do is send error code back. Just call return logger.info("Didnt create user since: "+e.getMessage()); response.sendError(HttpStatus.CONFLICT.value()); return;
score: 1
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23003191

http://stackoverflow.com/q/23111302
has body: I am tasked with writing an application in Java (it is not web hosted, but rather deployed to multiple platforms - this decision is not in my control). I know Java well enough to do this and MySQL enough to seem clever but is probably dangerous. I am not an expert though which is why I'm here asking for design help with this. Here are the requirements: 1) The java application will require generic read access to certain tables in a database - This does not need access control 2) The java application will need to be able to modify a few specific tables (not necessarily on the same database - but some are), but only when the user accid matches the rows in that table 3) Due to the nature of the infrastructure the users cannot access the database directly for the read data (though they could for the write data) How do I give users write access to a table so that they only insert/modify on their account id. If they have write access to a table they could modify rows that aren't tied to their account id. And while I can set the app to make sure it ties it to their account, if they have write access they can access it outside the app? And if I make a generic write account for the app they could simply view the user/pass in the java code which is as bad? The infrastructure will not allow me to set up a real server-client communication system (which could handle auth and processing). The the best I can do is background process that only communicates with internal systems. This app will be external. The best I could do is allow the external users access to a database. I was thinking something like having the app work on a seperate replicated database and then have the background process transfer it to the real one (this doesn't need to be real time so..) but it doesn't solve the inherent security issue with write access. Is there a way to give users conditional write access to a table (condtiional on their accid matching) wholly within MySQLs security features? The read data i…
type: Question
has comment: http://stackoverflow.com/comment/35328940
has title: Java and MySQL Convoluted Setup
tagged with: security
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35361645
has comment: http://stackoverflow.com/comment/35329320
has comment: http://stackoverflow.com/comment/35328547
score: 0
tagged with: java
tagged with: mysql

http://stackoverflow.com/comment/35099399
score: 0
type: Comment
has text: It will not work he have set the layout in his dialog explicitly. He is not using his `View layout` anywhere.
comment on: http://stackoverflow.com/a/22984123
type: AnswerComment

http://stackoverflow.com/q/23027662
has comment: http://stackoverflow.com/comment/35179741
type: Question
has comment: http://stackoverflow.com/comment/40371535
tagged with: intellij-idea
score: 0
has comment: http://stackoverflow.com/comment/35179100
has body: JDK 1.7 shows invalid in the project structure. I am unable to auto resolve any symbol in my project. I am not sure if these two are related but can someone please help me out?
has title: IntelliJ IDEA 11.1.5 - jdk 1.7 shows invalid in project structure
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35179712
has comment: http://stackoverflow.com/comment/38346756
tagged with: java

http://stackoverflow.com/comment/35088463
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22975482
has text: @ajb: I think in the question the case where there is no * but the boolean is true is not defined. the 3 other cases are covered by my snippet. I'm satified with that, and java is too verbose to handle that sort of things in short and nice code.

http://stackoverflow.com/comment/35194347
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23034679
score: 0
has text: Expected Output: 3 5 6 7 8

http://stackoverflow.com/comment/35116580
has text: Doesn' t the second constructor expression get a single_valued_path_expression? `new Child(ch) from children ch`
comment on: http://stackoverflow.com/a/22993319
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35092405
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22979602
has text: What ist `Name` in `int i=st.executeUpdate("insert into test1(name) values('"+Name+"')");`?
score: 0

http://stackoverflow.com/a/23069550
has comment: http://stackoverflow.com/comment/35255726
has comment: http://stackoverflow.com/comment/35255830
has comment: http://stackoverflow.com/comment/35255265
upvote count: 3
has body: Everything in Java is passed by value. In this first method public void first() { int i = 5; Value v = new Value(); v.i = 25; second(v, i); System.out.println(v.i); } you pass the value of the reference stored in v (which points to a Value object with an i field with value 15) to second. public void second(Value v, int i) { i = 0; v.i = 20; Value val = new Value(); v = val; System.out.println(v.i + " " + i); } It dereferences the reference value to find a Value object and changes its i field value to 20. You then create a new Value object with its i field value initialized to 15. That's what you're printing 15 0 The method returns and first prints the value of the object the local variable v is referencing, ie. 20
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35255095
accepted answer of: http://stackoverflow.com/q/23069436
type: Answer
answers question: http://stackoverflow.com/q/23069436
has comment: http://stackoverflow.com/comment/35255202
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/35255111

http://stackoverflow.com/comment/35338582
type: Comment
comment on: http://stackoverflow.com/q/23116017
type: QuestionComment
has text: If your dictionary is not too large, you can read the file and put the words in some data structure and check it that way.
score: 0

http://stackoverflow.com/comment/35160437
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23017659
has text: Yes, the stacktrace is the error message + the lines of code that called it. Btw, do you get your variable names from a random number generator?
score: 0

http://stackoverflow.com/a/23057759
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23056381
has comment: http://stackoverflow.com/comment/35234922
answers question: http://stackoverflow.com/q/23056381
has comment: http://stackoverflow.com/comment/35269541
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35234087
has body: I believe your problem is here: hibernate.c3p0.max_size=20 This parameter has the following documentation: hibernate.c3p0.max_size This is the maximum number of connections in the pool. An exception is thrown at runtime if this number is exhausted. Obviously if you have 97331 simultaneous connections you are going to trigger the exception mentioned above which is, I imagine, exactly what is happening. I would suggest limiting your ThreadPool to also only have 20 simultaneous threads running at a time. This depends on your use case though. For example, if you are running the sort of application which is just starting up, performing this job and then closing down, then the method I suggested will work fine. However, if your application is a long running application (perhaps a webapp) and requires other database connections happening from other users, then I would suggest setting the ThreadPool max a lot lower (perhaps 10), and ensuring the c3p0 limit isn't breached in another way (by having too many users connected at once, or too many of these jobs running). Upping the c3p0 limit will help as well. I have a feeling there's no point going higher than 100, but I can't remember exactly why, sorry.
type: Answer
has comment: http://stackoverflow.com/comment/35234846
has comment: http://stackoverflow.com/comment/35270219

http://stackoverflow.com/q/23005726
tagged with: powershell-3.0
accepted answer: http://stackoverflow.com/a/23007481
upvote count: 1
downvote count: 1
has title: Compile and Run HelloWorld.java on linux
type: Question
has comment: http://stackoverflow.com/comment/35138357
tagged with: java
has comment: http://stackoverflow.com/comment/35138444
has comment: http://stackoverflow.com/comment/35138394
score: 0
answer count: 1
tagged with: shell
favorite count: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/35138349
has answer: http://stackoverflow.com/a/23007481
tagged with: unix
type: AnsweredQuestion
has body: I have created HelloWorld.java file in a linux folder. I would like to compile and run it. As I am doing it first time, and no such question posted here. Below is the content of Java File: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello...How are you"); } } I see Java is installed on the server. Below are commands and their output. rakeshth@ldnserver000590 DEV $ ls HelloWorld.java rakeshth@ldnserver000590 DEV $ java -version java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode) rakeshth@ldnserver000590 DEV $ javac HelloWorld.java -bash: javac: command not found rakeshth@ldnserver000590 DEV $ java HelloWorld.java Error: Could not find or load main class HelloWorld.java Please, let me know steps to compile and run this Java file.

http://stackoverflow.com/q/23097696
favorite count: 0
has comment: http://stackoverflow.com/comment/35305797
has comment: http://stackoverflow.com/comment/35305750
has comment: http://stackoverflow.com/comment/35306056
has answer: http://stackoverflow.com/a/23097769
has title: breaking out of an "if" statement and going back to the start of a "for" loop
has comment: http://stackoverflow.com/comment/35305786
tagged with: if-statement
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/23097790
has answer: http://stackoverflow.com/a/23097786
has comment: http://stackoverflow.com/comment/35306168
upvote count: 4
has comment: http://stackoverflow.com/comment/35306012
tagged with: for-loop
answer count: 5
has body: So, for an assignment for class, I have to take user input and assign the amount of "food" that my gerbil objects can use per day. In this situation, I have already taken the max amount of food daily from the user and need to give an error message to the user if they attempt to input a value above the daily max. If this is the case, they need to be re-prompted to enter the amount of food the gerbil eats. I can't seem to figure out how to break out of the "if" statement and go back to the top of the "for" loop. Here is my code: for (int j = 0; j &lt; numberOfFoods; j++) { System.out.println(gerbilId[index].substring(index) + " eats how many " + foodNames[j] + "s per day"); int amountOfFood = keyboard.nextInt(); if (amountOfFood &gt; foodMax[j]) { System.out.println("Error. Please input a valid amount of food"); break; } else { gerbilConsumption[index] = amountOfFood; } }
has answer: http://stackoverflow.com/a/23098809
has comment: http://stackoverflow.com/comment/35305782
type: Question
type: AnsweredQuestion
tagged with: break
accepted answer: http://stackoverflow.com/a/23097790
has answer: http://stackoverflow.com/a/23097837
score: 1
possible better answer: http://stackoverflow.com/a/23097769

http://stackoverflow.com/q/23061482
has comment: http://stackoverflow.com/comment/35243513
has comment: http://stackoverflow.com/comment/35242458
has comment: http://stackoverflow.com/comment/35242274
has comment: http://stackoverflow.com/comment/35239769
score: 0
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/23063615
tagged with: deserialization
has comment: http://stackoverflow.com/comment/35243247
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35242706
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23061602
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35242852
answer count: 2
has body: public class ViewBooking extends javax.swing.JFrame { /** * Creates new form ViewBooking */ public ViewBooking() { initComponents(); } public void dispBookingInfo(){ Reservation[] reservations = new Reservation[1]; try { String searchCust = SearchName.getText(); FileInputStream inStream = new FileInputStream(searchCust + "booking.dat"); ObjectInputStream objectInputFile = new ObjectInputStream(inStream); reservations[0] = (Reservation) objectInputFile.readObject(); objectInputFile.close(); } catch (Exception e) { } JOptionPane.showMessageDialog(null, reservations[0].getDetails()); } This is my Reservation class public class Reservation implements Serializable { private String name; private String sDate; private String eDate; private String noOfDays; private String roomNo; private String totalAmt; Reservation(String name, String sDate, String eDate, String noOfDays, String totalAmt, String roomNo) { this.name = name; this.totalAmt = totalAmt; this.roomNo = roomNo; //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getsDate() { return sDate; } public void setsDate(String sDate) { this.sDate = sDate; } public String geteDate() { return eDate; } public void seteDate(String eDate) { this.eDate = eDate; } public String getNoOfDays() { return noOfDays; } public void setNoOfDays(String noOfDays) { this.noOfDays = noOfDays; } public String getRoomNo() { return roomNo; } public void setRoomNo(String roomNo) { this.roomNo = roomNo; } public String getTotalAmt() { return totalAmt; } public void setTotalAmt(String totalAmt) { this.totalAmt = totalAmt; } public String getDetails(){ return "Name: " + name + "\n" + "From: " + sDate + " to " + eDate + "\n" + "Duration: " + noOfDays + "Room No: " + roomNo + "Total amount: RM" + totalAmt; } } I am able to serialize the Reservation object but when …
has title: java.lang.NullPointerException when deserializing
has comment: http://stackoverflow.com/comment/35239773

http://stackoverflow.com/comment/35184303
type: Comment
comment on: http://stackoverflow.com/a/23029463
has text: You proved it yourself when you printed the system property "user.dir". You seem to be confused between 'working directory ... where my source code is' and 'working directory' as known to the operating system. They don't have to be the same thing.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23077099
has title: Error in Java Ajax Client application consuming a server side Ruby REST API
answer count: 1
tagged with: jquery
tagged with: ajax
tagged with: ruby
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35269070
has body: I have a client side application in java (JSP + AJAX + JQUERY) and a server side application in ruby that exposes a REST API. i am trying to have the client application consume this ruby based REST API using the following code: $.ajax({ type: 'GET', url: 'http://localhost:4567/apps', success : function(data){ alert ('success'); }, error : function(jqXHR, textStatus, errorThrown){ alert(jqXHR.status); alert(textStatus); alert(errorThrown); } }); However, the error component is invoked each time I try. The server side code is as follows: get "/apps" do apps = get_apps apps.map { |a| a.name }.to_json end When I make a call to the above REST API using browser (http://localhost:4567/apps) I get the expected response which is a string of app names in json format. Also, I checked the ruby console, for calls from browser I have the following response: Computer Name - - [15/Apr/2014:12:29:19 India Standard Time] "GET /apps HTTP/1.1" 200 186 and for calls from the java application all I have on the console is: http://localhost:8080/MyApp/pages/index.jsp -&gt; /apps I wonder what is wrong here. Would be great if some one could help out please.
has comment: http://stackoverflow.com/comment/35268645
has comment: http://stackoverflow.com/comment/35269058
tagged with: java
type: Question
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23086443
score: 0
has comment: http://stackoverflow.com/comment/35268872

http://stackoverflow.com/q/23001815
tagged with: class
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23002363
has body: my previous questions have been taken care of. However I'm having an issue with the accuracy of data I'm pulling from another class. I'm aware that currentScore.finalScore only updates when used. However, I have finalScore = currentScore.finalScore. The print line I have shows that it updates, but by seemingly random numbers and even when this number causes the while statement to become false, it continues infinitely. public static void main(String[] args) { Scanner keyboard = new Scanner (System.in); String buddyName; String userChoice; int maxScore = 10; int minScore = 0; System.out.print("Nurse: The Patient's first name is "); buddyName = keyboard.nextLine(); System.out.print("You: Let's see, I should (C)hange " + buddyName + "'s bandages," + "(G)ive " + buddyName + " pain medication, " + "(A)dd antibiotics to " + buddyName + "'s I.V," + " or (D)ischarge " + buddyName + " "); userChoice = keyboard.nextLine(); Buddy score = new Buddy(userChoice); BuddyScore currentScore = new BuddyScore(score); int finalScore; do { System.out.print("You: Let's see, I should (C)hange " + buddyName + "'s" + " bandages, (G)ive " + buddyName + " pain medication, " + "(A)dd antibiotics to " + buddyName + "'s I.V," + " or (D)ischarge " + buddyName + " "); userChoice = keyboard.nextLine(); score.setUserChoice(userChoice); finalScore = currentScore.getFinalScore(); System.out.println(currentScore.getFinalScore()); }while (currentScore.getFinalScore() &lt; maxScore &amp;&amp; currentScore.getFinalScore() &gt;= minScore); System.out.println("Curren score: " + currentScore.getFinalScore()); } } Below is my class that handles the finalScore, and is the class I'm suspect of. public class BuddyScore { private Buddy buddyScore; public int finalScore; public BuddyScore(Buddy buddyScore){ this.buddyScore = buddyScore; this.finalScore = finalScore; } public void setFinalScore(int finalScore){ this.finalScore = finalScore; } public int getFinalScore(){ return finalScore += buddyScore.getBuddyScore()…
has title: Java- Issue with Return Data's accuracy inside of a loop
possible better answer: http://stackoverflow.com/a/23002363
has answer: http://stackoverflow.com/a/23003087
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: infinite-loop
accepted answer: http://stackoverflow.com/a/23003087

http://stackoverflow.com/a/23046935
upvote count: 6
accepted answer of: http://stackoverflow.com/q/23046897
has body: Just do this: ^one two (.*?) four.*$ Or you can use \S which means non whitespace characters, ^one two (\\S+) four.*$
answers question: http://stackoverflow.com/q/23046897
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 6

http://stackoverflow.com/comment/35205797
comment on: http://stackoverflow.com/q/23042876
has text: Can you please rephrase exactly what you want to happen and perhaps highlight or comment the exact line of code where you are having the problem?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35081828
comment on: http://stackoverflow.com/q/22973797
has text: could it be related to different endianess maybe ?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23092178
upvote count: 4
has body: I'm trying to implement a handle to scale a view in android. Instead of using something like multitouch I want to be able to resize an image with just one finger. Here is my activity code. I feel as though I am very close there are a five things that don't work properly. The scaling is off. It grows at a much faster rate than it should. Solved Thanks @Salauyou The view will only grow, and not shrink. Solved Thanks @Salauyou The handle view doesn't move with the image. Solved Thanks @Salauyou The scaling starts extremely small Solved Thanks @Salauyou The handle doesn't follow your finger exactly. I am looking for any help that could implement such a feature. Whether it's a library or someone can help with my code that I already have. I have found a library that helps with multi touch scaling of images (https://github.com/brk3/android-multitouch-controller) but the only pointer I could pick up was how to go about implementing the increase in scale. And this has to be done through using two points, and finding the distance between them. My java activity: public class MainActivity extends Activity { ImageView imageView; ImageView dragHandle; RelativeLayout layout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); imageView = (ImageView) findViewById(R.id.imageView1); imageView.setBackgroundColor(Color.MAGENTA); dragHandle = (ImageView) findViewById(R.id.imageView2); dragHandle.setBackgroundColor(Color.CYAN); layout = (RelativeLayout) findViewById(R.id.relativeLayout2); layout.setBackgroundColor(Color.YELLOW); setUpResize(); } public void setUpResize() { dragHandle.setOnTouchListener(new View.OnTouchListener() { int[] touchPoint = new int[2]; int[] centerOfImage = new int[2]; double originalDistance = 0; double modifiedDistance = 0; float originalScale = 0; float modifiedScale = 0; public boolean onTouch(View v, MotionEvent motionEvent) { if (motionEvent.getAction() == MotionEvent.AC…
has comment: http://stackoverflow.com/comment/35299838
has comment: http://stackoverflow.com/comment/35299053
tagged with: android-widget
answer count: 1
downvote count: 0
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/35299139
tagged with: android
has answer: http://stackoverflow.com/a/23096147
has comment: http://stackoverflow.com/comment/35298779
has comment: http://stackoverflow.com/comment/35299460
has comment: http://stackoverflow.com/comment/35297393
has comment: http://stackoverflow.com/comment/35299617
has comment: http://stackoverflow.com/comment/35299409
has comment: http://stackoverflow.com/comment/35299300
has comment: http://stackoverflow.com/comment/35298919
accepted answer: http://stackoverflow.com/a/23096147
has comment: http://stackoverflow.com/comment/35299828
has title: How to scale a view in android using a handle?
tagged with: android-imageview
has comment: http://stackoverflow.com/comment/35299827
type: Question
type: AnsweredQuestion
tagged with: android-view
has comment: http://stackoverflow.com/comment/35299719
tagged with: java
linked to: http://stackoverflow.com/q/23115472
has comment: http://stackoverflow.com/comment/35298830
has comment: http://stackoverflow.com/comment/35299026
has comment: http://stackoverflow.com/comment/35295877
has comment: http://stackoverflow.com/comment/35299549

http://stackoverflow.com/a/23028052
has body: A variable of primitive type int always takes up 4 bytes (and has a range of -2^31 to 2^31-1) and a variable of primitive type long always takes up 8 bytes (-2^63 to 2^63-1). What you may be looking for is java.lang.BigInteger. It's initial footprint is much larger then int or long, but it can store much, much larger values than 2^63-1 and its storage grows with the value inside it. The size of a BigInteger depends on the VM - because the size of an object reference in Java is not the same across platforms, and because the size of an object header isn't even always the same during the life cycle of an object. On a 64-bit VM, it could be 16 (object header) + 20 (array header) + 5*4 (int fields in BigInteger) + 8 (reference to array) = 64 bytes footprint plus the number of bytes necessary to hold the number.
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/35187894
answers question: http://stackoverflow.com/q/23027712
downvote count: 0
score: 1

http://stackoverflow.com/comment/35249559
has text: What if, when I enter `onSaveInstanceState()` and before I have the change to shut the executor down, the UI thread has already been posted some runnables. Is it possible to enter `onSaveInstanceState()` with the UI thread having been posted some runnables waiting to be executed, or Android makes sure this doesn't happen?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23058839
type: Comment

http://stackoverflow.com/comment/35206094
type: AnswerComment
type: Comment
has text: `class Car <Z extends Car<Z, A>, A extends B>`. Generics can get ugly. I just don't know any other way.
comment on: http://stackoverflow.com/a/23042094
score: 0

http://stackoverflow.com/comment/35253078
comment on: http://stackoverflow.com/q/23068041
score: 0
type: Comment
type: QuestionComment
has text: @KalelWade, apologies. I only added uDevel's log. I'll add yours now.

http://stackoverflow.com/comment/35155600
has text: @LionC Yeah, there are also 2 separate for Java bytecode instructions aswell. However modern compilers do not simply translate instructions from source code to object code. They will often restructure the code according to the syntax tree. While it will naturally depend largely on the compiler, it is likely that any type of constant comparison will end up being identical.
type: Comment
comment on: http://stackoverflow.com/a/23011336
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35321446
has text: ... all in the same class as the one that deals with the trapezoid algorithm. If you're using Java 8, I would recommend having a single class that implements the trapezoid algorithm; and pass the function that you're trying to integrate as a lambda.
comment on: http://stackoverflow.com/a/23101839
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23045759
has title: Trying to condense else if statements
score: 1
has answer: http://stackoverflow.com/a/23045834
upvote count: 1
type: Question
tagged with: java
tagged with: configuration-files
tagged with: bukkit
has body: I currently have this code: if(event.getMessage().contains(plugin.getConfig().getString("PBSwears.words.word1"))) { String message = event.getMessage().replaceAll(plugin.getConfig().getString("PBSwears.blocked.word1"), plugin.getConfig().getString("PBSwears.replace.word1")); event.setMessage(message); } else if(event.getMessage().contains(plugin.getConfig().getString("PBSwears.words.word2"))) { String message = event.getMessage().replaceAll(plugin.getConfig().getString("PBSwears.blocked.word2"), plugin.getConfig().getString("PBSwears.replace.word2")); event.setMessage(message); } And it is going to go on for about 6 times that...I'm trying to condense it into something like: String number = {find whitch number the message contains}; if(event.getMessage().contains(plugin.getConfig().getString("PBSwears.words.word" + number))) { String message = event.getMessage().replaceAll(plugin.getConfig().getString("PBSwears.blocked.word" + number), plugin.getConfig().getString("PBSwears.replace.word" + number)); event.setMessage(message); } But I'm struggling with trying to find which number the word is contained in(PBSwears.words.word1 or PBSwears.words.word2). I've tried something like this: char number='0'; if(event.getMessage().contains(plugin.getConfig().getString("PBSwears.words.word1"))) { number='1'; } else if(event.getMessage().contains(plugin.getConfig().getString("PBSwears.words.word2"))) { number='2'; } But then once again there is a long amount of else if statements. Also, I'm reading the values out of a config file that looks like this: PBSwears: blocked: word1: *insert vulgar language* word2: *insert vulgar language* replace: word1: *insert funny replacement* word2: *insert funny replacement* Any insight would be very helpful.
has answer: http://stackoverflow.com/a/23045919
has answer: http://stackoverflow.com/a/23045837
has comment: http://stackoverflow.com/comment/35211232
answer count: 3
possible better answer: http://stackoverflow.com/a/23045919
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23045837
type: AnsweredQuestion

http://stackoverflow.com/q/23022939
has answer: http://stackoverflow.com/a/23023062
accepted answer: http://stackoverflow.com/a/23023062
has title: Unable to figure out behaviour : Method reference with lambda
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
downvote count: 0
tagged with: method-reference
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23022981
type: Question
possible better answer: http://stackoverflow.com/a/23022981
answer count: 2
upvote count: 1
has body: Consider below code, class DemoStatic { public static Runnable testStatic() { return () -&gt; { System.out.println("Run"); }; } public void runTest () { Runnable r = DemoStatic::testStatic; r.run(); } } public class MethodReferenceDemo { public static void main(String[] args) { DemoStatic demo = new DemoStatic(); demo.runTest(); } } run() method of Runnable instance that is being return by testStatic method was supposed to be invoked. And output on console should be "Run". But this code is not invoking run() method of instance r and nothing is getting printed in console. Can some one please explain the reason. And comment if I am not using Method reference "::" properly.
favorite count: 0

http://stackoverflow.com/q/23083136
score: 1
has answer: http://stackoverflow.com/a/23083276
has comment: http://stackoverflow.com/comment/35278853
favorite count: 0
has comment: http://stackoverflow.com/comment/35278971
has comment: http://stackoverflow.com/comment/35279168
downvote count: 2
tagged with: jdbc
type: AnsweredQuestion
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/23083276
has title: JDBC resultset count (number of rows)
type: Question
has body: JDBC API has provided a rich set of functions for the programmers to carry on the database operations. I am surprised what restricted them to provide a function such as getCount() that will return the number of rows obtained by executing a query.
answer count: 1

http://stackoverflow.com/a/23121857
answers question: http://stackoverflow.com/q/23121699
accepted answer of: http://stackoverflow.com/q/23121699
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
has body: Is there a way to make an enum in Java that cannot be null? No. Alternately, can a newly-declared enum have a default value the same way boolean defaults to false and number types default to 0? No. The default value for any reference type is null.
score: 3

http://stackoverflow.com/comment/35113905
comment on: http://stackoverflow.com/q/22985846
score: 0
type: Comment
type: QuestionComment
has text: Ok. Thanks for the inputs. I'll check using firebug.

http://stackoverflow.com/comment/35100998
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22984874
has text: This answer should have been a comment, and the comment is bad advice and should be deleted.
score: 0

http://stackoverflow.com/q/23055964
has comment: http://stackoverflow.com/comment/35230047
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23056201
has title: update on many-to-one hibernate relationship no works
type: Question
answer count: 2
has body: I have a problem with hibernate relationship many-to-one. My system is commercial proposal controller, where has a responsible for proposal from user entity. When the proposal is create and set the responsible, has no problems, works fine. But when change the responsible and update, it changes the object, I can see in a datatable, but has no update in database. If I refresh on page the update disapears. @Entity @Table(name = "proposal") public class Proposal implements Serializable { @Id @GeneratedValue private Integer id; @ManyToOne private User responsible; ............ DAO Code public void update(Proposal proposal) { this.session.update(proposal); } In the User class I don't make any annotation about this relationship, it's a unidirectional relationship. The class proposal yet use the user class to make a user's bag, as participants, and this relationship will be unidirectional relationship too. I tried to make annotations in user class but no works too. User class with annotations @Entity @Table(name="user") public class User implements Serializable{ @OneToMany private List&lt;Proposal&gt; proposal; The class User has a many-to-one relationship with userType and it works fine. @Entity @Table(name="user") public class User implements Serializable{ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "idType, nullable = true) private TipoUsuario userType; Someone has any ideia about this? Thanks
tagged with: jpa
has answer: http://stackoverflow.com/a/23056244
score: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35357987
type: AnswerComment
comment on: http://stackoverflow.com/a/23126733
score: 0
type: Comment
has text: @Akash did you use the reset eventually?

http://stackoverflow.com/a/23054157
accepted answer of: http://stackoverflow.com/q/23039505
answers question: http://stackoverflow.com/q/23039505
type: AcceptedAnswer
has body: You may achieve this using Chain Result type. In this after execution of one action, another action will be executed sequentially. anotherAction pages/failure.jsp pages/success.jsp pages/failure.jsp You should refer this link [a link]http://viralpatel.net/blogs/struts-2-action-chaining-example/
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35278130

http://stackoverflow.com/a/23003851
answers question: http://stackoverflow.com/q/23003570
downvote count: 0
has comment: http://stackoverflow.com/comment/37403112
upvote count: 8
type: Answer
score: 8
has body: It looks like you need to change the scope of some of your dependencies. For example, the compiler seems to be complaining about missing the ObjectMapper class. This likely refers to the ObjectMapper class within the Jackson dependency. Try updating your dependencies as follows: org.codehaus.jackson jackson-core-asl 1.9.13 compile org.codehaus.jackson jackson-mapper-asl 1.9.13 compile Also, for your reference, see the Maven documentation about dependency scope: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope Chances are this change will only resolve some of the compile errors. You may have to change the scope of other dependencies through trial and error.

http://stackoverflow.com/comment/35195656
comment on: http://stackoverflow.com/a/23036991
type: AnswerComment
score: 0
type: Comment
has text: But what is this animal?

http://stackoverflow.com/q/23041306
has comment: http://stackoverflow.com/comment/35203020
upvote count: 1
has comment: http://stackoverflow.com/comment/35203025
type: Question
has answer: http://stackoverflow.com/a/23041375
tagged with: arraylist
has title: Android change Arraylist item value
has body: I have an ArrayList that is being read from a Text file. The array list is being displayed in a ListView. I can add and Remove items from the arraylist without an issue. I have an issue however, where the application just crashes when ever I try to modify the ArrayList. Here is the code I'm using to modify the arrayList. input2 = (EditText) promptView.findViewById(R.id.userInput); input2.setText(array.get(id).toString()); alertDialogBuilder.setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { String value2 = input2.getText().toString(); array.set(id, value2.toString()); adapter.notifyDataSetChanged(); } }) LogCat only reports an "ArrayIndexOutOfBoundsException" error. What am I doing wrong?
downvote count: 0
answer count: 1
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23041375
tagged with: android
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/35111890
comment on: http://stackoverflow.com/q/22991050
score: 0
type: Comment
type: QuestionComment
has text: Post your stacktrace from the Logcat view in Eclipse so we can help you.

http://stackoverflow.com/a/23110046
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23109863
downvote count: 0
score: 1
has body: You can drag the console anywhere you want. If you move it outside the Eclipse window, it is completely detached.

http://stackoverflow.com/q/23128219
tagged with: string
has answer: http://stackoverflow.com/a/23128272
answer count: 4
tagged with: parsing
has body: 3375577.3 131 STSTWMS 3375577.4 131 STSTWMS 3407108 131 STSTWMS 3407231 131 STSTWMS 3407280.1 131 STSTWMS 3407581 131 STSTWMS 3408483 131 STSTWMS 3409015 131 STSTWMS 3409015.1 131 STSTWMS 3409085.1 131 STSTWMS 3409364 131 STSTWMS 3409364.1 131 STSTWMS my text file have the above format. each line represents the information related to a patch with the first colum is patch id, the second column is the release and the third one represent a client. how can i read the file line by line storing patchs into an array list and parsing the fields into columns
tagged with: field
score: 0
type: UnansweredQuestion
tagged with: line
has answer: http://stackoverflow.com/a/23128284
tagged with: java
has answer: http://stackoverflow.com/a/23128287
has title: parsing the content of a text file line by line using java
type: Question
has answer: http://stackoverflow.com/a/23128456
has comment: http://stackoverflow.com/comment/35359408

http://stackoverflow.com/comment/35241265
comment on: http://stackoverflow.com/a/23059982
score: 0
has text: @DavidHofmann I updated my answer. Does this help? If not, I fear that I did not understand your problem very well.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23121580
possible better answer: http://stackoverflow.com/a/23121760
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/23122641
tagged with: javafx
type: Question
answer count: 2
score: 3
tagged with: user-interface
downvote count: 0
has body: I'm attempting to make a modal dialog similar to Swing's JOptionPane. I want to present a confirmation dialog which makes the users explicitly say "yes" before I perform some action in code. I've shamelessly stolen this example from: https://gist.github.com/jewelsea/1887631 And modded it to be: public class ModalConfirmDialog { private boolean confirm = false; private boolean isDialogOpen = false; public boolean isOpen() { return isDialogOpen; } public boolean getConfirmation() { return confirm; } public void showConfirmationDialog(final Stage primaryStage) { // initialize the confirmation dialog final Stage dialog = new Stage(StageStyle.TRANSPARENT); dialog.initModality(Modality.WINDOW_MODAL); dialog.initOwner(primaryStage); dialog.setScene( new Scene( HBoxBuilder.create().styleClass("modal-dialog").children( LabelBuilder.create().text("Confirm Action?").build(), ButtonBuilder.create().text("Yes").defaultButton(true).onAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent actionEvent) { // take action and close the dialog. primaryStage.getScene().getRoot().setEffect(null); dialog.close(); confirm = true; isDialogOpen = false; } }).build(), ButtonBuilder.create().text("No").cancelButton(true).onAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent actionEvent) { // abort action and close the dialog. primaryStage.getScene().getRoot().setEffect(null); dialog.close(); confirm = false; isDialogOpen = false; } }).build() ).build() , Color.TRANSPARENT ) ); dialog.getScene().getStylesheets().add(getClass().getResource("modal-dialog.css").toExternalForm()); // allow the dialog to be dragged around. final Node root = dialog.getScene().getRoot(); final Delta dragDelta = new Delta(); root.setOnMousePressed(new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent mouseEvent) { // record a delta distance for the drag and drop operation. dragDelta.x = dialog.getX() - mouseEvent.getScreenX();…
has answer: http://stackoverflow.com/a/23122641
has title: Block program execution until user clicks button
favorite count: 0
has answer: http://stackoverflow.com/a/23121760
type: AnsweredQuestion

http://stackoverflow.com/a/31413577
type: Answer
has body: This problem is mostly associated with file permissions. So the best way to solve the problem is to install a local copy of Tomcat on your development machine instead of putting Tomcat in a system directory such as /usr/share/tomcat7. This way all Tomcat conf files belong to the user and user group so that it can be run from Eclipse by the user. I normally place Tomcat at my local folder such as /home/abc/dev and it works perfectly with Eclipse development environment.
score: 0
answers question: http://stackoverflow.com/q/23003617

http://stackoverflow.com/a/33705852
has body: I also had the same problem when I try to make an application to detect faces. I used bytedeco/javacv. The problem occurred when parsing the XML model. I used this haarcascade_frontalface_alt.xml model. Then I worked fine.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22977986
downvote count: 0

http://stackoverflow.com/a/22975921
has comment: http://stackoverflow.com/comment/93165898
has body: Error messages of this type indicate a difference between the types of parameters you're giving the method, and the types it expects. In this case it is asking for a String and an Array of Object(Object[]) but you're giving it a String and two Integers. You need to package these as an Array first. int [] temp = {event.getX(), event.getY()}; statusbar.setText(String.format("%d, %d", temp);
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/83372871
accepted answer of: http://stackoverflow.com/q/22975413
answers question: http://stackoverflow.com/q/22975413
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/35306514
comment on: http://stackoverflow.com/a/23098096
has text: thanks prash, i changed this in the code, and the error i am getting is: "incompatible types: String cannot be converted to ValidCustomerType"
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35336523
score: 0
type: Comment
has text: Im new in developing, dont get it ... So I have to add something on my line 25 in MainActivity.Java? Couse there is : pushMe.setOnClickListener(new View.OnClickListener() {
comment on: http://stackoverflow.com/a/23115419
type: AnswerComment

http://stackoverflow.com/comment/35213058
type: Comment
has text: Set is an interface: HashSet is ok, TreeSet is ok, ArrayList is not ok.
comment on: http://stackoverflow.com/a/23046617
score: 0
type: AnswerComment

http://stackoverflow.com/a/23139292
answers question: http://stackoverflow.com/q/23088597
has body: I like spring-security's expression-based access control for annotating controller methods with allowed roles, but you could use url interceptors instead, if your actions are easily separable by url and/or HTTP verb. Either solution should prevent them from performing any actions they shouldn't. Then you might also limit the data and/or links the user can see simply by specifying a different view if they lack a certain role (or by using the spring security authorize tag within the same view).
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/35393733
type: Answer

http://stackoverflow.com/q/23097425
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35318181
tagged with: one-to-many
type: UnansweredQuestion
has title: Hibernate @OneToMany error: Duplicate entry '0' for key 'PRIMARY'
score: 3
upvote count: 3
tagged with: java
tagged with: hibernate
tagged with: mysql
has body: I have a One to Many Relationship between two entities, Pack and Board. When trying to do save/updates using a repository, I get a duplicate entry error. For some reason, hibernate is trying to update the "id" field of the Boards, which are the child in this relationship (the querys can be seen in the error log below). Here is the code I'm working with: Pack.class package com.vdts.lumberassets.domain; import javafx.beans.property.SimpleStringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import org.hibernate.annotations.IndexColumn; import org.hibernate.annotations.Type; import org.joda.time.DateTime; import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Entity @Table(name="packs") public class Pack extends AbstractEntity{ private SimpleStringProperty slug = new SimpleStringProperty(); private Load load; private List&lt;Board&gt; boards = new ArrayList&lt;&gt;(); private Customer customer; private Vendor vendor; private DateTime dateTallied; private DateTime dateCreated; private DateTime dateModified; @PrePersist protected void onCreate() { dateCreated = new DateTime(); dateModified = new DateTime(); } @PreUpdate protected void onUpdate() { dateModified = new DateTime(); } @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, orphanRemoval=true) @JoinColumn(name="pack_id") @IndexColumn(name="id") public List&lt;Board&gt; getBoards() { return boards; } @Transient public ObservableList&lt;Board&gt; getBoardsObservable(){ return FXCollections.observableArrayList(boards); } public void setBoards(List&lt;Board&gt; boards) { this.boards = boards; } public void addBoard(Board board){ this.boards.add(board); } @ManyToOne(cascade=CascadeType.ALL, fetch=FetchType.LAZY) @JoinColumn(name="load_id") public Load getLoad() { return load; } public void setLoad(Load load) { this.load = load; } @Column(name="slug") public String getSlug() { return slug.get(); } public SimpleStringProperty slugProperty() { re…
linked to: http://stackoverflow.com/q/12179770
type: Question
has answer: http://stackoverflow.com/a/59727658
answer count: 1

http://stackoverflow.com/a/23112407
upvote count: 1
has body: The default policy used when using the &lt;task:scheduler /&gt; tag is to abort the new task and throw a RejectedExecutionException. If you use a plain bean to configure the ThreadPoolTaskScheduler you are able to set a few more properties which can influence that behavior, the chosen 'executor' and 'rejectedExecutionHandler` play a big role in that. Also you are using java to configure your task, you can move that to xml. &lt;task:scheduled-tasks&gt; &lt;task:scheduled ref="inviaFattureTask" cron="*/5 * * * * ?"/&gt; &lt;/task:scheduled-tasks&gt; For more information check the reference guide.
has comment: http://stackoverflow.com/comment/35332353
answers question: http://stackoverflow.com/q/23111402
type: Answer
has comment: http://stackoverflow.com/comment/35332157
downvote count: 0
score: 1

http://stackoverflow.com/comment/99605164
comment on: http://stackoverflow.com/a/35894539
type: Comment
has text: Can you help out with my question aswell. Have a hrd time getting a field from a nested json in the simplest possible way : https://stackoverflow.com/questions/56501897/how-do-i-retrieve-json-from-a-deep-nested-object/56502457?noredirect=1#comment99603799_56502457
type: AnswerComment
score: 0

http://stackoverflow.com/q/23110828
favorite count: 0
tagged with: dynamic-jasper
has answer: http://stackoverflow.com/a/23409055
score: 2
type: AnsweredQuestion
tagged with: textfield
upvote count: 2
has title: Dynamic Alignment based on cell value (Content) in Jasper Reports
type: Question
tagged with: jasper-reports
tagged with: java
accepted answer: http://stackoverflow.com/a/23409055
has body: I am using DynamicJasper (3.0.13) API for generating PDF. Is it possible to keep field value alignment center if value is "-" otherwise horizontal. My current jrxml field is as given follow. <reportElement uuid="105ab8ed-5b63" x="0" y="0" width="200" height="20"/> $F{firstName}
answer count: 2
possible better answer: http://stackoverflow.com/a/23326640
downvote count: 0
tagged with: alignment
has answer: http://stackoverflow.com/a/23326640

http://stackoverflow.com/q/23084372
tagged with: connector
has title: MySQL is not connecting
accepted answer: http://stackoverflow.com/a/23084648
has comment: http://stackoverflow.com/comment/35280913
has comment: http://stackoverflow.com/comment/35281176
has comment: http://stackoverflow.com/comment/35281400
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35280848
has answer: http://stackoverflow.com/a/23084893
has comment: http://stackoverflow.com/comment/35280785
has answer: http://stackoverflow.com/a/23085033
answer count: 4
has comment: http://stackoverflow.com/comment/35281309
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23084586
tagged with: mysql
has answer: http://stackoverflow.com/a/23084586
has body: DB and table names are correct. linked the classpath of MySQL connecter java. but when i run i get Not Found Result. i have tried different queries and different links to sql connector. final static String jdbc_driver="com.mysql.jdbc.Driver"; final static String db_url="jdbc:mysql://localhost/oyutan/"; Connection con=null; java.sql.PreparedStatement ps=null; ResultSet rs=null; @Override public void actionPerformed(ActionEvent r) { if(r.getSource()==ok){ fr.setVisible(false); GUI guu=new GUI(); String card=cardnum.getText(); String pinn=pin.getText(); String sql="SELECT *FROM `card`"; try{ Class.forName(jdbc_driver); con=DriverManager.getConnection(db_url, "root", ""); ps=con.prepareStatement(sql); rs=ps.executeQuery(); while(rs.next());{ System.out.println(rs.getString("")+""); }} catch(Exception e){ System.out.println("Not Found!"); } } }
has comment: http://stackoverflow.com/comment/35280857
type: Question
has answer: http://stackoverflow.com/a/23084648
tagged with: database
has comment: http://stackoverflow.com/comment/35280792
score: 0
has comment: http://stackoverflow.com/comment/35280884

http://stackoverflow.com/q/23036778
has answer: http://stackoverflow.com/a/27250933
answer count: 1
has comment: http://stackoverflow.com/comment/42943117
favorite count: 0
has body: I have to implement a navigation system similar to the one used in the Instagram Android client. There should be a permanent tabbar on the bottom of the screen all the time. When the user navigates deeper within one of these tabs, lets say to a detail view, then switches to another tab, and then switches back to the previous tab, the last shown (deeper) detail view should be shown, and on back presses, it should be iterating back till the main view of the said tab. What I have came up with so far is the following: I have a MainAcitvity showing the menu on the bottom. On selecting a menu point, the appropriet Fragment is shown. When the user navigates further within a Fragment, it then asks the MainActivity to change its content by the given criterias, resulting in changing the Fragment shown. I add all the Fragment changes to the backStack, by calling the FragmentTransaction's addToBackStack() method. I am stuck at this point, and cannot figure out how to switch fragments on back presses, and how to handle tab navigations when deeper views are shown instead the main views of the tabs. I am thinking of using my own separate "backstack implementations" for every tab. When the user navigates deeper within a tab, i generate a unique "tag" and use that tag when calling addToBackStack() and also putting the tag in the "backStack" implemented by me. In case the user navigates again to this tab, i can check if i have any tags in the "backStack" for that tab, and if so, then look up that entry in the real backStack in the fragmentManager of the MainActivity, and switch to it. I could not come up with anything better yet. Is there any better/simpler way to attchieve the said behaviour? Am i missing something? (I know this is really bad application design in the Android world, but it is another question)
type: UnansweredQuestion
tagged with: android
score: 8
downvote count: 0
tagged with: java
upvote count: 8
type: Question
has title: Implementing Instagram like in-app navigation system on Android
has comment: http://stackoverflow.com/comment/42975922

http://stackoverflow.com/comment/35300403
comment on: http://stackoverflow.com/a/23079521
type: AnswerComment
has text: I found it - if I need multiple windows, probably best solution is use Navigator https://vaadin.com/book/vaadin7/-/page/advanced.navigator.html
score: 0
type: Comment

http://stackoverflow.com/comment/35334008
comment on: http://stackoverflow.com/a/23108248
score: 1
has text: I'd bet that `LinkedList` is slow due to cache misses.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22998142
answers question: http://stackoverflow.com/q/22998005
has body: Here is a possible solution. To prevent using Class.newInstance() as Mike suggest in his comment, I changed the implementation. It would also support a constructor with possible parameters public &lt;T&gt; void fillArray(T[] a, ArrayFillFunction&lt;? extends T&gt; f) { for (int i = 0, len = a.length; i &lt; len; i++) { a[i] = f.fill(i); } } public interface ArrayFillFunction&lt;T&gt; { T fill(int idx); } Your call would look like this: Ham[] ham1 = new Ham[13]; fillArray(ham1, new ArrayFillFunction&lt;Ham&gt;() { public Ham fill(int idx) { return new Ham(); } }); Or with custom constructor parameters: Ham[] ham1 = new Ham[13]; fillArray(ham1, new ArrayFillFunction&lt;Ham&gt;() { public Ham fill(int idx) { return new Ham(getParameterForIndex(idx)); } }); With Java 8 you can do this even more elegantly using Lambdas: Ham[] ham1 = new Ham[13]; fillArray(ham1, idx -&gt; new Ham()); fillArray(ham1, idx -&gt; new Ham(getParameterForIndex(idx)));
score: 0
type: Answer

http://stackoverflow.com/comment/35372294
has text: I am trying to implement an application that tests web services automatically, i.e given input I call a web service with this request and I check if the response match with the one I expect. I use JUnit to create parametrized tests to do so.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23134526

http://stackoverflow.com/comment/35222174
score: 0
has text: Thats ok @Fllo, Ill try a different method. Thanks for the help anyway!
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23049912

http://stackoverflow.com/comment/35250154
type: QuestionComment
comment on: http://stackoverflow.com/q/23066864
score: 0
has text: Is the format in any way JSON related?
type: Comment

http://stackoverflow.com/comment/35077860
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22971744
has text: I did not write the logic to create the DB connections. I was only aware we were using jdbc, and didn't know we used apache dbcp as a wrapper until this was pointed out from the stack trace.

http://stackoverflow.com/a/23083456
has body: This is how Java works. SimulatedDeviceFactory is loaded while loading the main class. You should use reflection in that situation. It is good and quite common patter. Easy to configure and easy to debug. Avoid using any other workaround. Debuging classloader related issues in JEE application servers is really pain in a**.
type: Answer
answers question: http://stackoverflow.com/q/23068702
score: 0

http://stackoverflow.com/comment/35301008
type: QuestionComment
comment on: http://stackoverflow.com/q/23094923
has text: Might be easier to implement a simple FSM instead of trying to use a regex.
score: 2
type: Comment

soa
type: Tag
tags question: http://stackoverflow.com/q/22983034
tag name: soa
tags question: http://stackoverflow.com/q/23099968

http://stackoverflow.com/comment/35257918
type: QuestionComment
comment on: http://stackoverflow.com/q/23071002
score: 0
has text: `this.getClass().getName()` return fully qualified class name. you have to use some thing like `com.x.y.A`.
type: Comment

http://stackoverflow.com/a/23021048
has comment: http://stackoverflow.com/comment/35169626
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23020722
answers question: http://stackoverflow.com/q/23020722
type: Answer
has comment: http://stackoverflow.com/comment/35169749
has comment: http://stackoverflow.com/comment/35169259
score: 1
has comment: http://stackoverflow.com/comment/35169721
has comment: http://stackoverflow.com/comment/35169415
upvote count: 1
has comment: http://stackoverflow.com/comment/35169526
has comment: http://stackoverflow.com/comment/35169392
has body: It might solve your problem. Put below line under else if (e.getClickCount() == 3) in mouseClicked() method and remove it from paint() method. initialize = false; The problem is with this initialize variable that is set false at the start up.
has comment: http://stackoverflow.com/comment/35169676
has comment: http://stackoverflow.com/comment/35169797

http://stackoverflow.com/comment/35110152
type: Comment
comment on: http://stackoverflow.com/a/22989238
has text: Its not working properly bro :(
score: 0
type: AnswerComment

lambda
tags question: http://stackoverflow.com/q/23004921
tags question: http://stackoverflow.com/q/23058864
tags question: http://stackoverflow.com/q/23082949
tags question: http://stackoverflow.com/q/23068305
tags question: http://stackoverflow.com/q/23116086
tags question: http://stackoverflow.com/q/23057549
tags question: http://stackoverflow.com/q/23022939
tag name: lambda
tags question: http://stackoverflow.com/q/23050921
tags question: http://stackoverflow.com/q/22999649
tags question: http://stackoverflow.com/q/23023618
tags question: http://stackoverflow.com/q/23050097
type: Tag
tags question: http://stackoverflow.com/q/22972202
tags question: http://stackoverflow.com/q/23090512

http://stackoverflow.com/a/23042478
score: 1
has body: This should work (no need to use FileInputStream): InputStream is = getServletContext().getResourceAsStream("/WEB-INF/DataSpecification.owl"); Reader in = new BufferedReader(new InputStreamReader(is, "UTF-8"));
answers question: http://stackoverflow.com/q/23042431
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/35209445
has text: Imagine 200 file servers in 200 different locations. Yes it is a single database replicated at all locations. When I want to insert data I want to insert it to all 200 different locations. I'm open to ideas. Right now I use basic JDBC and loop through the server addresses. The servers are running MSSQL server.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23044719
type: Comment

http://stackoverflow.com/a/23030354
accepted answer of: http://stackoverflow.com/q/23029098
has comment: http://stackoverflow.com/comment/35185554
answers question: http://stackoverflow.com/q/23029098
has body: It is not really clear what you mean by restart playing audio in java. Your code is not relevant because from what it looks like, you've put everything in one single code block which makes it hard to read. You're missing several brackets. But back to your question. I've put together a simple class which does what you're asking for. import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.SourceDataLine; public class PlaybackWAV { private final int BUFFER_SIZE = 128000; private AudioInputStream audioStream; private AudioFormat audioFormat; private SourceDataLine sourceLine; private boolean running = false; /** * @param filename * the name of the file that is going to be played */ public synchronized void playSound(final String filename) { new Thread(new Runnable() { public void run() { try { InputStream audioSrc = this.getClass().getResourceAsStream(filename); // add buffer for mark/reset support InputStream bufferedIn = new BufferedInputStream(audioSrc); audioStream = AudioSystem.getAudioInputStream(bufferedIn); audioFormat = audioStream.getFormat(); DataLine.Info info = new DataLine.Info( SourceDataLine.class, audioFormat); sourceLine = (SourceDataLine) AudioSystem.getLine(info); sourceLine.open(audioFormat); sourceLine.start(); running = true; while (running) { int nBytesRead = 0; byte[] abData = new byte[BUFFER_SIZE]; while (nBytesRead != -1) { try { nBytesRead = audioStream.read(abData, 0, abData.length); } catch (IOException e) { e.printStackTrace(); } if (nBytesRead &gt;= 0) { sourceLine.write(abData, 0, nBytesRead); } } if (running) audioStream.reset(); } sourceLine.drain(); sourceLine.close(); } catch (Exception e) { System.err .printf("Exception occured while trying to playback file '%s'. (%s)%n", filename, e.getLocalizedMessage()); e.pr…
has comment: http://stackoverflow.com/comment/35186304
has comment: http://stackoverflow.com/comment/35184255
has comment: http://stackoverflow.com/comment/35184469
has comment: http://stackoverflow.com/comment/35184878
has comment: http://stackoverflow.com/comment/35185495
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/35184727
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/35184249
has comment: http://stackoverflow.com/comment/35185929
has comment: http://stackoverflow.com/comment/35185460
has comment: http://stackoverflow.com/comment/35185143
type: Answer
has comment: http://stackoverflow.com/comment/35186254
has comment: http://stackoverflow.com/comment/35184522
has comment: http://stackoverflow.com/comment/35186042

http://stackoverflow.com/comment/35248237
has text: Thank you for your answer. My application also makes and closes IndexReader for every searching. Thanks a lot!! I will modify it!
type: Comment
comment on: http://stackoverflow.com/a/23065619
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35269565
has text: +1 This is the problem. The input file is not valid CSV, it's ambiguous and parsing will be impossible.
type: Comment
comment on: http://stackoverflow.com/a/23077647
score: 0
type: AnswerComment

http://stackoverflow.com/a/23098528
answers question: http://stackoverflow.com/q/23098111
has body: Your regex matches every line, according to RegexBuddy, Java flavor, although I don't understand if it's capturing exactly what you want. It is extremely slow, however, as debuggex has been churning away on it for about ten minutes now, still with no response. This despite a pretty small set of input. ...Finally: ^\{\{term\|(.+?)(?:\|(.*?))?(?:\|([\w, -]+?))?(?:\|lang=([\w-]+?))?(?:\|sc=(\w+?))?(?:\|tr=([\w, -]+?))?(?:\|pos=(\w+?))?(?:\|lit=([\w, -]+))?\}\}$ Debuggex Demo It's actually not working on Debuggex. For some reason it's not anchoring to the line start and ends, despite the m flag and the ^ and $ which I've added. They work okay in RegexBuddy. I'm thinking that this is just not a good problem for regex. Not for a reasonable single regex. Splitting each line on the | is a way better way of handling this problem. In addition to discouraging you against using regex, I'm also letting you know about the Stack Overflow Regular Expressions FAQ :)
score: 0
has comment: http://stackoverflow.com/comment/35309574
type: Answer
has comment: http://stackoverflow.com/comment/35309516

http://stackoverflow.com/a/23083676
has comment: http://stackoverflow.com/comment/35331813
has body: Finally, this one works with JDK6 as well. This way, we could observe file/dir changes in windows shared drivers without mounting/mapping them as a drive. I've used following jars in classpath: commons-collections-4.4.0, commons-logging-1.1.2, commons-logging-api-1.1.2, commons-net-3.3, commons-vfs2-2.0, httpclient-4.3.1, jackrabbit-standalone-2.6.5, jcifs-1.3.17, jsch-0.1.51 import org.apache.commons.vfs2.FileChangeEvent; import org.apache.commons.vfs2.FileListener; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.VFS; import org.apache.commons.vfs2.impl.DefaultFileMonitor; public class NFSChangeObserver { public static void main(String[] args) throws FileSystemException { /** need a non-daemon thread, because DefaultFileMonitor is internally marked as a daemon thread. */ Thread t = new Thread(new Runnable() { @Override public synchronized void run() { try { while(1!=2) wait(); } catch (InterruptedException e) { e.printStackTrace(); } }}); t.start(); FileSystemManager manager = VFS.getManager(); FileObject file = manager.resolveFile("\\\\[server-hostname]\\[directory-path]"); DefaultFileMonitor fm = new DefaultFileMonitor(new FileListener() { @Override public void fileChanged(final FileChangeEvent fileChangeEvt) throws Exception { System.out.println("@" + System.currentTimeMillis() + ": " + fileChangeEvt.getFile().getName() + " changed .." ); } @Override public void fileCreated(FileChangeEvent fileChangeEvt) throws Exception { System.out.println("@" + System.currentTimeMillis() + ": " + fileChangeEvt.getFile().getName() + " created .." ); } @Override public void fileDeleted(FileChangeEvent fileChangeEvt) throws Exception { System.out.println("@" + System.currentTimeMillis() + ": " + fileChangeEvt.getFile().getName() + " deleted .." ); } }); fm.setDelay(5000); fm.addFile(file); FileObject[] children = file.getChildren(); for(FileObject child…
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23055158
downvote count: 0

http://stackoverflow.com/a/23090988
answers question: http://stackoverflow.com/q/23085648
has body: You can set the image as bgImage and select the option background behavior as scale to fit which will preserve aspect ratio while showing the whole image in the available space of the component. You can also just get a scaled version of the image using the appropriate methods of the Image class.
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23085648

http://stackoverflow.com/a/23087962
type: Answer
answers question: http://stackoverflow.com/q/23087889
has body: public void sampleFunction(int size) { while(size &gt;= 0) { System.out.println(array[size]); sampleFunction(size-1); } //end while loop } You mix up recursive calls with imperative loop, you should choose one : public void sampleFunction(int size) { while(size &gt;= 0) { System.out.println(array[size]); size--; } //end while loop } or public void sampleFunction(int size) { System.out.println(array[size]); sampleFunction(size-1); }
has comment: http://stackoverflow.com/comment/35287636
score: 0

http://stackoverflow.com/comment/35238213
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23060096
type: QuestionComment
has text: No, file is named Sort. I am using BlueJ (which was recommended by Udacity), and it doesn't even show any errors, just stuck. So, I tried run it on online compiling(ideone.com) and here if class is public there is such error: Main.java:2: error: class Sort is public, should be declared in a file named Sort.java public class Sort. However, the file is named Sort(at least it shows Sort in Total Commander)

http://stackoverflow.com/a/23192407
has body: This worked: Adding setFileType() after getting connected to server but before transfer of file. ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE); String remoteFileName = file.getName(); if (ftpClient.storeFile(remoteFileName, inputStream)) { inputStream.close(); System.out.println("File " + file.getName() + " uploaded to server."); isUploaded = true; } Thanks a lot to EJP for helping me with this :)
accepted answer of: http://stackoverflow.com/q/23109185
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23109185
score: 0
type: Answer

http://stackoverflow.com/comment/35105958
comment on: http://stackoverflow.com/a/22985604
has text: Restored it. Thanks for your solution.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35120216
has text: @Holger: To be assured of seeing the most recent data, a reader would need to have a memory barrier "somewhere", but in most cases the main requirement would simply be to ensure that a read of "number of items" can't get hoisted out of a loop, and that code which noticed that the number of items exceeded the array size could do a volatile read of the array reference. Meeting those conditions should be much cheaper than using synchronization or even making everything volatile.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22982038
score: 1

http://stackoverflow.com/comment/35278714
score: 0
has text: which error you are getting?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23083057

http://stackoverflow.com/comment/135281523
type: AnswerComment
comment on: http://stackoverflow.com/a/23036854
score: 0
type: Comment
has text: I am baffled by the downvote here. Explanation?

http://stackoverflow.com/a/23072715
has body: You haven't created any array yet. Just initialize the array before the loop - Test1 obj[] = new Test1[1000]; for(int i = 0;i&lt;=999;i++) { //Test1 obj[] = null; // &lt;----------- don't want this here
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23072687
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23072687
type: Answer
score: 1

http://stackoverflow.com/q/23004663
has answer: http://stackoverflow.com/a/23004850
has answer: http://stackoverflow.com/a/23004741
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 3
has comment: http://stackoverflow.com/comment/35136462
has body: Im using Iterator&lt;String&gt; _names = _formObject.keys(); to get the values from the following json but values i got are not arranged in correct order ,for eg i got in the order of "Name,No,Phone,Sex", how can i get the correct values as it in json? { "form" :{ "No" : { "type" : "text" }, "phone" : { "type" : "text" }, "Name" : { "type" : "text" }, "Sex" : { "type" : "radio" } } }
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/35136548
linked to: http://stackoverflow.com/q/7051785
has title: How to get JSONObject values in correct / listed order?
has answer: http://stackoverflow.com/a/23004730
answer count: 3
duplicate of: http://stackoverflow.com/q/7051785
has comment: http://stackoverflow.com/comment/35136529
favorite count: 0
has comment: http://stackoverflow.com/comment/35136538
tagged with: android-json
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/23026504
score: 1
type: Answer
answers question: http://stackoverflow.com/q/23026490
upvote count: 1
downvote count: 0
has body: I think you want to put the following two lines inside the loop. int n1 = n % 3; int n2 = n % 7; Also, your logic is a bit flawed. You should increment the counter exactly when n1 and n2 are both zero, or both nonzero. int count = 0; int i; for (i = 1; count &lt;= num; i++) { int n1 = i % 3; int n2 = i % 7; if (n1 != 0 &amp;&amp; n2 != 0) count++; else if (n1 == 0 &amp;&amp; n2 == 0) count++; else // There is only one condition left. One is zero but the other is not. continue; } return i;

http://stackoverflow.com/q/22990275
has answer: http://stackoverflow.com/a/22992873
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35110787
has title: JavaFx and memory consumption
type: Question
accepted answer: http://stackoverflow.com/a/22992873
answer count: 1
score: 0
tagged with: java
tagged with: javafx
tagged with: memory
has body: I just made an application with java fx that cycles videos in a folder. I had to set the next video firing the setonendofmedia event, so they are in a cycle, but the problem is that the application loads every video at the beginning, so after a while it fills memory and crashes. Is there another way to cycle videos without pre-load them or a way to flush memory every while? This is my code : package application; import java.io.File; import java.io.FilenameFilter; import java.util.ArrayList; import java.util.List; import javax.swing.JOptionPane; import javafx.application.Platform; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBoxBuilder; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javafx.scene.media.MediaView; class SceneGenerator { private int xSize; private int ySize; public SceneGenerator(int xSize,int ySize){ this.xSize=xSize; this.ySize=ySize; } public Scene createScene() { final StackPane layout = new StackPane(); // determine the source directory for the playlist final File dir = new File(System.getProperty("user.dir")+"\\video"); if (!dir.exists() || !dir.isDirectory()) { JOptionPane.showMessageDialog(null,"Cannot find video source directory: " + dir); Platform.exit(); System.exit(0); return null; } //inizializzo il toolkit // create some media players. final List&lt;MediaPlayer&gt; players = new ArrayList&lt;MediaPlayer&gt;(); for (String file : dir.list(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".mp4")||name.endsWith(".flv"); } })) players.add(createPlayer("file:///" + (dir + "\\" + file).replace("\\", "/").replaceAll(" ", "%20"))); if (players.isEmpty()) { System.out.println("No video found in " + dir); Platform.exit(); System.exit(0); return null; } // create a view to show the mediaplayers. final MediaView mediaView = new MediaView(players.get(0)); mediaView.setPreserveRatio(false); media…

http://stackoverflow.com/comment/35131422
type: Comment
score: 0
has text: Can't guarantee the size, this one just happened to be 15 rows, but could be higher. Thanks for the suggestions.
comment on: http://stackoverflow.com/a/22976354
type: AnswerComment

http://stackoverflow.com/q/23025632
answer count: 2
has answer: http://stackoverflow.com/a/23025648
possible better answer: http://stackoverflow.com/a/23025645
accepted answer: http://stackoverflow.com/a/23025648
downvote count: 0
has title: Accessing private method in Java
favorite count: 0
has body: In java, a private access modifier is highly restrictive which can be accessed only within the class in which they are defined. Consider the example. package x; public class Boom { protected String name; public Boom() { } private void aConfidentialInfo(){ System.out.println("Some confidential information..."); } protected void display(){ System.out.println("In display method.."); aConfidentialInfo(); } } package y; import x.Boom; public class Hack extends Boom{ public Hack{ display(); } } Here when I run class Hack, it calls display followed by aConfidentialInfo which is a private member of class Boom. How is class Hack able to access the private member of class Boom? Isn't it the infringement of private access modifier. How to understand and explain this with some decent reasoning?
has answer: http://stackoverflow.com/a/23025645
upvote count: 2
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35175821
tagged with: java
type: Question

http://stackoverflow.com/q/23005412
possible better answer: http://stackoverflow.com/a/23005493
has body: I had following json format : [ { "Otype" : "win"}, { "Otype" : "win"}, { }, { }, { "Otype" : " win 7"}, { "Otype" : " Linux"} ] for accessing Otype I write java code as below: while(cur.hasNext() &amp;&amp; !isStopped()) { String json = cur.next().toString(); JSONObject jObject = new JSONObject(json); System.out.print(jObject.getString("Otype")); }//end of while So above print statement print only following results: win win but not print: { "Otype" : " win 7"} { "Otype" : " Linux"} I think it may be first white space in value field that's why it not print above two key so I changed in print statement as below: System.out.print(jObject.getString("Otype").trim()); but still not work :( . How I can access all above json value using java code?
has answer: http://stackoverflow.com/a/23005493
has comment: http://stackoverflow.com/comment/35137880
accepted answer: http://stackoverflow.com/a/23005780
has title: Accessing json string using java code
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/35138177
has answer: http://stackoverflow.com/a/23005780
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35137970
has comment: http://stackoverflow.com/comment/35137860

http://stackoverflow.com/q/23083295
favorite count: 0
has body: I am facing problem in getting value from hashmap Map&lt;String, Object&gt; mapObj = new HashMap&lt;String, Object&gt;(); String[] strArray = {"String1", "String2"}; mapObj.put("string_array",strArray); //trying to print: for (String entry : mapObj.keySet()) { Log.v("", "map entry "+ entry); Log.v("", "map value "+ mapObj.get(entry)); } actual output: [Ljava.lang.String;@410ee550 expected : String1 String2
type: Question
score: -1
has answer: http://stackoverflow.com/a/23083412
has answer: http://stackoverflow.com/a/23083360
has answer: http://stackoverflow.com/a/23083347
downvote count: 1
tagged with: java
linked to: http://stackoverflow.com/q/409784
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23083499
duplicate of: http://stackoverflow.com/q/409784
upvote count: 0
linked to: http://stackoverflow.com/q/9868482
has title: Method to retrieve value from Hashmap
has answer: http://stackoverflow.com/a/23083346

http://stackoverflow.com/q/23051596
has title: Counting unique numbers from int array - Java
duplicate of: http://stackoverflow.com/q/11608515
tagged with: java
score: -1
has body: I am trying to build and array where the user enters numbers. Then at the end the program outputs a list of the entered numbers along side the amount of times each individual number was entered. Currently I have: package arraypractice; import java.util.Scanner; public class Entry { private Scanner scan = new Scanner(System.in); public void userInput(){ System.out.println("Please tell me the amount of numbers you will be $ entering: "); int [] arr = new int[scan.nextInt()]; for(int i=0;i&lt;arr.length; i++) { scan = new Scanner(System.in); System.out.println("Please enter a number: "); while(scan.hasNextInt()){ int x = scan.nextInt(); arr[i]= x; break; } } for(int i:arr){System.out.println(i + " occurs"); } } } For example this outputs: run: Please tell me the amount of numbers you will be $ entering: 2 Please enter a number: 25 Please enter a number: 21 25 occurs 21 occurs BUILD SUCCESSFUL (total time: 10 seconds) In a perfect world I would like to output to look like this: run: Please tell me the amount of numbers you will be $ entering: 2 Please enter a number: 25 Please enter a number: 21 Number Times Entered 25 occurs 1 21 occurs 1 BUILD SUCCESSFUL (total time: 10 seconds) I am not sure how to implement this. A second array? If so how? Also is there a way I can get the headings Number and Times Entered? You are not seeing a main method because it is in another class that instantiates this. Thanks.
upvote count: 0
tagged with: arrays
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35222021
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11608515
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23051644

http://stackoverflow.com/comment/35167588
comment on: http://stackoverflow.com/q/23021130
type: Comment
has text: You seem to be confused about whether you are writing the code or the code is writing itself. It's your code you should control how it behaves (at any situation).
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35070989
type: QuestionComment
has text: So I must make sure that the parent's constructor doesn't do anything that I don't want my childs to do?
comment on: http://stackoverflow.com/q/22968423
score: 0
type: Comment

http://stackoverflow.com/comment/35173159
type: Comment
type: QuestionComment
has text: In what format is the response? Web service, file drop, jms?
comment on: http://stackoverflow.com/q/23019607
score: 0

http://stackoverflow.com/q/23064219
has body: I develop Java code using Eclipse. When I want a runnable jar I point and click in the GUI like this: File->Export->Runnable Jar -> Launch Configuration (select MainTest) --LibraryHandling (extract required libraries into generated JAR) I want to do this automatically, how can I do this in bash?
has comment: http://stackoverflow.com/comment/35245045
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/23064264
tagged with: java
tagged with: eclipse
score: 0
tagged with: bash
has title: Automate: export runnable jar, by Launch Configuration, Eclipse
answer count: 1
tagged with: jar
accepted answer: http://stackoverflow.com/a/23064264

http://stackoverflow.com/comment/35299842
comment on: http://stackoverflow.com/q/23094117
score: 0
type: Comment
type: QuestionComment
has text: What Eclipse version are you using?

http://stackoverflow.com/q/23026452
type: AnsweredQuestion
tagged with: java
has body: I have a list box in an HTML form. I want to send the list items to a servlet using jquery and AJAX. At the server side, I want to add the sent list items one by one in a database. I tried this using an array in my jsp where I filled it with list items,and then sent it using AJAX, but at servlet I am getting NULL. my jsp code: var arr=new Array(); var rel=$("#rcombo :selected").text(); $("#listbox option").each(function(){ arr[0]=$("#listbox").text(); }); $.ajax({ type:"get", url:"NewServlet", data:{list:arr,rel:rel}, success:function(){} }); servlet code: String list[]=request.getParameterValues("list"); System.out.println(list); Then I changed the code a little bit: jsp: var arr=new Array(); var rel=$("#rcombo :selected").text(); $("#listbox option").each(function(){ arr[0]=$("#listbox").text(); }); $.ajax({ type:"get", url:"NewServlet", data:{list:arr[0],rel:rel}, success:function(){} }); servlet: String list[]=request.getParameterValues("list"); System.out.println(list[0]); Now, I am getting the data. But, all items are in list[0]. I am not able to extract them one by one. Please help me.
tagged with: servlets
type: Question
has title: Sending list box items to a servlet using Jquery AJAX
tagged with: jsp
tagged with: jquery
tagged with: ajax
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23026482
duplicate of: http://stackoverflow.com/q/13241668
accepted answer: http://stackoverflow.com/a/23026482
linked to: http://stackoverflow.com/q/13241668

http://stackoverflow.com/a/23074242
has comment: http://stackoverflow.com/comment/35265286
has comment: http://stackoverflow.com/comment/35293352
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Not sure here been a while since i have used libgdx but: shapeRenderer.begin(ShapeType.Line); shapeRenderer.setColor(255/255.0f, 109/255.0f, 120/255.0f, 1f); shapeRenderer.arc(0, 0, 30, 0, 270); Gdx.gl10.glLineWidth(lineWidth) shapeRenderer.end(); Might do the trick.
answers question: http://stackoverflow.com/q/23074049

http://stackoverflow.com/comment/35140433
type: Comment
type: QuestionComment
has text: Please upload those error logs
score: 0
comment on: http://stackoverflow.com/q/23006942

http://stackoverflow.com/q/23126566
tagged with: java
has title: How to append an object to an existing file (generics)?
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35356761
has comment: http://stackoverflow.com/comment/35358047
tagged with: generics
tagged with: append
has comment: http://stackoverflow.com/comment/35356608
answer count: 0
type: UnansweredQuestion
has body: I'm having problems with appending a generic object within an existing file. This method is supposed to append the object to the existing file if the parameters are "true" and overwrites the entire file if "false". The "false" statement works perfectly fine, it overwrites the entire file but I can't seem to get the append one to work. It seems to do nothing at first glance but when I placed a simple System.out.println("test"); in the while (true) loop, it runs forever. How can I fix this? public &lt;T&gt; void writeOneObject(T type, boolean append) throws NotSerializableException{ if (append == true){ //TODO if (file.exists ()){ ObjectOutputStream ois = null; try{ ois = new ObjectOutputStream (new FileOutputStream (file, true)); while (true){ ois.writeObject(type); } }catch (StreamCorruptedException e){ }catch (EOFException e){ }catch (Exception e){ e.printStackTrace (); }finally{ try{ if (ois != null) ois.close(); }catch (StreamCorruptedException e){ }catch (IOException e){ e.printStackTrace (); } } } } else { //overwrites the entire file try { FileOutputStream fos = new FileOutputStream(file); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(type); oos.flush(); oos.close(); } catch (FileNotFoundException ex) { ex.printStackTrace(); } catch (StreamCorruptedException e) { System.out.println("error"); } catch (IOException ex) { ex.printStackTrace(); } } } I also have this inside the class: class NoHeaderObjectOutputStream extends ObjectOutputStream { public NoHeaderObjectOutputStream(OutputStream os) throws IOException { super(os); } protected void writeStreamHeader() {} }
tagged with: file
has comment: http://stackoverflow.com/comment/35356717
tagged with: object

http://stackoverflow.com/q/23120971
accepted answer: http://stackoverflow.com/a/23121423
upvote count: 1
tagged with: http://stackoverflow.com/tag/html
has title: How to change the width of tab labels in java but keep the "selection" options
favorite count: 0
has answer: http://stackoverflow.com/a/23121423
downvote count: 0
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has body: I have a JTabbedPane object in my program and I override the getForegroundAt and getBackgroundAt methods in order to have different background colours when the tab is selected or not. I want to change the width and height of the tabs. I managed to do that using code similar as the following: jtp.addTab(" Main ", mainPanel); The problem is that if I use this html code to change the width of the tabs, the methods which I override are not longer called because the options are set with the html code. Is there a way to work around this problem? Is there html code that I can use in order to change the background colour of the tab depending on whether it is selected or not? Thanks.
answer count: 1
tagged with: jtabbedpane

http://stackoverflow.com/comment/35237783
has text: Reminder: the end user only has a bunch of jars, which constitute the classpath of the application. He doesn't have any project, and he doesn't have any `src` directory. Don't confuse your development environment with the runtime environment.
comment on: http://stackoverflow.com/q/23060316
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23048048
tagged with: java
accepted answer: http://stackoverflow.com/a/23048119
type: Question
tagged with: htmlunit
tagged with: javascript
has title: Including variables in URL, returns error page
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has body: I'm trying to access a URL in java using HTMLUnit. The way the website I'm using works is that for search results on the website, it draws the first page of search results initially and then changes to the selected page. What I want to do is access a specific page, say, 21. The URL would have to have a variable appended to it (E.g. http://www.thomsonlocal.com/Electricians/UK/#||25). Using it on my browser gets me the 25th page after the first page loads initially and then a method kicks in. (javascript or JQuery?) I have tried to encode the URL to escape the vertical bar character but that returns an error page on the site. page = webClient.getPage("http://www.thomsonlocal.com/Electricians/UK/"+URLEncoder.encode("#||" , "UTF-8")+ 21); My question is what am I doing wrong here? And is there a way to find out what method is being used which the variables in the URL are passed to?
has answer: http://stackoverflow.com/a/23048119
type: AnsweredQuestion

http://stackoverflow.com/comment/35350817
comment on: http://stackoverflow.com/a/23123325
score: 0
type: Comment
type: AnswerComment
has text: @user2626222 that shouldn't happen at all because `Motion Sensor` wouldn't exist in the values of `Switch`...

http://stackoverflow.com/comment/35402104
comment on: http://stackoverflow.com/q/23089312
type: Comment
type: QuestionComment
has text: I've written a hack that solves the problem; this hack may or may not be added to the next release. I've created a ticket on the paid support system at iText Software for the core developers to take a look at the hack (and to accept or refuse it). What is the essence of the problem: iText looks at the fonts in the document, finds ArialUnicodeMS for the two problematic fields, then searches the font for the characters needed, doesn't find them in the font (maybe because of the form, this remains to be tested) and unfound characters disappear.
score: 0

http://stackoverflow.com/q/23128243
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23129841
accepted answer: http://stackoverflow.com/a/23129841
tagged with: java
has comment: http://stackoverflow.com/comment/35360394
type: Question
has title: How to detect audio file format
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has body: I wanted to know if there any java api that could identify the type of format the audio file is. I know one way is by extension,but even when the extension is wrong, I should be able to find the type of audio file
favorite count: 0
tagged with: javasound

http://stackoverflow.com/q/23113301
has answer: http://stackoverflow.com/a/23116189
answer count: 1
downvote count: 0
tagged with: camunda
has title: How to log the state of a process with camunda?
accepted answer: http://stackoverflow.com/a/23116189
favorite count: 0
has body: How to log the state and the run of a process with camunda ? Something like a historic of actions. I use Camunda 7.1.0 build with maven on Tomcat
tagged with: business-process-management
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: bpmn
type: Question

http://stackoverflow.com/q/22994873
has answer: http://stackoverflow.com/a/22995334
score: 1
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/23094778
has body: I have updated the code to reflect the BigInteger num. But I am now receiving errors with my display message. Syntax error is under IsPrime. How can I change this string output to get the correct display message to the user? Here is my code: public static void main (String [] args){ //prompt user to input a number String input = JOptionPane.showInputDialog("Enter number "); // change string to int int number = Integer.parseInt(input); //display message to user of their results BigInteger num = new BigInteger(input); String output = number + " is" + (BigInteger(input) ? " " : " not ") + "a prime number: " + BigInteger(input); JOptionPane.showMessageDialog (null, output); } public static Boolean IsPrime(BigInteger num) { // check if number is a multiple of 2 if (num.mod(new BigInteger("2")).compareTo(BigInteger.ZERO) == 0) { return false; }// if not, then just check the odds for (BigInteger i = new BigInteger("3"); i.multiply(i).compareTo(num) &lt;= 0; i = i.add(new BigInteger("2"))) { if (num.mod(i).compareTo(BigInteger.ZERO) == 0) { return false; } } return true; } }
tagged with: java
has comment: http://stackoverflow.com/comment/35118888
type: Question
tagged with: boolean
answer count: 2
tagged with: user-interface
downvote count: 0
favorite count: 0
has title: GUI to check for prime numbers
has comment: http://stackoverflow.com/comment/35119913
has comment: http://stackoverflow.com/comment/35119749

http://stackoverflow.com/comment/80681117
score: 0
has text: In addition to the code issues, your approach is not ideal. Instead of checking every number, you should construct the list by computing all of the multiples of 5 and all of the multiples of 6.
comment on: http://stackoverflow.com/q/23017206
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35260288
comment on: http://stackoverflow.com/a/23071681
score: 0
has text: I'm so slow :D. I didn't acknowledge, that NTRUSigningPrivateKeyParameters extends AsymmetricKeyParameter. Thank you very much! Sorry my misunderstanding took a lot of your time
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/51570059
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/23057356
type: Comment
has text: Well enums are special enough that they have their own keyword so it's one more step to allow the compiler to treat them special and barf on setting one to null (I agree with OP). The omission appears an arbitrary design choice to me. It's orthogonal whether or not this will make it into the language.

http://stackoverflow.com/a/23124876
downvote count: 0
score: 1
has body: ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); Scanner sc = new Scanner(System.in); do { Integer i=sc.nextInt(); list.add(i); }while (i!=0);
upvote count: 1
answers question: http://stackoverflow.com/q/23124777
type: Answer

http://stackoverflow.com/a/23082332
score: 9
type: AcceptedAnswer
has body: I don't think that's possible, well it doesn't make sense to have that construct. When you specify your parameters using A &amp; B then you know that you will be able to call the methods of A and B on the instance that you have, but if you would be able to specify A OR B then it would be ambiguous to the compiler whether you can call A.a() or you can call B.b(); If you have the need for such a construct you're likely to have design issues, post your code and we might be able to help Seeing your code, maybe you should use an Adapter around the JFrame and JComponent that will hide the duplicated code, though JFrame and JComponent are both Container, can you not use that?
type: Answer
accepted answer of: http://stackoverflow.com/q/23082230
upvote count: 9
downvote count: 0
answers question: http://stackoverflow.com/q/23082230

http://stackoverflow.com/q/22993938
has answer: http://stackoverflow.com/a/22993974
accepted answer: http://stackoverflow.com/a/22993974
tagged with: sockets
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35117486
has body: I was reading the javadoc for InetSocketAddress at http://docs.oracle.com/javase/8/docs/api/ and was wondering what the following phrase means: Creates a socket address from an IP address and a port number. What I want to do is create a socket on the local box that listens for incoming connections on the same port and begins communication with that client. I was using "localhost"/80 for the host name on my server, but netstat -l doesn't show anything listening on port 80. Am I going about this the wrong way?
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/78776644
has title: What does "Creates a socket address from an IP address" mean?
has comment: http://stackoverflow.com/comment/35117454
has answer: http://stackoverflow.com/a/78776644
score: 0
has comment: http://stackoverflow.com/comment/35117203
upvote count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35117648

http://stackoverflow.com/comment/35272971
score: 0
comment on: http://stackoverflow.com/q/23079460
type: Comment
type: QuestionComment
has text: Every time the key is pressed down or holded down

http://stackoverflow.com/comment/35133904
type: Comment
type: QuestionComment
score: 0
has text: @DavidWallace, no, I'm only storing 0s and 1s... I should really change my ints to bytes. Thanks for reminding me.
comment on: http://stackoverflow.com/q/23003036

http://stackoverflow.com/q/23031820
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35188536
type: Question
has title: Java generics compile error "Class<capture#1-of ? ..."
tagged with: generics
accepted answer: http://stackoverflow.com/a/23031855
has body: I'm in trouble with using javax.swing.event.EventListenerList class in my personal Java project. It's not simple one, so I made a simple example that has same problem. package test; public class GenericTest { public static void main(String[] args) { GenericTest gt = new GenericTest(); gt.doTest(String.class); } private void doTest(Class&lt;? extends Comparable&gt; type) { doSomething(type, "test"); // Compile error : // The method doSomething(Class&lt;C&gt;, C) // in the type GenericTest is not applicable for the arguments // (Class&lt;capture#1-of ? extends Comparable&gt;, String) } // third party API like javax.swing.event.EventListenerList.add() private &lt;C extends Comparable&gt; void doSomething(Class&lt;C&gt; ct, C c) { // ... } } I got the generics compile error like that in the codes. I have many classes extends a specific interface like java.lang.Comparable and I want to handle all of them with single method like doTest() in the codes. Anyone can help me?
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35186273
tagged with: java
has answer: http://stackoverflow.com/a/23031855
type: AnsweredQuestion

mfcc
type: Tag
tag name: mfcc
tags question: http://stackoverflow.com/q/22973788

http://stackoverflow.com/comment/35104126
type: QuestionComment
score: 0
has text: MANY ELEMENTS ARE THERE IN JSONaRRAY BUT IN DATABASE ON 5 FIELDS ARE THERE FIRSTNAME LASTNAME aGE MOBILE AND IMAGES @HannoBinder
comment on: http://stackoverflow.com/q/22986878
type: Comment

http://stackoverflow.com/comment/35329206
score: 0
type: Comment
has text: Ya that's right i have an ArrayAdaptar that return a String. Do you know a way to do this?
type: AnswerComment
comment on: http://stackoverflow.com/a/23111502

http://stackoverflow.com/comment/35205866
type: AnswerComment
comment on: http://stackoverflow.com/a/23042723
has text: Thanks for you answer. The part of how to add the button was confusing me though, but I just found it myself. I was mixing the showInputDialog and the JOptionPane :P showInputDialog is the one defining the list of items (selectionValues) and JOptionPane defines the buttons (options). My reading comprehension needs some work. About the subquestion; having to redefine ok and cancel seems a bit annoying. I like the way they currently work (ok returns the selected item and cancel returns null). I would simply like to add a button called skip to the existing set. Not possible?
type: Comment
score: 0

http://stackoverflow.com/q/23113674
answer count: 3
has title: Should I use the Spring Framework jar files or Spring Batch jar files while creating a java email batch program?
has comment: http://stackoverflow.com/comment/35333521
has answer: http://stackoverflow.com/a/23136190
type: UnansweredQuestion
tagged with: spring
has body: I am trying to create a java email batch program that sends an email with an attachment each day to a specific email address, and I have to use Spring as the framework for this program. It is not going to be a web application, but since I'm implementing Spring into this, how would I go about this? I am totally new to Spring (and Java for that matter), but am unsure of which direction I need to go. Which jar files do I need? Spring Batch or Spring Framework? Also, where can I download the jar files for Spring Framework? The spring.io site won't let me download those jar files.
has answer: http://stackoverflow.com/a/23134084
tagged with: java
type: Question
tagged with: jar
has answer: http://stackoverflow.com/a/23114876
tagged with: spring-batch
score: 0

http://stackoverflow.com/comment/35118514
has text: Yes. but I also want the program to read the highest available version in the folder. Because I have multiple system creating the files with different version :) sorry If I'm confusing
type: Comment
comment on: http://stackoverflow.com/a/22994383
score: 0
type: AnswerComment

http://stackoverflow.com/a/23061671
score: 0
answers question: http://stackoverflow.com/q/23061544
has comment: http://stackoverflow.com/comment/35240244
has body: Your counter variable is declared inside method thats why when you trying, move your variables above onCreate method.
has comment: http://stackoverflow.com/comment/35272437
has comment: http://stackoverflow.com/comment/35240346
has comment: http://stackoverflow.com/comment/35274632
type: Answer

http://stackoverflow.com/a/22994268
has body: I think you should set the onClickListener on the button within the adapter. Something like that : @Override public View getView(int position, View convertView, ViewGroup parent) { //fill your cell Button button = (Button) buttonView.findViewById(R.id.trash); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click Toast.makeText(getApplicationContext(), "this is my Toast message!!! =)", Toast.LENGTH_LONG).show(); } }); }
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35117773
accepted answer of: http://stackoverflow.com/q/22993818
type: Answer
answers question: http://stackoverflow.com/q/22993818
has comment: http://stackoverflow.com/comment/35117813

http://stackoverflow.com/a/23026211
type: Answer
accepted answer of: http://stackoverflow.com/q/23025733
score: 2
has comment: http://stackoverflow.com/comment/35192346
answers question: http://stackoverflow.com/q/23025733
has body: First I do have to give kudos to Flextra and his comment as Spring can help you decouple your code, making it much easier to enhance and debug. Next I suggest that you re-think your current model set up. Rather than begin with nested ArrayLists, I suggest that you create a custom class to hold the two pieces of data each supplier will need. Then create a non-nested ArrayList of this custom class. Then you can tell the JComboBox how to display an object of your either by giving it a toString() method that displays the information as you'd like it, or give the JComboBox a custom cell renderer that displays the information as you'd like it. Then when the combo box is selected, if you get the selectedItem, it will be an object of your class, and it will be easy to extract the two pertinent pieces of information.
downvote count: 0
has comment: http://stackoverflow.com/comment/35186833
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35192524

http://stackoverflow.com/comment/67862321
has text: Please avoid posting link-only answers. It is better to include a summary of the link in your post, in case the link goes stale at a later date.
score: 1
comment on: http://stackoverflow.com/a/40302165
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23129147
has comment: http://stackoverflow.com/comment/35365737
type: Answer
has comment: http://stackoverflow.com/comment/35372925
has comment: http://stackoverflow.com/comment/35369526
has body: Put the jar file, containing the MySql Driver on the classpath when starting your application. The switch is called -cp or -classpath like this: java -cp ".;mysql.jar" my.package.Main assuming you start your application from the root directory which is named my.package.Main. The classpath separator is the one for Windows. For unix based OSs you need to use : i guess.
has comment: http://stackoverflow.com/comment/35361322
answers question: http://stackoverflow.com/q/23129080
has comment: http://stackoverflow.com/comment/35361198
has comment: http://stackoverflow.com/comment/35364495
has comment: http://stackoverflow.com/comment/35365436
has comment: http://stackoverflow.com/comment/35366159
has comment: http://stackoverflow.com/comment/35365679
has comment: http://stackoverflow.com/comment/35361995
has comment: http://stackoverflow.com/comment/35361289
score: 0
has comment: http://stackoverflow.com/comment/35369002

http://stackoverflow.com/q/23019064
has comment: http://stackoverflow.com/comment/35163134
favorite count: 0
accepted answer: http://stackoverflow.com/a/23019123
has body: Can we use those 3 dots to create an array at the place of square brackets, like we used it above?? If not then why we are using this declaration only for main?? public static void main(String[] args) or public static void main(String... args)
has answer: http://stackoverflow.com/a/23019220
answer count: 4
type: AnsweredQuestion
has title: 2 different signatures for main method
has comment: http://stackoverflow.com/comment/35163530
has comment: http://stackoverflow.com/comment/35165202
tagged with: java
has comment: http://stackoverflow.com/comment/35163143
has answer: http://stackoverflow.com/a/23019353
type: Question
score: 5
has comment: http://stackoverflow.com/comment/35163098
upvote count: 5
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/23019123
has answer: http://stackoverflow.com/a/23020093
tagged with: program-entry-point
possible better answer: http://stackoverflow.com/a/23020093

http://stackoverflow.com/comment/35148851
type: QuestionComment
comment on: http://stackoverflow.com/q/23010863
type: Comment
has text: @peeskillet Yes, I mean the same: when I write new BeanPropertyRowMapper(ObjectClass.class) then I get compiler message: Illegal class literal for the type parameter ObjectClass
score: 0

http://stackoverflow.com/a/23021852
score: 3
type: AcceptedAnswer
has body: When an application closes, the jvm stops running and all of its memory is returned to the host. For all practical purposes, the heap and all object allocated there stop to exist. If you're concerned about security, any process with raised privileges would be able to scan that memory and read whatever's left around. It would have to do so before the memory gets allocated to another process. But that could also happen while the original program/jvm is running.
answers question: http://stackoverflow.com/q/23021768
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23021768
type: Answer
has comment: http://stackoverflow.com/comment/35168931

http://stackoverflow.com/comment/35290424
type: QuestionComment
comment on: http://stackoverflow.com/q/23089458
has text: Does this compile? Shouldn't it be `Rect r1 = new Rect(10, 10, 20, 20)` ?
score: 0
type: Comment

http://stackoverflow.com/q/23125363
tagged with: arduino
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23129690
answer count: 1
has comment: http://stackoverflow.com/comment/35355439
has body: I am trying to create a pattern that will turn one of the Arduinos ports on and off. However, after about 2 on/offs it gets stuck on and won't turn off unless I unplug the Arduino. I have tried many solutions such as trying to set the int to 0 after it sends power to the port. Here is my code for the server side and for the arduino side: Arduino Code: int Relay = 13; //The pin that the relay is attached to //int time; //Creates temp variable void setup() { Serial.begin(9600); pinMode(Relay, OUTPUT); } void loop() { while(true) { //Check if data has been sent from the computer: if (Serial.available()) { int time; //Assign serial value to temp time = Serial.parseInt(); //Output value to relay delay(1000); digitalWrite(Relay, HIGH); delay(time); digitalWrite(Relay, LOW); } } } Server Code: for(int i = 0; i &lt; 11; i++) { out.write("10000".getBytes("UTF-8")); out.flush(); Thread.sleep(1500); } If anyone sees anything wrong or sees a solution please let me know. Thanks :)
has title: Arduino port gets stuck on
tagged with: serial-port
score: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23124610
tagged with: android-fragments
tagged with: java
tagged with: mysql
type: Question
has title: Using Database in Fragment
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23124819
tagged with: android
favorite count: 0
upvote count: 2
has body: I'm trying to make a basic lyric writing app that will allow you to save, edit, and store lyrics - however halfway through the project i've decided that I wanted to use different tabs, so that the user can click on another tab while editing a lyric and etc features. I have a lot of incorrect code, and I know it is because I switched to a class that extends Fragment....I'm just having a tough time reworking everything. Could someone please tell me if there are just a few small tweaks I can make? And any advice on what those tweaks may be? Thanks for any and all help!! Here's my code: public class LyricListFragment extends Fragment { private static final int ACTIVITY_CREATE=0; private static final int ACTIVITY_EDIT=1; private static final int INSERT_ID = Menu.FIRST; private static final int DELETE_ID = Menu.FIRST + 1; private LyricsDbAdapter mDbHelper; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_lyriclist); mDbHelper = new LyricsDbAdapter(getActivity()); mDbHelper.open(); fillData(); registerForContextMenu(getListView()); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.activity_lyriclist, container, false); return view; } public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; super.onCreateOptionsMenu(menu); menu.add(0, INSERT_ID, 0, R.string.menu_insert); return true; } private void fillData() { Cursor LyricsCursor = mDbHelper.fetchAllLyrics(); startManagingCursor(LyricsCursor); String[] from = new String[]{LyricsDbAdapter.KEY_TITLE}; int[] to = new int[]{R.id.text1}; SimpleCursorAdapter lyrics = new SimpleCursorAdapter(getActivity(), R.layout.lyrics_row, LyricsCursor, from, to); setListAdapter(lyrics); } public boolean onMenuItemSelected(int featureId, MenuItem item) { switch(item.getItemId()) { case INSERT_ID: createLyric(); return tru…
has answer: http://stackoverflow.com/a/23124819
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/35145000
type: QuestionComment
type: Comment
has text: you mean the dipatcher servlet.xml ?
comment on: http://stackoverflow.com/q/23008900
score: 0

http://stackoverflow.com/comment/35218122
score: 0
type: AnswerComment
has text: @HovercraftFullOfEels -- Yea, so I could move my JPanel to say 100,100 with a size of 50,50, for example. Right now, I can't seem to move it. It just stays locked in the upper left corner, taking up the same size as the JFrame
type: Comment
comment on: http://stackoverflow.com/a/23049324

http://stackoverflow.com/q/22988325
favorite count: 0
has title: Java select files by generated time
has comment: http://stackoverflow.com/comment/35140501
has comment: http://stackoverflow.com/comment/35119840
tagged with: ftp
answer count: 0
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/35106986
upvote count: 1
has comment: http://stackoverflow.com/comment/35106809
tagged with: java
has comment: http://stackoverflow.com/comment/35108340
has comment: http://stackoverflow.com/comment/35109339
has comment: http://stackoverflow.com/comment/35110198
type: Question
has body: I need to read the file names from ftp server by the specific time they were generated at. For Example, If I want to get all the files generated between 2014-04-10 13:00 and 2014-04-10 16:00. File names can be random. Is it possible? Thanks
downvote count: 0

http://stackoverflow.com/q/23040273
tagged with: java
answer count: 1
has body: I am having xml. (Ehcache.xml) I want to inject into it property from property file(on the classpath). However since this xml is not a Spring managed bean I am not able to do so. Any recommendations how to overcome this? the xml: ... properties="peerDiscovery=manual,rmiUrls=//**${other.node.hostname}**:41001/org.jasig.cas.ticket.ServiceTicket|//**${other.node.hostname}**:41001/org.jasig.cas.ticket.TicketGrantingTicket" propertySeparator="," /&gt; &lt;cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" properties="port=41001,socketTimeoutMillis=5000" /&gt; &lt;/ehcache&gt; I want to inject ${other.node.hostname} from another properties file. but I get this on runtime: Caused by: java.net.URISyntaxException: Illegal character in authority at index 2: //${other.node.hostname}:41001/org.jasig.cas.ticket.TicketGrantingTicket thanks, ray.
has answer: http://stackoverflow.com/a/23043229
type: UnansweredQuestion
tagged with: ehcache
type: Question
has title: Inject property into non managed Spring xml
tagged with: spring
tagged with: properties
tagged with: http://stackoverflow.com/tag/xml
score: 0

http://stackoverflow.com/comment/35099971
comment on: http://stackoverflow.com/a/22984126
type: AnswerComment
score: 0
type: Comment
has text: hey, you are right its difficult to implement. But I have data dictionary for the database I want to achieve. I want to achieve it for particular database which have sample tables. Any idea how to go ahead?

http://stackoverflow.com/comment/35254095
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23069006
has text: this is the offending block of code guys: `int m = (int)(j - 'a'); if(m <= 25){ wordScore = wordScore + scores[m]; }`
score: 0

http://stackoverflow.com/comment/35257678
type: Comment
comment on: http://stackoverflow.com/a/23069770
type: AnswerComment
score: 0
has text: sumList doesnt take ArrayList<Duoble> results

http://stackoverflow.com/q/22978696
type: Question
has title: Trying to transpose an array, but getting array out of bounds
has comment: http://stackoverflow.com/comment/35090840
upvote count: 2
tagged with: for-loop
possible better answer: http://stackoverflow.com/a/22978757
tagged with: matrix
has comment: http://stackoverflow.com/comment/35099465
has comment: http://stackoverflow.com/comment/35090199
has comment: http://stackoverflow.com/comment/35089930
favorite count: 0
has comment: http://stackoverflow.com/comment/35090449
has comment: http://stackoverflow.com/comment/35090169
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/22978757
answer count: 5
has answer: http://stackoverflow.com/a/22979059
has comment: http://stackoverflow.com/comment/35089830
accepted answer: http://stackoverflow.com/a/22978965
type: AnsweredQuestion
score: 2
has body: I am trying to convert a 2D array. The content of a horizontal row is transferred to vertical column. public static void change(short image[]) { int arrayLength = 29; // row length int arrayWidth = 10; // column length // array with values short[][] decompressedImage = new short[arrayLength][arrayWidth]; // array to store transposed image short[][] transposedImage = new short[arrayWidth][arrayLength]; // store transposed values for (int i=0;i&lt;arrayWidth; i++){ for (int j=0;j&lt;arrayLength; j++){ transposedImage[j][i]=decompressedImage[i][j]; } } }
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35090060
has answer: http://stackoverflow.com/a/22979064
has answer: http://stackoverflow.com/a/22978965
has answer: http://stackoverflow.com/a/22978903

http://stackoverflow.com/q/23038083
has title: Overriding toString() when you have two constructors
has answer: http://stackoverflow.com/a/23038112
type: Question
has answer: http://stackoverflow.com/a/23038100
score: 2
has answer: http://stackoverflow.com/a/23038097
downvote count: 0
linked to: http://stackoverflow.com/q/7586266
possible better answer: http://stackoverflow.com/a/23038100
accepted answer: http://stackoverflow.com/a/23038097
has body: My current class, SeriesCircuit class, contains two constructors: public SeriesCircuit(Circuit input1, Circuit input2) { this.circuit1 = input1; this.circuit2 = input2; } public SeriesCircuit(ParallelCircuit parallelCircuit, Circuit circuit1) { this.parallelCircuit = parallelCircuit; this.circuit1 = circuit1; } Using the .toString() method, I can print out the first constructor's values as such: public String toString() { return circuit1.getResistance() + " + " + circuit2.getResistance(); } Note: the values returned by .getResistance() get simply doubles, so a sample output would be like this string: 2.0 + 3.0. My question is, since I have two constructors which offer two different input types, how do I only override one .toString() to output two different types of constructor inputs? For example, in my main, I do this: SeriesCircuit s1 = new SeriesCircuit(new Circuit(2.0), new Circuit(3.0)); SeriesCircuit s2 = new SeriesCircuit(new ParallelCircuit(s1, new Circuit(4.0)), new Circuit(1.0)); I could print out s1 using System.out.println(s1) just fine, but since I never specified a .toString() condition for constructor number two, I would expectedly get a NullPointerException.
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/23038104
upvote count: 2
tagged with: tostring
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8755063
tagged with: java

http://stackoverflow.com/q/23087889
answer count: 7
has answer: http://stackoverflow.com/a/23088501
favorite count: 0
has comment: http://stackoverflow.com/comment/35287435
has answer: http://stackoverflow.com/a/23087921
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/23087996
has answer: http://stackoverflow.com/a/23088216
tagged with: java
has comment: http://stackoverflow.com/comment/35287431
linked to: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/23087962
downvote count: 1
has title: While loop creating infinite loop although the condition is becoming false in java
type: Question
has comment: http://stackoverflow.com/comment/35287308
has answer: http://stackoverflow.com/a/23089260
has comment: http://stackoverflow.com/comment/35287900
has body: public class Sample { /** * @param args */ int array[]= {1,2,3}; //it is used to display the array in format as 3,2,1,2,1,1 public void sampleFunction(int size) { while(size &gt;= 0) { System.out.println(array[size]); sampleFunction(size-1); } //end while loop } //end sample function // starting main class public static void main(String[] args) { //creating object Sample Sample s = new Sample(); //Calling sample function for display the array elements s.sampleFunction(2); } //end main class } //end sample class
has answer: http://stackoverflow.com/a/23087990
score: 0
tagged with: while-loop

http://stackoverflow.com/comment/35200398
has text: Sure. Read code will help me a lot in getting the idea how it has to be done.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23039492

http://stackoverflow.com/a/23002330
accepted answer of: http://stackoverflow.com/q/23002218
has comment: http://stackoverflow.com/comment/35132600
answers question: http://stackoverflow.com/q/23002218
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35133292
has comment: http://stackoverflow.com/comment/35132943
type: AcceptedAnswer
downvote count: 0
has body: In your addMatrices method, you should remove the third loop. Like this: for (int i = 0; i &lt; matrixA.length; i++) { for (int j = 0; j &lt; matrixA[i].length; j++) { temp[i][j] = matrixA[i][j] + matrixB[i][j] ; } }
type: Answer
has comment: http://stackoverflow.com/comment/35132847

http://stackoverflow.com/a/23048593
has comment: http://stackoverflow.com/comment/35217916
has comment: http://stackoverflow.com/comment/35218251
has comment: http://stackoverflow.com/comment/35217673
has body: The stride of your normal array is suspect. Why are you passing 4 for the stride to glNormalPointer (...)? You are telling GL that there are 4-bytes (1 float) worth of space between each of your normals. However, normals is built in your code with 12-bytes between each successive normal. Incidentally, this is what you would call tightly packed and therefore passing 0 for the stride implies the same thing (4-bytes per-component x 3-components). Your vertex array and normal array should actually have the same stride. 4*3 or simply 0.
has comment: http://stackoverflow.com/comment/35216838
has comment: http://stackoverflow.com/comment/35217299
answers question: http://stackoverflow.com/q/23048271
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35217107
has comment: http://stackoverflow.com/comment/35218162
has comment: http://stackoverflow.com/comment/35217249
type: Answer
has comment: http://stackoverflow.com/comment/35216654
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23048271
has comment: http://stackoverflow.com/comment/35216964
has comment: http://stackoverflow.com/comment/35217181
has comment: http://stackoverflow.com/comment/35217136
has comment: http://stackoverflow.com/comment/35216734

http://stackoverflow.com/comment/35234565
type: QuestionComment
comment on: http://stackoverflow.com/q/23024629
score: 0
has text: In this case I would prefer complete stacktrace, this is very short. btw it makes no sense to set character encoding when you pass binary data.
type: Comment

http://stackoverflow.com/a/23054029
has comment: http://stackoverflow.com/comment/35226323
upvote count: 2
has body: it seems you are trying to get possible paths to move in a maze and reach red cell , which has walls (can't cross) or open space . Basically this code is applying a breadth first search . we remove a cell from queue and if the surrounding cells [at distance 1 unit] are not visited , add them to queue and visit them . Pseudocode (from wikipedia) : 1 procedure BFS(G,v) is 2 create a queue Q 3 create a vector set V 4 enqueue v onto Q 5 add v to V 6 while Q is not empty loop 7 t ← Q.dequeue() 8 if t is what we are looking for then 9 return t 10 end if 11 for all edges e in G.adjacentEdges(t) loop 12 u ← G.adjacentVertex(t,e) 13 if u is not in V then 14 add u to V 15 enqueue u onto Q 16 end if 17 end loop 18 end loop 19 return none 20 end BFS suppose you are at cell(i,j) , therefore t=(i,j) and adjacentEdges(t) are (i+1,j) , (i,j+1) , (i-1,j) . (i,j-1) If (i+1,j) is not visited before , add it to queue (so , next time you pop from queue , you will get it) else if it is visited (i.e in V) then we are done with it . Repeat same for other three cells . This way you do O(m*n) operations and visit each cell exactly once .
has comment: http://stackoverflow.com/comment/35227625
has comment: http://stackoverflow.com/comment/35227544
has comment: http://stackoverflow.com/comment/35227434
type: Answer
has comment: http://stackoverflow.com/comment/35226289
score: 2
has comment: http://stackoverflow.com/comment/35228226
has comment: http://stackoverflow.com/comment/35231458
downvote count: 0
has comment: http://stackoverflow.com/comment/35227329
answers question: http://stackoverflow.com/q/23053733

http://stackoverflow.com/q/22987062
has answer: http://stackoverflow.com/a/22987139
linked to: http://stackoverflow.com/q/19365035
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/35106089
has body: I am new to android development, I want my device to get GPS location every 40 seconds in background mode, even after the app got killed. For that, In MyAlarm.class, I have setRepeating the Alarm every 40 seconds to call a "RepeatingAlarm.class(which extends BroadcastReceiver)" using the pending intent. In the onReceive method of the "RepeatingAlarm.class" called every 40 seconds, I have created another pending intent to call MyReceiver.class(which extends BroadcastReceiver). I have passed this pending intent created in the "RepeatingAlarm.class" to a requestLocationUpdate function, to get the GPS location. My problem is that, sometimes I will get the same lat and long values repeatedly every 40 seconds continuing about atleast 3 minutes. Then, the onReceive method of my MyReceiver.class is calling every second, instead of calling once the GPS location got received. I have pasted my code below, Please help me with a solution. MyAlarm.class public void StartAlarm(Context context) { AlarmManager alm=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(context, RepeatingAlarm.class); PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, 0); alm.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 40000, pi); } RepeatingAlarm.class public class RepeatingAlarm extends BroadcastReceiver { public static LocationManager locationManager = null; public static PendingIntent pendingIntent = null; @Override public void onReceive(Context context, Intent intent) { locationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE); Intent intentp = new Intent(context, MyReceiver.class); pendingIntent = PendingIntent.getBroadcast(context, 0, intentp, PendingIntent.FLAG_UPDATE_CURRENT); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); provider = locationManager.getBestProvider(criteria, true); if(provider != null) { locationManager.requestSingleUpdate(locationManager.GPS_…
favorite count: 0
has comment: http://stackoverflow.com/comment/35106998
has title: Location Manager.RequestLocationUpdates using pendingIntent always broadcasting the same location, when gps provider takes long time to get location
type: UnansweredQuestion
tagged with: android
tagged with: location-provider
has comment: http://stackoverflow.com/comment/35105993
tagged with: gps
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35106673
tagged with: java
tagged with: android-pendingintent
has comment: http://stackoverflow.com/comment/35105108
has comment: http://stackoverflow.com/comment/35105612
type: Question
has comment: http://stackoverflow.com/comment/35107197

http://stackoverflow.com/q/23053265
has title: Difference while running KTR manually and through java
accepted answer: http://stackoverflow.com/a/27141532
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27141532
type: Question
has comment: http://stackoverflow.com/comment/35243447
upvote count: 1
has body: Hie All, I use KTR (kettle files) to update my database from POS to ERP, I want to know what is the difference while running KTR manually through terminal and running through java file. I use Ubuntu 12.04 OS for both ERP and POS Systems, Postgres 8.4 as DB. example of running KTR manually: manideep@manideep:~$ /home/manideep/data-integration/pan.sh -file='/home/manideep/resources/ORDERS.ktr' --level=Minimal example of running KTR through java private void callAttributeSync(String gmno) throws KettleException { KettleEnvironment.init(); TransMeta metaData = new TransMeta( "/home/manideep/resources/ORDERS.ktr"); Trans trans = new Trans(metaData); trans.setLogLevel(LogLevel.ROWLEVEL); trans.execute(null); trans.waitUntilFinished(); if (trans.getErrors() &gt; 0) { System.out.println("Error while ORDER Transformation"); }else{ System.out.println("Succesfully Completed ORDER Transformation"); } } I Strongly believe that there is some difference in both the executions. Thanks in advance.
has comment: http://stackoverflow.com/comment/43260940
answer count: 1
has comment: http://stackoverflow.com/comment/35296960
tagged with: kettle
favorite count: 0
tagged with: postgresql-8.4
tagged with: ubuntu-12.04
downvote count: 0

http://stackoverflow.com/comment/35321164
type: QuestionComment
comment on: http://stackoverflow.com/q/23107050
type: Comment
has text: 1. select your project and hit F5 to refresh out of eclipse changes. 2. top bar-> Project -> Clean
score: 0

http://stackoverflow.com/comment/35131813
comment on: http://stackoverflow.com/q/23001152
type: QuestionComment
has text: Sounds like they're trying to make the naming scheme case-sensitive.
type: Comment
score: 0

http://stackoverflow.com/comment/35193157
type: QuestionComment
comment on: http://stackoverflow.com/q/23030663
has text: Actually I resolved it. I just uninstalled the program. Deleted the IntelliJ settings program in MyDocuments. Deleted the IntelliJ folder in my Program Files. Reinstalled IntelliJ. Worked like magic :D
score: 0
type: Comment

http://stackoverflow.com/comment/35250272
comment on: http://stackoverflow.com/q/23066465
type: Comment
type: QuestionComment
has text: I'm not that familiar with JDBI, but the docs mention creating a class based on the [ResultSetMapper](http://jdbi.org/apidocs/org/skife/jdbi/v2/tweak/ResultSetMapper.html) interface and passing it using `handle.create("select * from sometable").map(MyMapper)` command.
score: 0

http://stackoverflow.com/comment/35316675
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23104363
score: 0
has text: Use a separate .java for a class. Put them in the same subdirectory, aka java package, like: `package myprojoect.database.entitys;`.

http://stackoverflow.com/q/23071759
tagged with: textview
has answer: http://stackoverflow.com/a/23071770
accepted answer: http://stackoverflow.com/a/23071770
possible better answer: http://stackoverflow.com/a/23071969
score: 1
type: Question
type: AnsweredQuestion
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/23071969
upvote count: 1
has title: How to read nth character in a textview/string
downvote count: 0
tagged with: string
has body: I have a textview with @id checkMe. The text saved in this text view is "00100". I've parsed the text from the change me textview to a string called getText. I have an onclick method using a button called btnChange. I'd like the application to check the 3rd character in the string and if it is 1, //Do something (I have the 'do something figured out). I have tried goolging an answer for this but have only found results looking for the nth occurance of a character or 'replace nth character' solutions. EDIT: it seems regionMatches is the function I'm after but I'm not sure how to implement it.
favorite count: 0
tagged with: android

http://stackoverflow.com/a/22999774
score: 0
type: Answer
has body: You can still use Hibernate to fetch millions of data, it's just that you cannot do it in one round because millions is a big number and of course you will have out of memory exception. You can divide it into pages and then dump to XML each time, so that the records won't be keep in RAM and your program would not be needing so huge of memory. I have these 2 methods in my previous project that I used very frequently. Unfortunately I did not like to use HQL so much so I don't have the code for that. So here INT_PAGE_SIZE is the amount of rows that you would like to fetch each round, and getPageCount is to get the amount of total rounds to do to fetch all of the records. Then paging is to fetch the records by page, from 1 to getPageCount. public int getPageCount(Criteria criteria) { ProjectionList pl = Projections.projectionList(); pl.add(Projections.rowCount()); criteria.setProjection(pl); int rowCount = (Integer) criteria.list().get(0); criteria.setProjection(null); if (rowCount % INT_PAGE_SIZE == 0) { return rowCount / INT_PAGE_SIZE; } return rowCount / INT_PAGE_SIZE + 1; } public Criteria paging(Criteria criteria, int page) { if (page != -1) { criteria.setFirstResult((page - 1) * INT_PAGE_SIZE); criteria.setMaxResults(INT_PAGE_SIZE); } return criteria; }
answers question: http://stackoverflow.com/q/22998281

http://stackoverflow.com/q/23115681
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35337655
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23208498
has body: In my current android project I create two bitmaps from xml resources. Every time I build my project using the xml bitmaps as the resource for Bitmap.decodeResources() I get a null pointer exception when I try to access the bitmaps. But when I switch to using the straight .png the error goes away. Why is decodeResources() returning null? code where the bitmaps are created: public OvertButton(float x, float y, float width, float height, int pressedId, int unPressedId, Resources res, boolean visible) { \\these are null if xml bitmap is passed pressed = BitmapFactory.decodeResource(res, pressedId); unPressed = BitmapFactory.decodeResource(res, unPressedId); this.visible = visible; relocate(x, y); resize(width, height); //throws NPE when I createScaledBitmap() ClickableManager.registerClickable(this); } resource file &lt;bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/play_button_pressed" android:filter="false" android:antialias="false" android:dither="false"/&gt; and the resize method @Override public void resize(float width, float height) { box.set(box.left, box.top, box.left + width, box.top + height); Log.d("resize",String.valueOf(height)); pressed = Bitmap.createScaledBitmap(pressed, (int)width, (int)height, true); unPressed = Bitmap.createScaledBitmap(unPressed, (int)width, (int)height, true); } And the logcat 04-16 09:45:06.341 11824-11824/com.handmade.eed D/dalvikvm﹕ Late-enabling CheckJNI 04-16 09:45:06.450 11824-11824/com.handmade.eed D/MenuActivity﹕ 2130837594$$$2130837596 04-16 09:45:06.451 11824-11824/com.handmade.eed D/skia﹕ --- SkImageDecoder::Factory returned null 04-16 09:45:06.451 11824-11824/com.handmade.eed D/OvertButton﹕ true2130837591 04-16 09:45:06.457 11824-11824/com.handmade.eed D/OvertButton﹕ false2130837595 04-16 09:45:06.457 11824-11824/com.handmade.eed D/resize﹕ 252.0 04-16 09:45:06.458 11824-11824/com.handmade.eed D/AndroidRuntime﹕ Shutting down VM 04-16 09:45:06.459 11824-11824/com.handmade.eed W/da…
has comment: http://stackoverflow.com/comment/35337812
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35337951
has title: Null Pointer Exception in Bitmap.decodeResources() from xml resource
tagged with: android
accepted answer: http://stackoverflow.com/a/23208498
has comment: http://stackoverflow.com/comment/35338100
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
upvote count: 1
tagged with: bitmap
type: Question

http://stackoverflow.com/q/22989840
has comment: http://stackoverflow.com/comment/35109544
tagged with: android
has comment: http://stackoverflow.com/comment/65443391
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22990672
tagged with: simpledateformat
has comment: http://stackoverflow.com/comment/35109946
tagged with: java
upvote count: 10
has answer: http://stackoverflow.com/a/39046766
type: Question
has answer: http://stackoverflow.com/a/22990132
answer count: 8
has comment: http://stackoverflow.com/comment/91919935
score: 10
has answer: http://stackoverflow.com/a/22990238
has answer: http://stackoverflow.com/a/39029334
tagged with: date
has answer: http://stackoverflow.com/a/22990249
has answer: http://stackoverflow.com/a/22990026
downvote count: 0
has body: I have a SimleDateFormat like this SimpleDateFormat format = new SimpleDateFormat("MMM dd,yyyy hh:mm"); String date = format.format(Date.parse(payback.creationDate.date)); I'm giving date with the format like "Jan,23,2014". Now, I want to get day, month and year separately. How can I implement this?
possible better answer: http://stackoverflow.com/a/22990249
accepted answer: http://stackoverflow.com/a/22990132
has comment: http://stackoverflow.com/comment/35109501
favorite count: 0
has answer: http://stackoverflow.com/a/22989955
has title: Get day, month and year separately using SimpleDateFormat

http://stackoverflow.com/q/23113662
tagged with: logback
tagged with: jboss
answer count: 1
accepted answer: http://stackoverflow.com/a/23137975
score: 0
has title: joranConfigurator doing multiple tasks
has body: I have a project where logback uses joranConfigurator to get a system variable in a startup bean, but I also want to tell it to parse an XML file with the logback configuration AFTER it has already gotten the variable set up... I cant rely on using the standard logback.xml name because the way the project is set up I have to do it this way heres my current code: private void configureLogBack() { LoggerContext context = (LoggerContext)LoggerFactory.getILoggerFactory(); try { JoranConfigurator configurator = new JoranConfigurator(); configurator.setContext(context); // Call context.reset() to clear any previous configuration, e.g. // default // configuration. For multi-step configuration, omit calling // context.reset(). // context.reset(); configurator.doConfigure(System.getenv("logPath")); } catch (JoranException je) { // StatusPrinter will handle this } StatusPrinter.printInCaseOfErrorsOrWarnings(context); } do I do context.reset() then do another configurator.doConfigure()? and what do I pass in as the argument, the name of the xml file??? thank you!
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23137975
tagged with: java

http://stackoverflow.com/q/23067383
upvote count: 1
favorite count: 0
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: web-services
has body: I am providing a common service which has been currently exposed through JAX-WS with JAX-RS (Jersey) now. The given service has operations on items similar to those in HTTP, Create, Find, Update. These can be mapped to GET, POST and PUT. But I do have operations on items like revise, localize etc. An item is always comprised of a system-generated ID and Revision. The first ones are really easy to implement: GET /items/{type}/{id}/{revision} -- revision is optional PUT /items/{type}/{id}/{revision} -- updates the content of a revision POST /items/{type} -- creates a completely new item How to map revise, localize without breaking semantics of REST? I was used to use Spring's @RequestMapping header value and thought I could do the following with PUT. PUT /items/{type}/{id}/{revision} Sub-Method: (REVISE, LOCALIZE, etc.) This is not possible ith Jersey, though I do not even know if this is a good approach. Advises highly recommended. EDIT: PUT with a revise contradicts with the idempotency of the aforementioned method.
score: 1
tagged with: java
type: Question
tagged with: jersey
tagged with: jersey-2.0
has title: Mapping custom operations on resources other than HTTP provides with REST through JAX-RS (Jersey)
tagged with: rest

http://stackoverflow.com/comment/35214563
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23047358
has text: Yeah, probably best to have two nested while loops: one for name/more names and the second one to check if user input yes or no. You exit the second one when the user has input yes or no, you exit the outer (first) one, when the user inputs no.
type: AnswerComment

http://stackoverflow.com/comment/35270154
type: Comment
has text: As I understood in our team every developer change format only for affected part of code. Thus all code has differents formats
type: AnswerComment
comment on: http://stackoverflow.com/a/23078010
score: 0

media-player
tags question: http://stackoverflow.com/q/23086296
type: Tag
tag name: media-player

http://stackoverflow.com/comment/35343094
has text: Thank you!! I'm using it for Android!
type: Comment
comment on: http://stackoverflow.com/a/23118314
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35340587
type: QuestionComment
has text: Look at Thread.sleep(), you can easily throw that in a loop which'll suspend the execution of each loop iteration.
type: Comment
comment on: http://stackoverflow.com/q/23117622
score: 0

http://stackoverflow.com/comment/35174734
type: QuestionComment
has text: Duplicate of [Write jax-ws web service and generate WSDL without XSD](http://stackoverflow.com/questions/17399718/write-jax-ws-web-service-and-generate-wsdl-without-xsd)
comment on: http://stackoverflow.com/q/22971871
score: 0
type: Comment

http://stackoverflow.com/comment/35297325
has text: Oh. Makes sense. Please pardon my ignorance on this. I've been doing Android Dev for only a few weeks myself. So I'm still learning - thus why I asked the question. Up to this point, I've yet to use a constuctor. So I'd not run into this before.
comment on: http://stackoverflow.com/q/23091812
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35124419
has text: 2 semaphores for every thread, ping and pong? how would I make them wait?
comment on: http://stackoverflow.com/q/22997434
type: Comment
type: QuestionComment
score: 0

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

http://stackoverflow.com/comment/35177490
has text: what these numbers are from? ohh!!
comment on: http://stackoverflow.com/a/23026557
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23078446
type: Answer
has body: If you are going to use Spring consider JdbcTemplate.batchUpdate
answers question: http://stackoverflow.com/q/23078280
has comment: http://stackoverflow.com/comment/35273104
score: 0
has comment: http://stackoverflow.com/comment/35272206

http://stackoverflow.com/comment/40764503
type: Comment
comment on: http://stackoverflow.com/a/26023202
type: AnswerComment
has text: `"genres": [ 06 "Animation", 07 "Kids & Family", 08 "Science Fiction & Fantasy", 09 "Comedy" 10 ],` -- that's an array. The error clearly is occurring because he's asking for an OBJECT out of the array when the elements are STRINGS.
score: 0

http://stackoverflow.com/q/23077916
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/23078060
favorite count: 0
linked to: http://stackoverflow.com/q/15711786
has comment: http://stackoverflow.com/comment/35270009
score: 2
has body: I use Eclipse for development. Without thinking, I have formatted all project. Now I click commit in svn and see that I changed every file. It is very annoying. Is there way to return code as before formatting? I could be make revert from svn But at this case I loose change - I will not want make it.
upvote count: 2
accepted answer: http://stackoverflow.com/a/23078010
has comment: http://stackoverflow.com/comment/35270029
has comment: http://stackoverflow.com/comment/35270489
has answer: http://stackoverflow.com/a/23078060
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23078010
tagged with: svn
tagged with: java
tagged with: formatting
tagged with: eclipse
has title: Eclipse. how to return code state as before formatting
type: Question

http://stackoverflow.com/comment/35129983
type: QuestionComment
comment on: http://stackoverflow.com/q/23000676
has text: I looked through it some times...
score: 0
type: Comment

http://stackoverflow.com/comment/35310301
comment on: http://stackoverflow.com/q/23100014
has text: @peeskillet Thank you for the suggestion! I did not end up using GridLayout, but I did use GridBagLayout, and that seems to be (so far) working.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23038237
has answer: http://stackoverflow.com/a/23038450
tagged with: css
has body: I'm new to JavaFx and I'm coming along but have a question. button.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent e) { System.out.println("Hello World"); } }); Can someone explain why there is a method inside the parentheses and when it is used/is useful. If you don't know how to explain it, can you please just tell me what it is called so I can research it. Thanks.
has answer: http://stackoverflow.com/a/23038583
tagged with: java
tagged with: javafx
type: Question
score: 0
answer count: 2
has title: JavaFx Hello World Questions
type: UnansweredQuestion

http://stackoverflow.com/comment/35202247
type: Comment
has text: If you are using one of advanced IDEs, you can fold the imports to 1 line :-)
comment on: http://stackoverflow.com/q/23039569
score: 0
type: QuestionComment

http://stackoverflow.com/a/23004629
downvote count: 0
has comment: http://stackoverflow.com/comment/35136654
has body: See the documentation here: https://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Sheet.html The method you are looking for I believe is the method getPaneInformation() which will tell you if the pane you are currently looking at is a freeze or split pane.
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23004545
has comment: http://stackoverflow.com/comment/35178750
answers question: http://stackoverflow.com/q/23004545
has comment: http://stackoverflow.com/comment/35223946
score: 2
type: AcceptedAnswer

http://stackoverflow.com/a/23007726
accepted answer of: http://stackoverflow.com/q/23006506
score: 1
answers question: http://stackoverflow.com/q/23006506
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: Try CDATA: L-V: 10 a 20 S-D: 11 a 15 4000

http://stackoverflow.com/comment/35296940
has text: This is what I know: Insert does insert a NEW node/position into the list, and this is the reason for my delete. Each time I insert into the list, I am increasing the # of elements in the list and so each insert must of a corresponding delete. Only the LIST ADT has a replace method, not the array list or doubly linked. What the algorithm does is see what POSITION holds the highest element, then it swaps the ELEMENTS in the position, so first the selection sort compares positions, and then it swaps the elements in the position BTW, I have tried using the replace, same results
type: AnswerComment
comment on: http://stackoverflow.com/a/23092270
score: 0
type: Comment

http://stackoverflow.com/q/23096305
has comment: http://stackoverflow.com/comment/35331002
type: Question
has answer: http://stackoverflow.com/a/42280844
tagged with: object
has answer: http://stackoverflow.com/a/23096381
score: 3
has comment: http://stackoverflow.com/comment/35311364
tagged with: oop
has answer: http://stackoverflow.com/a/23096339
has comment: http://stackoverflow.com/comment/35303411
has answer: http://stackoverflow.com/a/23096377
has comment: http://stackoverflow.com/comment/35303394
tagged with: inheritance
tagged with: protected
accepted answer: http://stackoverflow.com/a/23096381
upvote count: 4
possible better answer: http://stackoverflow.com/a/23096377
favorite count: 0
has comment: http://stackoverflow.com/comment/35411958
has comment: http://stackoverflow.com/comment/35391833
has comment: http://stackoverflow.com/comment/35303646
answer count: 4
has title: Why does the Object class in Java contain protected methods?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35303368
tagged with: java
downvote count: 1
has body: Why does the Object class in Java contain protected methods, such as clone() and finalize(), if all classes you use or write inherit the instance methods of Object?

http://stackoverflow.com/a/23046446
downvote count: 0
has body: Many of the questions regarding the differences between the two have been covered in a blog post. The gist of it is that the Android plugin for IntelliJ and Android Studio itself come from the same codebase. New features introduced in Android Studio will be available in IntelliJ as well, if not immediately then soon enough. Android Studio offers an Android specific development environment with some of the common setup tasks (including Gradle) more streamlined. IntelliJ is targeted towards developers who do both Android as well as regular Java development. So if you use IDEA for more than just Android development, you are better off sticking with it.
has comment: http://stackoverflow.com/comment/56517333
type: Answer
accepted answer of: http://stackoverflow.com/q/23046384
upvote count: 37
answers question: http://stackoverflow.com/q/23046384
score: 37
has comment: http://stackoverflow.com/comment/49489716
type: AcceptedAnswer

http://stackoverflow.com/a/23093479
upvote count: 1
has body: As you just need to distinguish your objects by groupId, you might override the hashCode() and equals() methods in your class: class MyThing { private int groupId; public int getGroupId(){return groupId;} // new code to add... @Override public int hashCode() { return groupId; } @Override public boolean equals(Object o) { return (o instanceof MyThing &amp;&amp; (groupId == ((MyThing)o).groupId)); } } and then, use a HashSet&lt;MyThing&gt; class to remove the MyThing objects in myArray with duplicated groupId: myArray = new HashSet&lt;MyThing&gt;(Arrays.asList(myArray)).toArray(new MyThing[0]);
answers question: http://stackoverflow.com/q/23093070
score: -1
type: Answer
downvote count: 2

deserialization
type: Tag
tags question: http://stackoverflow.com/q/23044159
tags question: http://stackoverflow.com/q/23093757
tag name: deserialization
tags question: http://stackoverflow.com/q/23061482
tags question: http://stackoverflow.com/q/23108324
tags question: http://stackoverflow.com/q/22992032

http://stackoverflow.com/comment/35349979
comment on: http://stackoverflow.com/q/23122863
score: 0
type: Comment
type: QuestionComment
has text: When you are exporting the jar, do you include the translations folder as part of the export?

http://stackoverflow.com/comment/35344522
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23119149
has text: Problem is not in this that source and destination are the same, but java operations on stream don't allow to append a content on the top of file. [link](http://stackoverflow.com/questions/6127648/writing-in-the-beginning-of-a-text-file-java)
score: 0

http://stackoverflow.com/comment/35077970
type: QuestionComment
type: Comment
has text: A method that returns a `List` can return an `ArrayList`, but anything that calls that method only knows that it returns a `List`. That way, if you decide later that the method should return a `LinkedList`, you don't have to make any changes to the code that calls the method.
score: 1
comment on: http://stackoverflow.com/q/22971246

http://stackoverflow.com/comment/96203419
score: 0
type: AnswerComment
has text: Guys, how can we go about passing the OPENSHIFT_DIY_PORT through unix cli when starting the application? I know we can use -D to pass override parameters, but does that also work for env variables? Ex.: nohup java -Xmx1024m -jar -Dspring.profiles.active="whatever". Is there a way to do that with env vars?
type: Comment
comment on: http://stackoverflow.com/a/23027709

http://stackoverflow.com/comment/35248682
type: Comment
type: QuestionComment
has text: @DuKes0mE I added my attemps
comment on: http://stackoverflow.com/q/23065842
score: 0

http://stackoverflow.com/comment/35188422
type: Comment
type: QuestionComment
has text: @@ skiwi :( I tried with eclipse and netbeans also , they gave me same error message ... I don't know I WISH that it was just a installation error or something like that .. I tested twice :(
comment on: http://stackoverflow.com/q/23007023
score: 0

http://stackoverflow.com/q/22987573
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35105463
linked to: http://stackoverflow.com/q/18385362
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22987731
has title: Load big Images in Android
tagged with: image
has answer: http://stackoverflow.com/a/22987736
has body: It is known that Android has issues with storing bitmap data in RAM memory. I need to load an image (a photo from 13Mpx camera) on the View and then I need to be able to zoom-in and zoom-out the image. The Image should be mutable. Now it is implemented this way: BitmapFactory.Options options = new BitmapFactory.Options(); options.inMutable = true; _bitmap = BitmapFactory.decodeFile(_path, options); When I take a large photo (13 or 8 Mpx) programm crushed with "Out of memory" error. I need some solution for this problem. I need some class that can load and operate (scaling it) with big images. It's needed to be equal or less than API-8. I tried Universall Image Loader, but it has no scaling option. Does someone know any ideas how to solve this problem?
type: Question
has answer: http://stackoverflow.com/a/23004429
upvote count: 1
has answer: http://stackoverflow.com/a/22987669
has answer: http://stackoverflow.com/a/22987780
favorite count: 0
answer count: 5
tagged with: android

http://stackoverflow.com/q/23057200
type: Question
has body: I was going through the code of Guava library, i was interested to understand the probabilistic match code of mightContain. could any one explain what they are doing in the code specially with the bit wise operator. here is the code.... public &lt;T&gt; boolean mightContain(T object, Funnel&lt;? super T&gt; funnel, int numHashFunctions, BitArray bits) { long hash64 = Hashing.murmur3_128().newHasher().putObject(object, funnel).hash().asLong(); int hash1 = (int) hash64; int hash2 = (int) (hash64 &gt;&gt;&gt; 32); for (int i = 1; i &lt;= numHashFunctions; i++) { int nextHash = hash1 + i * hash2; if (nextHash &lt; 0) { nextHash = ~nextHash; } // up to here, the code is identical with the previous method if (!bits.get(nextHash % bits.size())) { return false; }
has answer: http://stackoverflow.com/a/23057417
has title: Logic of code Guava's mightContain
has answer: http://stackoverflow.com/a/23057849
accepted answer: http://stackoverflow.com/a/23057849
score: 0
answer count: 2
tagged with: bloom-filter
tagged with: operators
has comment: http://stackoverflow.com/comment/35232208
possible better answer: http://stackoverflow.com/a/23057417
type: AnsweredQuestion
tagged with: guava
tagged with: java
has comment: http://stackoverflow.com/comment/35232269

http://stackoverflow.com/q/23077678
type: UnansweredQuestion
tagged with: text
tagged with: java
tagged with: javafx
type: Question
tagged with: tostring
has answer: http://stackoverflow.com/a/23077793
has title: Displaying toString() of an object in JavaFX
score: 0
answer count: 1
has body: I can't seem to properly display a toString() from a referenced object using JavaFX, I wasn't able to find anything on the matter. The search properly returns an object of type PostalCode, however text() will not reference its toString(). Can someone explain how to make the toString viewable? PostalCode closestFilteredPostalCode = postalCodeIndex.search(latitude, longitude); TextBuilder.create().text(closestFilteredPostalCode).font(fontTitle).build();

http://stackoverflow.com/comment/80225366
comment on: http://stackoverflow.com/a/26836080
has text: @smoothreggae - Yup, it certainly looks like that's now the case! We actually moved away from calling .execute() a while back and just make it a jar task dependency. I'll update the answer to show that.
score: 0
type: AnswerComment
type: Comment

user-interface
tags question: http://stackoverflow.com/q/23054785
tags question: http://stackoverflow.com/q/23093087
tags question: http://stackoverflow.com/q/23015210
tags question: http://stackoverflow.com/q/23048925
tags question: http://stackoverflow.com/q/23049354
tags question: http://stackoverflow.com/q/22991128
tags question: http://stackoverflow.com/q/22988043
tags question: http://stackoverflow.com/q/23092661
tags question: http://stackoverflow.com/q/23043472
tags question: http://stackoverflow.com/q/22977126
tags question: http://stackoverflow.com/q/23024823
tags question: http://stackoverflow.com/q/23045338
tags question: http://stackoverflow.com/q/22989633
tags question: http://stackoverflow.com/q/23079656
tags question: http://stackoverflow.com/q/22998378
tags question: http://stackoverflow.com/q/23041226
type: Tag
tags question: http://stackoverflow.com/q/23061816
tags question: http://stackoverflow.com/q/23055318
tags question: http://stackoverflow.com/q/23115878
tags question: http://stackoverflow.com/q/23068745
tags question: http://stackoverflow.com/q/23045557
tags question: http://stackoverflow.com/q/23043319
tags question: http://stackoverflow.com/q/23117568
tags question: http://stackoverflow.com/q/23118594
tags question: http://stackoverflow.com/q/23126313
tags question: http://stackoverflow.com/q/23094421
tags question: http://stackoverflow.com/q/23073460
tags question: http://stackoverflow.com/q/23065061
tags question: http://stackoverflow.com/q/23078449
tags question: http://stackoverflow.com/q/23114254
tags question: http://stackoverflow.com/q/22999136
tags question: http://stackoverflow.com/q/22974731
tags question: http://stackoverflow.com/q/23118080
tags question: http://stackoverflow.com/q/23058213
tags question: http://stackoverflow.com/q/23106262
tags question: http://stackoverflow.com/q/22986006
tags question: http://stackoverflow.com/q/22972193
tags question: http://stackoverflow.com/q/23016484
tags question: http://stackoverflow.com/q/23011428
tags question: http://stackoverflow.com/q/23062209
tags question: http://stackoverflow.com/q/23100014
tags question: http://stackoverflow.com/q/23063324
tags question: http://stackoverflow.com/q/23129770
tags question: http://stackoverflow.com/q/23114782
tags question: http://stackoverflow.com/q/22977959
tags question: http://stackoverflow.com/q/23086583
tags question: http://stackoverflow.com/q/22991590
tags question: http://stackoverflow.com/q/22970785
tags question: http://stackoverflow.com/q/23042668
tags question: http://stackoverflow.com/q/23121605
tags question: http://stackoverflow.com/q/22994873
tags question: http://stackoverflow.com/q/23112571
tags question: http://stackoverflow.com/q/22981420
tags question: http://stackoverflow.com/q/23011396
tags question: http://stackoverflow.com/q/23045563
tags question: http://stackoverflow.com/q/23045626
tags question: http://stackoverflow.com/q/23034892
tags question: http://stackoverflow.com/q/23038917
tags question: http://stackoverflow.com/q/23015377
tags question: http://stackoverflow.com/q/22976397
tags question: http://stackoverflow.com/q/23088714
tags question: http://stackoverflow.com/q/23068755
tags question: http://stackoverflow.com/q/22998153
tag name: user-interface
tags question: http://stackoverflow.com/q/23121580
tags question: http://stackoverflow.com/q/23051671
tags question: http://stackoverflow.com/q/23066159
tags question: http://stackoverflow.com/q/23029647
tags question: http://stackoverflow.com/q/23091677

http://stackoverflow.com/comment/35240266
has text: Can you include what you've tried that isn't working?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23060357
type: QuestionComment

video
tags question: http://stackoverflow.com/q/23084553
type: Tag
tags question: http://stackoverflow.com/q/23057310
tags question: http://stackoverflow.com/q/23015433
tag name: video

http://stackoverflow.com/comment/35338583
comment on: http://stackoverflow.com/q/23116465
has text: `String` and `MultiPart` do not share any common inheritance, so you cannot cast them.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35169754
comment on: http://stackoverflow.com/q/23022083
score: 0
has text: @fge simply brilliant. hopefully i'm not the only one to get it.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22979956
answer count: 1
has answer: http://stackoverflow.com/a/22980181
tagged with: java
type: UnansweredQuestion
upvote count: 0
favorite count: 0
tagged with: arraylist
type: Question
tagged with: io
has comment: http://stackoverflow.com/comment/35092056
score: -1
has body: I'm working on a project for a class, and I think I've got it mostly figured out, but it keeps giving me different Exception errors and now I'm stumped. The instructions can be found here: http://www.cse.ohio-state.edu/cse1223/currentsem/projects/CSE1223Project11.html Here is the code I have thus far, currently giving me and IndexOutOfBounds exception in the getMaximum method. Any help would be much appreciated. import java.io.*; import java.util.*; public class Project11a { public static void main(String[] args) throws FileNotFoundException { Scanner keyboard = new Scanner(System.in); System.out.print("Enter an input file name: "); String fileName = keyboard.nextLine(); Scanner in = new Scanner(new File(fileName)); System.out.print("Enter an output file name: "); String outFile = keyboard.nextLine(); PrintWriter outputFile = new PrintWriter(outFile); while (in.hasNextLine()) { String name = in.nextLine(); List&lt;Integer&gt; series = readNextSeries(in); int mean = getAverage(series); int median = getMedian(series); int max = getMaximum(series); int min = getMinimum(series); outputFile.printf("%-22s%6d%n", name, mean, median, max, min); } in.close(); outputFile.close(); } // Given a Scanner as input read in a list of integers one at a time until a // negative // value is read from the Scanner. Store these integers in an // ArrayList&lt;Integer&gt; and // return the ArrayList&lt;Integer&gt; to the calling program. private static List&lt;Integer&gt; readNextSeries(Scanner inScanner) { List&lt;Integer&gt; nextSeries = new ArrayList&lt;Integer&gt;(); while (inScanner.hasNextInt()) { int currentLine = inScanner.nextInt(); if (currentLine != -1) { nextSeries.add(currentLine); } else { break; } } return nextSeries; } // Given a List&lt;Integer&gt; of integers, compute the median of the list and // return it to // the calling program. private static int getMedian(List&lt;Integer&gt; inList) { Collections.sort(inList); int middle = inList.size() / 2; int median = -1; if (inL…
has title: IndexOutOfBoundsException while accessing List
downvote count: 1

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/22986541
tags question: http://stackoverflow.com/q/23043631
tags question: http://stackoverflow.com/q/23079364
tags question: http://stackoverflow.com/q/23043589
tags question: http://stackoverflow.com/q/22989887
tags question: http://stackoverflow.com/q/22982177
tags question: http://stackoverflow.com/q/23096368
tags question: http://stackoverflow.com/q/23032173
tags question: http://stackoverflow.com/q/23070298
tags question: http://stackoverflow.com/q/23003179
tags question: http://stackoverflow.com/q/22970087
tags question: http://stackoverflow.com/q/23077099
tags question: http://stackoverflow.com/q/23002915
tags question: http://stackoverflow.com/q/23013339
tags question: http://stackoverflow.com/q/23085396
tags question: http://stackoverflow.com/q/23002058
tags question: http://stackoverflow.com/q/22986878
tags question: http://stackoverflow.com/q/23086743
tags question: http://stackoverflow.com/q/23004663
tags question: http://stackoverflow.com/q/23060559
tags question: http://stackoverflow.com/q/23098308
tags question: http://stackoverflow.com/q/22991984
tags question: http://stackoverflow.com/q/23047825
tags question: http://stackoverflow.com/q/23071841
tags question: http://stackoverflow.com/q/23070892
tags question: http://stackoverflow.com/q/22986975
tags question: http://stackoverflow.com/q/23122441
tags question: http://stackoverflow.com/q/22985920
tags question: http://stackoverflow.com/q/22976087
tags question: http://stackoverflow.com/q/23104009
tags question: http://stackoverflow.com/q/23033150
tags question: http://stackoverflow.com/q/23055460
type: Tag
tags question: http://stackoverflow.com/q/23042345
tags question: http://stackoverflow.com/q/23005412
tags question: http://stackoverflow.com/q/23031999
tags question: http://stackoverflow.com/q/23084344
tags question: http://stackoverflow.com/q/23073757
tags question: http://stackoverflow.com/q/23082573
tags question: http://stackoverflow.com/q/23071765
tags question: http://stackoverflow.com/q/23067022
tags question: http://stackoverflow.com/q/23082431
tags question: http://stackoverflow.com/q/22981729
tags question: http://stackoverflow.com/q/23020532
tags question: http://stackoverflow.com/q/23039819
tags question: http://stackoverflow.com/q/23107778
tags question: http://stackoverflow.com/q/23088855
tags question: http://stackoverflow.com/q/23037279
tags question: http://stackoverflow.com/q/23029707
tags question: http://stackoverflow.com/q/22982111
tags question: http://stackoverflow.com/q/23033782
tags question: http://stackoverflow.com/q/23086320
tags question: http://stackoverflow.com/q/23060192
tags question: http://stackoverflow.com/q/23078242
tags question: http://stackoverflow.com/q/23027051
tags question: http://stackoverflow.com/q/23112193
tags question: http://stackoverflow.com/q/23077040
tags question: http://stackoverflow.com/q/23019052
tags question: http://stackoverflow.com/q/23005558
tags question: http://stackoverflow.com/q/23118407
tags question: http://stackoverflow.com/q/23118114
tags question: http://stackoverflow.com/q/22988646
tags question: http://stackoverflow.com/q/23007567
tags question: http://stackoverflow.com/q/23103235
tags question: http://stackoverflow.com/q/23041088
tags question: http://stackoverflow.com/q/23021151
tags question: http://stackoverflow.com/q/22968977
tags question: http://stackoverflow.com/q/22981581
tags question: http://stackoverflow.com/q/23072624
tags question: http://stackoverflow.com/q/23039957
tags question: http://stackoverflow.com/q/22995678
tags question: http://stackoverflow.com/q/23129443
tags question: http://stackoverflow.com/q/23057064
tag name: json
tags question: http://stackoverflow.com/q/22978025
tags question: http://stackoverflow.com/q/23069536
tags question: http://stackoverflow.com/q/23010768
tags question: http://stackoverflow.com/q/23071662
tags question: http://stackoverflow.com/q/23095258
tags question: http://stackoverflow.com/q/22968913

http://stackoverflow.com/comment/35294980
comment on: http://stackoverflow.com/q/23091812
type: Comment
type: QuestionComment
score: 1
has text: You're passing `String`s for the `double price`.

http://stackoverflow.com/comment/35082713
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22973900
score: 0
has text: thanks!! now the jtextfield isn't empty anymore...but it always displays the same line (the first one) even tho the counter and lines number is at 5 or 20

http://stackoverflow.com/comment/35255260
type: Comment
score: 2
comment on: http://stackoverflow.com/q/23069662
has text: @AnthonyJClink How, in heavens name, would the mod operator be helpful here? It is simple addition!
type: QuestionComment

http://stackoverflow.com/a/23041643
upvote count: 36
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Method 1 (using servlet's init param jersey.config.server.provider.packages): is Jersey specific and looks only in packages. It is not portable between different JAX-RS implementations. You can use it in scenarios when you want to restrict the considered JAX-RS Resource classes/applications. Method 2 (using servlet's init param javax.ws.rs.Application): any JAX-RS implementation MUST support this deployment option, thus portable (although if you switch to another JAX-RS implementation like RestEasy, you will have to change the servlet's class). This option offers more granularity (you can select exactly the classes to be considered, not only entire packages). The disadvantage: you have to write more code. Method 3 (in a Servlet ver. 3 Container, where you probably already deploy): defining only your JAX-RS applications without any servlets (check Deployment using web.xml descriptor) is probably the best way (it is also portable between JAX-RS implementations and you can change the JAX-RS implementation without a change in web.xml), if you have an explicitly declared JAX-RS Application (which you have). Method 4 If you want to deploy all classes from your war archive in a servlet container 3 (without an explicitly-defined JAX-RS application), you can do that also in a portable way. Check it here: JAX-RS application without an Application subclass
answers question: http://stackoverflow.com/q/22994690
score: 36
accepted answer of: http://stackoverflow.com/q/22994690

http://stackoverflow.com/comment/35128360
comment on: http://stackoverflow.com/q/22999959
type: Comment
score: 1
type: QuestionComment
has text: Try to clean your project (Project > Clean > Select your project)

http://stackoverflow.com/a/23056415
answers question: http://stackoverflow.com/q/23055534
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: The reason for your failure is workspace resolution in eclipse. Eclipse m2e injects itself into the artifact resolution of maven. So when your my-project tries to get all dependencies, the artifact resolver returns not the jar file (which does not yet exist), but the classes folder of your dependent project. If you try to build your project using "run as -> maven install", it should work. So this is a scenario that you cannot comfortably resolve in workspace. Either turn of workspace resolution for my-project, disable the dependency plugin inside your eclipse (lifecycle bindings) or use a different plugin like assembly to copy your depdencies (which is cleaner, btw.). Note however, that the latter will also only work if maven is called manually.
accepted answer of: http://stackoverflow.com/q/23055534

http://stackoverflow.com/q/23069642
has body: I am essentially trying to replicate this app: https://itunes.apple.com/app/id785725887 I want to be able to upload and image from gallery and then drag it over whatever is in place. Whether it be a tshirt hat or sock. Any ideas on how I would accomplish this with native android?
tagged with: imageview
score: 0
has comment: http://stackoverflow.com/comment/35255873
tagged with: android
has comment: http://stackoverflow.com/comment/35255825
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/35255652
has title: Make ImageView wrap around a certain object
tagged with: java
type: Question

http://stackoverflow.com/q/22978124
tagged with: draw
answer count: 2
has answer: http://stackoverflow.com/a/60373417
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22978200
has body: I have png image which is saved in my local PC. I want to open(Load) this image and draw a rectangle on this image @ specified location (x, y, width, Height) using java. Can anybody help me to do this... Equivalent C# code is below. I want a java version for the same Image oriImage = // load from file Rectangle rect = new Rectangle(0, 1824, 1080, 96); Bitmap eleImg = new Bitmap(oriImage, (int)(oriImage.Width / rate), (int)(oriImage.Height / rate)); Graphics g = Graphics.FromImage(eleImg); g.DrawRectangle(new Pen(Color.Red, 5), rect);
has title: How do I draw a rectangle on an existing png image using java
score: 2
upvote count: 2
type: Question
tagged with: java

http://stackoverflow.com/comment/94677388
has text: FYI, the terribly troublesome old date-time classes such as [`java.util.Date`](https://docs.oracle.com/javase/10/docs/api/java/util/Date.html) and `java.sql.Timestamp` are now [legacy](https://en.wikipedia.org/wiki/Legacy_system), supplanted by the [*java.time*](https://docs.oracle.com/javase/10/docs/api/java/time/package-summary.html) classes built into Java 8 and later. See [*Tutorial* by Oracle](https://docs.oracle.com/javase/tutorial/datetime/TOC.html).
comment on: http://stackoverflow.com/a/23068695
score: 21
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23002698
has body: Pig doesn't have a name member or even method that accepts a string. Also you are trying to assign a String(keyboard.nextline() to a Pig(pigs[j]. Add an attribute name to your pig. class Pig{ public String name: public void Pig(String name){ this.name = name; } } Then assign a new instance of Pig in the loop. pigs[j] = new Pig(keyboard.nextLine()); Also get rid of the useless class pigNumber. All you need is an ArrayList of Pigs. The array list can be dynanically sized. List&lt;Pig&gt; pigs = new ArrayList&lt;Pig&gt; so your loop could be something like String name = "" while(true){ name = keyboard.readline(); if(name== "stop"){ break; } pigs.add(new Pig(names); } Then getting the number of pigs is a simple System.out.println(pigs.length());
answers question: http://stackoverflow.com/q/23002575
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35134040

http://stackoverflow.com/q/23004035
has body: I have been using Jenkins for quite some time for Continuous integration with my Java projects. Recently I tried the Jenkins Deploy Plugin (https://wiki.jenkins-ci.org/display/JENKINS/Deploy+Plugin) to deploy my war file on tomcat 7. However, I am unable to do so as I am getting the following error: Deploying C:\Program Files (x86)\Jenkins\jobs\MY_PROJS\workspace\target\projs.war to container Tomcat 7.x Remote [C:\Program Files (x86)\Jenkins\jobs\MY_PROJS\workspace\target\projs.war] is not deployed. Doing a fresh deployment. Deploying [C:\Program Files (x86)\Jenkins\jobs\MY_PROJS\workspace\target\projs.war] ERROR: Publisher hudson.plugins.deploy.DeployPublisher aborted due to exception org.codehaus.cargo.container.ContainerException: Failed to deploy [C:\Program Files (x86)\Jenkins\jobs\MY_PROJS\workspace\target\projs.war] at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:115) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:187) at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:64) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:90) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:77) at hudson.FilePath.act(FilePath.java:914) at hudson.FilePath.act(FilePath.java:887) at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:77) at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:47) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1030) at hudson.model.AbstractBuild$AbstractBuildExecution.po…
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38362355
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/39901362
score: 4
tagged with: tomcat
has answer: http://stackoverflow.com/a/44312742
answer count: 1
tagged with: jenkins
type: UnansweredQuestion
has title: Jenkins Tomcat deploymet error
upvote count: 4

http://stackoverflow.com/comment/119959238
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23012529
score: 0
has text: @RMachnik That's a Set implemented with an underlying tree, not really a useful tree :) I'd suggest implementing one, it's just a matter of having a node class with a payload field and a list of children of the same class, plus a couple methods for manipulating it

http://stackoverflow.com/q/22975872
type: UnansweredQuestion
has title: How to Log to Console During Ant Testing Task
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22976421
tagged with: java
type: Question
upvote count: 2
tagged with: ant
has answer: http://stackoverflow.com/a/23010379
answer count: 3
has body: I have an ant task to run unit tests. It looks like this &lt;target name="test-platform" depends="compile_tests"&gt; &lt;mkdir dir="${platform.test.log.dir}"/&gt; &lt;junit fork="true" haltonerror="true"&gt; &lt;classpath refid="test.build.classpath"/&gt; &lt;batchtest todir="${platform.test.log.dir}"&gt; &lt;formatter type="plain" usefile="true"/&gt; &lt;fileset dir="${javatests}"&gt; &lt;include name="**/*Test.java"/&gt; &lt;/fileset&gt; &lt;/batchtest&gt; &lt;/junit&gt; &lt;/target&gt; I have some test that looks like this: public class UserTest extends BaseTestClass { private static final Logger LOGGER = Logger.getLogger(BaseTestClass.class); @Autowired SessionFactory sessionFactory; @Test @SuppressWarnings("unchecked") public void testUser() { List&lt;User&gt; users = sessionFactory .getCurrentSession() .createQuery("from User") .list(); for(User user : users) { LOGGER.info(user.getName()); Assert.assertEquals(user.getName(),String.class); } } } I had created this BaseTestClass to contain a log4j configuration follow several other SO posts. package com.example.test; import org.apache.log4j.BasicConfigurator; public class BaseTestClass { static { BasicConfigurator.configure(); } } But when I run my tests, nothing comes out in the console. How do I fix this?
tagged with: log4j
favorite count: 0
has answer: http://stackoverflow.com/a/66415718

http://stackoverflow.com/q/23055288
tagged with: excel
type: AnsweredQuestion
score: 2
tagged with: java
has body: I am reading data from Excel file for the salary generation in that column is empcode, emp_name,working_days,overtime_hour when reading data from excel file i am read only first three column means i am read only working days i can not read overtime_hour please suggest what i wrong.i tried bellow code public class csv_Upload extends JFrame implements ActionListener { public static JFrame f; JPanel panel; Connection con = null; JButton b1,b2,b3,b4; int Status=0; JTextField txt1; int company_id1=0; JLabel l1; Font g,g1; JFileChooser fc; JTextArea log; File file1 ; String str; JComboBox jb1; public csv_Upload() { panel=(JPanel)getContentPane(); panel.setLayout(null); g=new Font("Georgia",Font.BOLD,22); g1=new Font("Georgia",Font.BOLD,15); panel.setBackground(new java.awt.Color(204, 230 , 255)); l1=new JLabel("Upload Excel File"); l1.setBounds(200, 50, 400, 30); l1.setFont(g); l1.setForeground(Color.RED); panel.add(l1); jb1=LoadCombobox(); jb1.setBounds(200, 100, 180,30); jb1. addItem("Select Company"); panel.add(jb1); txt1=new JTextField(); txt1.setBounds(540, 150,200,40); panel.add(txt1); fc = new JFileChooser(); b1=new JButton("Browse File"); b1.setBounds(30, 150,200,40); b1.setFont(g1); b1.setForeground(Color.RED); panel.add(b1); b2=new JButton("Upload File"); b2.setBounds(240, 150,200,40); b2.setForeground(Color.RED); b2.setFont(g1); panel.add(b2); ImageIcon img=new ImageIcon("calender.png"); b3=new JButton(img); b3.setBounds(460, 150,50,30); b3.setForeground(Color.RED); b3.setFont(g1); panel.add(b3); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); jb1.addItemListener(new company_events()); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == b1) { int returnVal = fc.showOpenDialog(csv_Upload.this); if (returnVal == JFileChooser.APPROVE_OPTION) { file1 = fc.getSelectedFile(); str=String.valueOf(file1); System.out.println("file fath"+file1); } else { } } if(e.getSource()==b2) { if(!(txt1.getText().isEmpty()…
type: Question
has answer: http://stackoverflow.com/a/23059585
downvote count: 0
answer count: 1
tagged with: xssf
favorite count: 0
has title: can not read last column data from excel file
accepted answer: http://stackoverflow.com/a/23059585
upvote count: 2
has comment: http://stackoverflow.com/comment/35230340
tagged with: filereader
tagged with: swing

http://stackoverflow.com/comment/35300883
type: QuestionComment
comment on: http://stackoverflow.com/q/23094877
has text: as a practice, you should close the connection if it does not requires to be open. btw check your mysql configuration to see how many concurrent connections do you have.
score: 0
type: Comment

binding
tags question: http://stackoverflow.com/q/23013711
tags question: http://stackoverflow.com/q/23048500
tags question: http://stackoverflow.com/q/23058980
type: Tag
tag name: binding

http://stackoverflow.com/comment/35203025
comment on: http://stackoverflow.com/q/23041306
has text: Check the id value, I suppose it isn't an array index
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35143108
type: QuestionComment
comment on: http://stackoverflow.com/q/23007364
has text: @maxx777 yes,I had set the content type.Let me edit my code for processRequest method
score: 0
type: Comment

http://stackoverflow.com/comment/35359232
type: QuestionComment
comment on: http://stackoverflow.com/q/23126615
type: Comment
has text: ... and that's your problem: Static fields only exist once, no matter how many instances you create via `new`. Remove those `static` declarations for the two fields and you should be good. - Besides, didn't your IDE/compiler warn you about the "non-static access to a static field" @ `vdetails.vehicleId = vehicleId` and `vdetails.vehicleNo = vehicleNumber`?
score: 0

http://stackoverflow.com/q/22970605
has title: "can't extract token and secret invalid consumer scribe "
score: 1
upvote count: 1
has body: I'm an Italian student and I'm trying to create an IssueTracker Android for Bitbucket. I'm using scribe and but I'm blocked on 1st step (retrieve request token) I've created my BitbucketApi class @Override public String getAccessTokenEndpoint() { return "https://bitbucket.org/!api/1.0/oauth/access_token"; } @Override public String getAuthorizationUrl(Token requestToken) { return "https://bitbucket.org/!api/1.0/oauth/authenticate?oauth_token=" + requestToken.getToken(); } @Override public String getRequestTokenEndpoint() { return "https://bitbucket.org/!api/1.0/oauth/request_token"; } and this is the portion code of my authentication flow OAuthService service = new ServiceBuilder() .provider(BitbucketApi.class) .apiKey(MY_API_KEY) .apiSecret(MY_API_SECRET) .build(); requestToken = service.getRequestToken(); but I receive always that exception after this method: authUrl = service.getAuthorizationUrl(requestToken); because requestToken is null Could someone help me please?
type: Question
has answer: http://stackoverflow.com/a/27896867
tagged with: java
tagged with: scribe
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35100834
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35075278

http://stackoverflow.com/q/23068305
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/23068362
accepted answer: http://stackoverflow.com/a/23068362
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: Lambda Expression example not working in java 8
has comment: http://stackoverflow.com/comment/35252480
has comment: http://stackoverflow.com/comment/35252727
type: Question
has body: I am trying to learn Lambda Expression in java 8. I do have installed eclipse plugin and java 8 SDK but when I am trying to execute following code eclipse is showing error. (String s) -&gt; { s="hello"; System.out.println(s); } its showing "The left-hand side of an assignment must be a variable" error. please help.
upvote count: 6
has answer: http://stackoverflow.com/a/44905184
answer count: 3
has comment: http://stackoverflow.com/comment/35252520
has answer: http://stackoverflow.com/a/38551018
favorite count: 0
possible better answer: http://stackoverflow.com/a/38551018
score: 6

http://stackoverflow.com/comment/35338561
has text: @AndrewThompson: I've converted the code to use nativelib resources and a simple System.loadLibrary() call, which is much cleaner, but still fails the same way. The load library succeeds, but the calls to the native methods fail with a UnsatisfiedLinkError.
score: 0
comment on: http://stackoverflow.com/q/23099832
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35245065
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23064160
has text: Alright, just covering all the bases.
score: 0

android-gridview
type: Tag
tags question: http://stackoverflow.com/q/23019988
tag name: android-gridview
tags question: http://stackoverflow.com/q/23001873
tags question: http://stackoverflow.com/q/22997457
tags question: http://stackoverflow.com/q/22988580

http://stackoverflow.com/a/23117748
answers question: http://stackoverflow.com/q/23117539
has comment: http://stackoverflow.com/comment/35340996
has comment: http://stackoverflow.com/comment/35341027
has comment: http://stackoverflow.com/comment/35340973
has comment: http://stackoverflow.com/comment/35340880
has comment: http://stackoverflow.com/comment/35340912
has comment: http://stackoverflow.com/comment/35340945
score: 0
type: Answer
has body: Try this one. First convert the number into String. Then place a space after every 5 digits. Then split against the space. String str = "123451234512345"; String []splits = str.replaceAll("(\\d{5})", "$1 ").split(" "); for(String s: splits){ System.out.println(s); } Another option, and better one, using pattern matcher. String str = "123451234512345"; Pattern pattern = Pattern.compile("(\\d{5})"); Matcher m = pattern.matcher(str); while(m.find()) { System.out.println(m.group(0)); } Feel free to transfer the values from the array to integer variable.

http://stackoverflow.com/comment/35193220
type: AnswerComment
has text: I also tried the code for Class C that you had attached. I didn't understand as to why we need to define the setname method again in class C. also how can we refer to the getname method of object b instantiated in method2 of class C.
comment on: http://stackoverflow.com/a/23035385
type: Comment
score: 0

http://stackoverflow.com/comment/35437809
comment on: http://stackoverflow.com/a/23044606
type: AnswerComment
type: Comment
has text: I go to add all dependencies but I don't know how I can add repositories on eclipse...
score: 0

http://stackoverflow.com/comment/35243312
comment on: http://stackoverflow.com/q/23063255
has text: What have you tried? A quick search for "maven native dependency" provides a couple of links. Didn't they contain the information you needed? Did you have a particular issue?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35298658
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23093433
type: AnswerComment
has text: @delnan: Actually, what I was trying to indicate was that for any implementation that respects what's specified [here](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html) for the `hashCode` and `equals` methods, this approach should work.

http://stackoverflow.com/comment/35295422
score: 0
type: AnswerComment
has text: I am not sure what you mean by "change the language", but they will not change set of matched/accepted Strings.
type: Comment
comment on: http://stackoverflow.com/a/23091608

http://stackoverflow.com/comment/35237223
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23059379
has text: Exactly: left, self, right! For a sub-tree with the parent node "B" and the left child node "A" and the right child node "C" (as in the question) the in-order output is "ABC". B as the current node - when visiting it - goes _in_ between A and C! Additionally, I did not have a look, whether your answer was a correct answer to the question. I only saw, that you posted an in-order output, but suggested a pre-order method. Currently you have an in-order method and an output that is neither in- nor pre- nor post-order. It's messed up. The in-order output of the example will be the sorted output.

http://stackoverflow.com/a/23166030
has body: Have your tried rolling back your graphics driver? Does this clear up the problem?
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35546390
has comment: http://stackoverflow.com/comment/35546465
downvote count: 0
answers question: http://stackoverflow.com/q/22999977
has comment: http://stackoverflow.com/comment/35546846
type: Answer

http://stackoverflow.com/a/23062365
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: The while loop is a serious programming error. Making your program execute the loop in the Event Dispatcher Thread it gets unable to dispatch any other events (other button presses). You have to eliminate the loop. Doing so the actionPerformed method will run in every button click (given you buttons have actionListeners...).
answers question: http://stackoverflow.com/q/23062209

http://stackoverflow.com/q/23073822
has comment: http://stackoverflow.com/comment/35263203
tagged with: ranking
answer count: 1
favorite count: 0
has body: I'm trying to use fibonacci's sequence as limits for a game's experience points to level conversion (i would like critics on that decision too), something like this: If a player has 49.450 points, he's in level 25, because the closest smaller fibonacci number is 46.368. I'm having trouble, however, to figure out how to do that. Apart from creating a map with levels as keys and limits as values, is there any smarter way?
accepted answer: http://stackoverflow.com/a/23074001
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/35262975
tagged with: java
has comment: http://stackoverflow.com/comment/35262897
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35262922
tagged with: fibonacci
tagged with: math
has answer: http://stackoverflow.com/a/23074001
downvote count: 0
tagged with: sorting
has title: How to find an integer's position in the fibonacci sequence

http://stackoverflow.com/comment/106171750
type: Comment
has text: The center is the parent of the image or the container which is changing size. This works very well.
comment on: http://stackoverflow.com/a/36027997
type: AnswerComment
score: 2

http://stackoverflow.com/comment/35277557
type: AnswerComment
comment on: http://stackoverflow.com/a/23081506
type: Comment
has text: David I am not good in scripts but I have tried to follow your instructions. Please have a look below commands which I tried in terminal Chandras-MacBook-Pro:bin chandraprakash$ chmod a+x *.sh Chandras-MacBook-Pro:bin chandraprakash$ startup.sh: ./startup.sh -bash: startup.sh:: command not found Chandras-MacBook-Pro:bin chandraprakash$ run startup.sh: ./startup.sh -bash: run: command not found
score: 1

http://stackoverflow.com/q/23117138
has comment: http://stackoverflow.com/comment/35340655
has answer: http://stackoverflow.com/a/23117199
has answer: http://stackoverflow.com/a/23117974
has comment: http://stackoverflow.com/comment/35340215
duplicate of: http://stackoverflow.com/q/1383797
has comment: http://stackoverflow.com/comment/35339618
has comment: http://stackoverflow.com/comment/35339985
possible better answer: http://stackoverflow.com/a/23117199
tagged with: dictionary
accepted answer: http://stackoverflow.com/a/23117974
linked to: http://stackoverflow.com/q/1383797
has comment: http://stackoverflow.com/comment/35377072
has body: Tell me please, there any methods in standard library for implementation some simple dictionary look like: "a=10,b=11,c=12...". I know about HashMap, but as I know we can`t get key by value, just value by key.
has title: Key by value, value by key classes in Java standrad libraries
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
answer count: 2

http://stackoverflow.com/q/23041905
has comment: http://stackoverflow.com/comment/35205174
favorite count: 0
tagged with: zooming
has comment: http://stackoverflow.com/comment/35252422
has title: How do I zoom inside JScrollPane with AffineTransform without shifting[EDITED]
tagged with: input
linked to: http://stackoverflow.com/q/3664908
has comment: http://stackoverflow.com/comment/35208425
has comment: http://stackoverflow.com/comment/35217608
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/115103
has comment: http://stackoverflow.com/comment/35251850
has body: I am trying to implement a zoom tool for my game editor. I am using a Color[] to store all the "Colors/tiles" and I want to be able to zoom inside my JPanel to view all the tiles upclose or from far away i.e zoomed in or zoomed out. These are some requirements that I would like to have(Any examples are appreciated and they don't need to include all or any of the requirements. They are there to help you understand what I am aiming for): Zooming should be determined by a zoom variable that can be changed dynamicly(prefferably mouseWheel) When zoomed(in or out) you should be able to navigate horisontaly and vertically with as little as possible tearing or other graphical glitches(using the JScrollBar s in the example) The zooming should be based on where the mouse cursor is and zoom towards that point The zooming can use anything inside normal Java which means no external libraries. This is a very simple version of my editor. I added some test code for zooming but it doesn't work. I am giving you this code so you have something to start from if neccesary. See the PaintComponent method and the mouseWheel listener. EDITED: Thanks to @trashgod you can now place colors at the right position. See MouseTest class! The tearing is gone. package stuff; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.awt.geom.AffineTransform; import java.awt.geom.NoninvertibleTransformException; import java.util.Random; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.Scrollable; import javax.swing.SwingUtilities; public class ZoomPane extends JPanel implements MouseWheelListener, Scrollable { private int width, height, screenWidth, screenHeight, tileSize; private Col…
upvote count: 1
tagged with: graphics2d

http://stackoverflow.com/comment/35266810
type: QuestionComment
has text: @LuiggiMendoza Could you tell me how to do this? I have just one class that I create using java code (it's servlet that does nothing). It's seems that .xml files cause this. But hard to say what's stay any tool to determine that?
comment on: http://stackoverflow.com/q/23076089
score: 0
type: Comment

http://stackoverflow.com/q/23047243
tagged with: jdbc
downvote count: 0
possible better answer: http://stackoverflow.com/a/23048669
score: 1
has body: I am trying to get results from my stored procedure and I am getting ERROR: Incorrect syntax near '{'. . I saw many examples using the same thing for a sql string and I am not sure why I am getting an error..I have the same amount of parameters... when I execute my stored procedure om my database like this exec rptGetAssetbyLocation '2122' I get my 5 columns how do I get results back using Callable Statement ? I am doing something wrong with a registerOutParameter ? try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); String url = "jdbc:sqlserver:..."; String username = "username"; String password = "password"; sb.append(" " + " ID TAG NAME " + " MODEL SERIAL NUMBER "); String query = "{exec rptGetAssetbyLocation(?,?,?,?,?)}"; Connection conn = DriverManager.getConnection(url, username, password); CallableStatement stmt = conn.prepareCall(query); stmt.registerOutParameter(1, java.sql.Types.INTEGER); stmt.registerOutParameter(2, java.sql.Types.VARCHAR); stmt.registerOutParameter(3, java.sql.Types.VARCHAR); stmt.registerOutParameter(4, java.sql.Types.VARCHAR); stmt.registerOutParameter(5, java.sql.Types.VARCHAR); ResultSet rs = stmt.executeQuery(); while (rs.next()) { int id = rs.getInt("ID"); String tag = rs.getString("tag"); String name = rs.getString("name"); String model = rs.getString("model"); String serNum = rs.getString("serialNumber"); sb.append(" " + id + " " + " " + tag + " " + " " + name + " " + " " + model + " " + " " + serNum + " "); } sb.append(" "); } catch(Exception e) { sb.append(" ERROR: " + e.getMessage() + " "); } sb.append(" "); response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println(sb); }
has answer: http://stackoverflow.com/a/23048669
favorite count: 0
accepted answer: http://stackoverflow.com/a/23048021
tagged with: callable-statement
upvote count: 1
type: AnsweredQuestion
tagged with: stored-procedures
tagged with: java
type: Question
answer count: 2
has title: "Incorrect syntax near '{'" calling SQL Server stored procedure
has answer: http://stackoverflow.com/a/23048021
tagged with: sql-server

http://stackoverflow.com/comment/35209053
comment on: http://stackoverflow.com/q/23044522
has text: still lost, I found that stuff hard to read.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35322165
has text: share your code to discuss about
comment on: http://stackoverflow.com/q/23107083
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23098385
has comment: http://stackoverflow.com/comment/35306991
downvote count: 0
tagged with: inheritance
has answer: http://stackoverflow.com/a/23098406
favorite count: 0
tagged with: private
type: Question
has answer: http://stackoverflow.com/a/23098480
has comment: http://stackoverflow.com/comment/35316139
score: 1
has title: Overriding private methods
has answer: http://stackoverflow.com/a/23098445
accepted answer: http://stackoverflow.com/a/23098406
upvote count: 1
has answer: http://stackoverflow.com/a/23098610
tagged with: oop
possible better answer: http://stackoverflow.com/a/23098445
tagged with: java
tagged with: overriding
has body: My java book has the following practice question: public class Person(){...} public class Teacher extends Person{...} And it asks which of the following are true statements: 1: Teacher inherits the constructors of Person. 2: Teacher can add new methods and private instance variables. 3: Teacher can override existing private methods of Person. The book says 2 and 3 are true. I said only 2 is true. I have read that subclasses do indeed inherit private methods and member fields yet they cannot be directly accessed. So my question is how would one override existing private methods if they cannot be directly accessed? And why would one want to override private methods if they were probably made private for a good reason?
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/q/23017373
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jformattedtextfield
has answer: http://stackoverflow.com/a/23018167
has comment: http://stackoverflow.com/comment/35160103
type: AnsweredQuestion
score: 1
tagged with: java
has title: JFormatted Field yielding focus when it shouldn't
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/35160049
has body: The other day I asked a question, here, and received a suitable answer. However, when I tried to convert the sample code into my own program and begin to morph it into my needs, it wasn't working the way it should. I've gone through both sets of codes several times and the only real difference I see is that my code uses a panel instead of a box, however, I haven't seen any documentation describing any differences in performance with InputVerifier. My program should not allow a lenient day but it does, and allows the JFormattedField to yield focus when it shouldn't . Where is my problem? My current Code: public class Hello implements ActionListener{ private JFrame frame = new JFrame(); private JPanel panel = new JPanel(); private Date endingDate = new Date(); private String endingString = null; private SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy"); private JFormattedTextField formattedField = null; private JLabel label1 = new JLabel(); private JLabel label2 = new JLabel(); private TextArea ta = new TextArea(); private Button b = new Button("click"); public Hello() { b.addActionListener(this); label1 = new JLabel("test"); label2 = new JLabel("test"); formattedField = createFormattedTextField(); format.setLenient(false); panel.add(formattedField); panel.add(label1); panel.add(label2); panel.add(ta); panel.add(b); frame.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run(){ new Hello(); } }); System.out.println("Hello, World"); } private JFormattedTextField createFormattedTextField() { JFormattedTextField formattedField = null; try { MaskFormatter dateMask = new MaskFormatter("##/##/####"); formattedField = new JFormattedTextField(dateMask); } catch (ParseException ex) { Logger.getLogger(Hello.class.getName()).log(Level.SEVERE, null, ex); } formattedField.setColumns(10); formattedField.setInputVerifier(g…
accepted answer: http://stackoverflow.com/a/23018167
type: Question
tagged with: inputverifier
linked to: http://stackoverflow.com/q/22914371

http://stackoverflow.com/comment/35203291
comment on: http://stackoverflow.com/a/23041359
has text: When you use floating point numbers, for example through `Math.pow`, it's rounding. When using integer types, there is no rounding, only overflow. That's why I said "once one uses any integer instead of floats" -- I was one step ahead, thinking of a `long`-based solution.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23059728
answers question: http://stackoverflow.com/q/23058805
type: Answer
downvote count: 0
has body: You have to use the FormLayout. FormLayout fl = new FormLayout(); TextField tf = new TextField("caption"); fl.addComponent(tf); More information in the Vaadin Book here.
score: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23058805
upvote count: 3

http://stackoverflow.com/a/23007111
has body: Reversing an array is a relatively simple process. Let's start with thinking how you print an array normally. int[] numbers = {1,2,3,4,5,6}; for(int x = 0; x &lt; numbers.length; x++) { System.out.println(numbers[x]); } What does this do? Well it increments x while it is less than numbers.length, so what is actually happening is.. First run : X = 0 System.out.println(numbers[x]); // Which is equivalent to.. System.out.println(numbers[0]); // Which resolves to.. System.out.println(1); Second Run : X = 1 System.out.println(numbers[x]); // Which is equivalent to.. System.out.println(numbers[1]); // Which resolves to.. System.out.println(2); What you need to do is start with numbers.length - 1, and go back down to 0. To do this, you need to restructure your for loop, to match the following pseudocode.. for(x := numbers.length to 0) { print numbers[x] } Now you've worked out how to print, it's time to move onto reversing the array. Using your for loop, you can cycle through each value in the array from start to finish. You'll also be needing a new array. int[] revNumbers = new int[numbers.length]; for(int x = numbers.length - 1 to 0) { revNumbers[(numbers.length - 1) - x] = numbers[x]; }
answers question: http://stackoverflow.com/q/23006962
score: 0
type: Answer

http://stackoverflow.com/q/23037213
score: 0
has answer: http://stackoverflow.com/a/23102924
answer count: 2
has body: I am trying to encrypt rather big files (up to 150mb) with PHP and decrypt them with Java. When I encrypt it using Java and compare it to the encryption result from PHP, I see that the last few bytes are different. Could this be a problem with the padding? How do I fix this? The Java code is able to en and decrypt files correctly. The code below is not secure at all and not meant to be. PHP Encryption: public function encodeAndEncrypt($source, $target, $keyPhrase) { $hSrc = fopen($source,'rb'); $hDst = fopen($target,'wb'); $iv = substr(md5($keyPhrase, true), 0, 8); $key = substr(md5($keyPhrase, true), 0, 24); $opts = array('iv'=&gt;$iv, 'key'=&gt;$key); stream_filter_append($hDst, 'mcrypt.tripledes', STREAM_FILTER_WRITE, $opts); while ($chunk = fread($hSrc,8192)) { fwrite($hDst,$chunk, 8192); } fclose($hDst); fclose($hSrc); Java Decryption: private static final String ALGORITHM = "DESede/CBC/PKCS5Padding"; void main() { MessageDigest md = MessageDigest.getInstance("md5"); byte[] digestOfPassword = md.digest("O".getBytes("UTF-8")); byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24); byte[] ivBytes = Arrays.copyOf(digestOfPassword, 8); final SecretKey key = new SecretKeySpec(keyBytes, "DESede"); FileInputStream fis = new FileInputStream(new File("7za920.zip.enc")); FileOutputStream fos = new FileOutputStream(new File("7za920.zip")); decrypt(key, ivBytes, fis, fos); } private static void decrypt(SecretKey key, byte[] iv, InputStream is, OutputStream os) { try { Cipher cipher = Cipher.getInstance(ALGORITHM); IvParameterSpec ivSpec = new IvParameterSpec(iv); cipher.init(Cipher.DECRYPT_MODE, key, ivSpec); CipherInputStream cis = new CipherInputStream(is, cipher); doCopy(cis, os); } catch (Exception ex) { throw new RuntimeException(ex); } } private static void doCopy(InputStream is, OutputStream os) throws IOException { try { byte[] bytes = new byte[4096]; int numBytes; while ((numBytes = is.read(bytes)) != -1) { os.write(bytes, 0, numBytes); } } finally { is.close(); o…
tagged with: mcrypt
type: UnansweredQuestion
tagged with: encryption
has title: De/Encrypting file as stream with PHP and Java - Padding?
tagged with: php
has answer: http://stackoverflow.com/a/23040018
has comment: http://stackoverflow.com/comment/35197219
linked to: http://stackoverflow.com/q/7448763
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35196629

http://stackoverflow.com/a/23121511
has body: Where these 0s come from? First of all you have added 10 items in list having zero value. At below lines you are replacing the value at a random index. Random rnd = new Random(); int hold = rnd.nextInt(10); while(true){ list.set(hold, list.get(hold)+1); } You have 8 threads and 10 values in the list. Now for each thread a random number is generated just for single time it means in extreme case where a different random number is generated for each thread still you have 2 indexes in the list that is not replaced. You can try it again after moving below line in while loop but still its not 100% sure that all the indexes are replaced. Its depends on the behavior of Random. int hold = rnd.nextInt(10); Fore more info have a look at Random#nextInt().
has comment: http://stackoverflow.com/comment/35350669
type: Answer
answers question: http://stackoverflow.com/q/23121390
downvote count: 0
score: 2
upvote count: 2

http://stackoverflow.com/comment/35327498
score: 0
type: QuestionComment
type: Comment
has text: post full `MainActivity.java`
comment on: http://stackoverflow.com/q/23110771

http://stackoverflow.com/q/22995412
has title: Dealing a Hand and Evaluating the possible ranks
has comment: http://stackoverflow.com/comment/35122024
type: UnansweredQuestion
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35121159
tagged with: poker
has comment: http://stackoverflow.com/comment/35123611
score: 0
has comment: http://stackoverflow.com/comment/35123262
has body: import java.util.ArrayList; import java.util.Collections; /** * Write a description of class Deck here. * * @author (your name) * @version (a version number or a date) */ public class Dealer { private int numberOfDecks = 1; private int numberOfCards = Suits.numberOfSuits * Ranks.numberOfRanks * numberOfDecks; private ArrayList&lt;Card&gt; allCards = new ArrayList&lt;Card&gt;(); private int indexCard; public Dealer(){ makeDeck(); indexCard = 0; } /** * Method to deal a card */ public void dealCard(){ Card dealt = allCards.get(indexCard); indexCard = indexCard + 3; System.out.println(dealt); } /** * makes a new deck */ private void makeDeck(){ Card temp; for(int i = 0; i &lt; numberOfDecks; i++){ for(Suits s: Suits.values() ){ for(Ranks r: Ranks.values()){ temp = new Card (r, s); allCards.add(temp); } } How can I deal 3 cards so I can later evaluate them based on their rank? This is what I have so far, but I do not believe me dealHand() method will do me much good in terms of evaluating ranks.

http://stackoverflow.com/q/23120644
accepted answer: http://stackoverflow.com/a/23164322
tagged with: java
has comment: http://stackoverflow.com/comment/35346286
has comment: http://stackoverflow.com/comment/35346309
type: Question
has comment: http://stackoverflow.com/comment/35494561
has answer: http://stackoverflow.com/a/23132994
has comment: http://stackoverflow.com/comment/35347608
has comment: http://stackoverflow.com/comment/35494716
possible better answer: http://stackoverflow.com/a/23121340
has body: I have a thread pool with queue for 250 entries and every second I am pushing every second 60 tasks. Normally a task runs very fast, but if some condition will meet, a long running task is necessary. The normal task run is now blocked, because the long running task is now being executed. Is it possible to split the execution for one Runnable (in the case the long running task is needed) in execution time for the normal task the long running task ? In other words: I like to start the long running task asynchronously, but I do not want to create too much threads, because I that case I would get an overhead because of the thread communication. Can I use a ForkJoinPool for this or do I have to separate the long and short running task to solve this? My machine has 4 cores: ExecutorService queue = new ThreadPoolExecutor(2, 4, 400, TimeUnit.MILLISECONDS, new ArrayBlockingQueue&lt;Runnable&gt;(250, true), new ThreadPoolExecutor.DiscardOldestPolicy()); Runnable r = new Runnable() { @Override public void run() { try { if(isTimeForLongRunningExecution()){ //Is it possible to start this job asynchronous without starting to many threads doLongRunningTask(); }//do job with old data until new data is available, but do not block this operation too long doNormalTaskWithOldOrNewData(); } catch (InterruptedException e) { e.printStackTrace(); } } private void doNormalTaskWithOldOrNewData() throws InterruptedException { if(checkNewDataAvailable()){ System.out.println("Work with new Data"); Thread.sleep(300L); System.out.println("Work completed!"); }else{ System.out.println("Work with old Data"); Thread.sleep(300L); System.out.println("Work completed!"); } } private void doLongRunningTask() throws InterruptedException { System.out.println("Create new Data"); Thread.sleep(3*60*1000L); System.out.println("Data creation completed!"); } };//end of runnable while(true){ for (int i = 0; i &lt; 60; i++) { queue.submit(r); } Thread.sleep(1000); }
score: 0
has answer: http://stackoverflow.com/a/23121340
has comment: http://stackoverflow.com/comment/35347363
answer count: 3
has answer: http://stackoverflow.com/a/23164322
has title: Can I parallelize long running task in queue without creating too much threads
tagged with: multithreading
type: AnsweredQuestion

http://stackoverflow.com/comment/35337576
type: QuestionComment
has text: when user changes the data..im thinking a prompt user to save and replace the data in old text file.
comment on: http://stackoverflow.com/q/23115827
score: 0
type: Comment

http://stackoverflow.com/a/23009261
has body: Please try this line of code, hope it will solve your issue, chapterScrollPane.setBorder(BorderFactory.createEmptyBorder());
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23008854

http://stackoverflow.com/comment/35343160
has text: BTW, the mistake here is I had by mistake used jPanel instead of jFrame as you people can see in the navigator pane. Now if somebody can please rate this question at least 1 or 2, I would be very happy. Because my asking questions privilege has been removed since my last question which was genuine was rated -2 and this 0. Please........!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
comment on: http://stackoverflow.com/q/23069198
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23067403
has comment: http://stackoverflow.com/comment/35250874
score: 0
has body: You are using postincrement: anArray[m] = anArray[m++]; This will not do what you intended, but copy the value to the same index it already resides in. Furthermore you are incrementing m twice, as the for statement already does this.
type: Answer
answers question: http://stackoverflow.com/q/23066900

http://stackoverflow.com/comment/35092075
has text: but it wont move if I remove repaint()?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22979952

http://stackoverflow.com/comment/35222304
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23051517
has text: Did my solution work for you?

http://stackoverflow.com/a/23122138
has body: You could make Entry comparable and implement the compareTo in it. But you don't really have to in this case because String is already comparable. Since this is a homework, I think it will be best to just give you some suggestions on how to proceed, instead of handing you the code - In your method you do not need to sort the array, you just need to insert it at the correct location in the array. loop through the array starting at the first index as you pass through each element in the array, you will have to check following two conditions is the element null is the surname of current element greater than surname-argument to the method as soon as you find the element that satisfies any of the above conditions, record the index and break the loop then, starting at that index shift the rest of elements to the right and finally create a new instance of Entry for the provided arguments and set it at that index Note: This doesn't take care of the situation where you are out of the space in the array. Update: I think you mixed up my answer and @David Wallace's answer. It wasn't my suggestion to implement compareTo. Also, it's great that you at least gave it a try and came back. int position = -1; //declare the position outside (if declared inside, it's not visible outside the loop) for (int i = 0; i &lt; directory.length; i++) { // position = i; just assign value of i inside the loop } //use the position after the loop int j = position; // start at position Entry temp = null; // temp will temporarily hold the entry at the next index while(true) { temp = directory[j + 1]; // since we need move entry at j to j+1, first we need save the entry at j+1 directory[j + 1] = directory[j]; // entry at j to j+1 if(temp == null) { // if the next entry is null, don't really need to move no more, so break break; } } // finally place new entry at index position directory[position] = //the new Entry
accepted answer of: http://stackoverflow.com/q/23122059
has comment: http://stackoverflow.com/comment/35378078
answers question: http://stackoverflow.com/q/23122059
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/q/23081625
has title: algorithm, image processing, flood fill
type: Question
upvote count: 4
answer count: 2
tagged with: algorithm
downvote count: 0
has comment: http://stackoverflow.com/comment/35280514
has body: I am trying to process an X-ray image. The task is to paint each bone to a different color. I've used canny filter,otsu binarization and Morphological Image Processing such as erosion, to get this effect: Now I need to find an algorithm to color each bone. I was thinking about using connected-component labeling or flood fill but these algorithms requires closed area which will be filled with a color, but in my image there are also "almost closed" area to color. I was trying to "close each bone" with Dilation but it doesn't work. And now I completely do not know what to do with it and how to color bones.
has answer: http://stackoverflow.com/a/23081714
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/62480679
score: 4
tagged with: java
tagged with: image-processing
tagged with: image

http://stackoverflow.com/comment/35131577
type: AnswerComment
comment on: http://stackoverflow.com/a/23000371
score: 0
type: Comment
has text: turns out I run in to a slight problem. My reflection class won't survive obfuscation I found out. So...

http://stackoverflow.com/a/23042394
has body: You need to initialize int i before while because every time it enters in loop it will initialized with 0 so there is no use of increment i. while (input.hasNextLine()) { int i = 0; fileinput[i] = input.nextLine(); System.out.println(fileinput[i]); i++; } modified your code with int i = 0; while (input.hasNextLine()) { fileinput[i] = input.nextLine(); System.out.println(fileinput[i]); i++; }
type: Answer
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/23042295
has comment: http://stackoverflow.com/comment/35204885

http://stackoverflow.com/comment/35228174
score: 0
comment on: http://stackoverflow.com/q/23054630
type: Comment
type: QuestionComment
has text: If you have this issue with a 3x3 board and running DFS I'd say that you have a problem with you equals method in the board class, if this method does not check out you will make infinite new states. I do not understand your algorithm well enough to determine if your equals method have any faults (more inline comments would help). Try making a very simple comparison of tiles coded by hand instead in your equals method to see if it solves the problem.

http://stackoverflow.com/q/23071226
has body: Im trying to print out log entries between two date ranges but am having some trouble doing so. I have read the entries from the file and stored got the info i want as date varibles but i still can figure out why it wont display the dates in range Here is the file 2012-09-13 16:04:22 DEBUG SID:34523 BID:1329 RID:65d33 'Starting new session' 2012-09-13 16:04:30 DEBUG SID:34523 BID:1329 RID:54f22 'Authenticating User' 2012-09-13 16:05:30 DEBUG SID:42111 BID:319 RID:65a23 'Starting new session' 2012-09-13 16:04:50 ERROR SID:34523 BID:1329 RID:54ff3 'Missing Authentication token' 2012-09-13 16:05:31 DEBUG SID:42111 BID:319 RID:86472 'Authenticating User' 2012-09-13 16:05:31 DEBUG SID:42111 BID:319 RID:7a323 'Deleting asset with ID 543234' 2012-09-13 16:05:32 WARN SID:42111 BID:319 RID:7a323 'Invalid asset ID' 2012-09-14 16:04:22 DEBUG SID:34523 BID:1329 RID:65d33 'Starting new session' 2012-09-14 16:04:30 DEBUG SID:34523 BID:1329 RID:54f22 'Authenticating User' 2012-09-14 16:05:30 DEBUG SID:42111 BID:319 RID:65a23 'Starting new session' 2012-09-14 16:04:50 ERROR SID:34523 BID:1329 RID:54ff3 'Missing Authentication token' 2012-09-14 16:05:31 DEBUG SID:42111 BID:319 RID:86472 'Authenticating User' 2012-09-14 16:05:31 DEBUG SID:42111 BID:319 RID:7a323 'Deleting asset with ID 543234' 2012-09-14 16:05:32 WARN SID:42111 BID:319 RID:7a323 'Invalid asset ID' Here is my code import java.io.File; import java.io.FileNotFoundException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Locale; import java.util.Scanner; public class ReadLogs { private static String line, logLevel = "16:05:31", businessID ="1329", sessionID ="34523", startDateStr = "2012-09-10",endDateStr ="2012-09-14" ; private static String logString =""; private static ArrayList&lt;String&gt; logList = new ArrayList&lt;&gt;(); public static void main(String args[]){ readFile(); returnLogLinesByLevel(); returnLogLinesByBusiness(); …
tagged with: java
linked to: http://stackoverflow.com/q/23065301
has comment: http://stackoverflow.com/comment/35258156
type: Question
has answer: http://stackoverflow.com/a/23080577
has answer: http://stackoverflow.com/a/23071295
has comment: http://stackoverflow.com/comment/35258025
has comment: http://stackoverflow.com/comment/35258150
tagged with: date
has answer: http://stackoverflow.com/a/23071404
score: 0
has title: How to print dates between date ranges from file
answer count: 3
type: UnansweredQuestion

http://stackoverflow.com/comment/35332451
score: 0
type: AnswerComment
has text: This works, but I wonder how this would hold up if OP is using this on really large files, or needs it to be fast.
type: Comment
comment on: http://stackoverflow.com/a/23113344

http://stackoverflow.com/q/22993460
type: AnsweredQuestion
has body: I am trying to connect to a service with SSLv3 security. The communication works with curl and browser after providing the following files 1. ca.crt 2. private.key 2. client.crt I used all the 3 files to create an ssl keystore with following cmd openssl pkcs12 -export -in client.crt -inkey private.key -CAfile ca.crt -out sslstore.p12 And then used keytool to import it as java truststore keytool -importkeystore -srckeystore sslstore.p12 -srcstoretype PKCS12 -destkeystore truststore.jks After than I am followed the following link https://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientCustomSSL.java to connect to the url. Only changing the protocol from TLSv1 to SSLv3. I always get javax.net.ssl.SSLHandshakeException: excdption while connecting. As already mentioned the keys work with curl / browser. EDIT-2 Changing the code near SSLContexts.custom() from: sslcontext = SSLContexts.custom() .loadTrustMaterial(keyStore, new TrustSelfSignedStrategy()) .build(); to: sslcontext = SSLContexts.custom() .loadKeyMaterial(keyStore, "changeit".toCharArray()) .loadTrustMaterial(keyStore, new TrustSelfSignedStrategy()) .build(); worked. Note that I am using the same keystore. EDIT-1 Code: public static void main (String[] args) throws KeyStoreException, FileNotFoundException { KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("certs/ppro.jks"); try { keyStore.load(is,"changeit".toCharArray()); } catch (IOException | NoSuchAlgorithmException | CertificateException e) { e.printStackTrace(); } // Trust own CA and all self-signed certs SSLContext sslcontext = null; try { sslcontext = SSLContexts.custom() .loadTrustMaterial(keyStore, new TrustSelfSignedStrategy()) .build(); } catch (NoSuchAlgorithmException | KeyManagementException e) { e.printStackTrace(); } try { sslcontext.loadKeyMaterial(keyStore,"changeit".toCharArray()); } catch (…
has answer: http://stackoverflow.com/a/23006853
accepted answer: http://stackoverflow.com/a/23006853
has answer: http://stackoverflow.com/a/22993884
tagged with: java
type: Question
has title: Apache httpclient javax.net.ssl.SSLHandshakeException:
answer count: 2
tagged with: httpclient
score: 0
possible better answer: http://stackoverflow.com/a/22993884

http://stackoverflow.com/a/29622702
answers question: http://stackoverflow.com/q/23075594
has comment: http://stackoverflow.com/comment/71521457
has body: There is a shorter version to the one suggested by Visruth CV : &lt;s:set var="foo" value="true" /&gt; expression evaluated value : &lt;s:if test="foo"&gt; TRUE &lt;/s:if&gt;&lt;s:else&gt; FALSE &lt;/s:else&gt; In case you want to check the boolean value against an Action attribute, here is the way to go : class FooAction extends ActionSupport { private Boolean _bar = true; public Boolean isBar() { return _bar; } } And in the jsp file : expression evaluated value : &lt;s:if test="isBar()"&gt; TRUE &lt;/s:if&gt; &lt;s:else&gt; FALSE &lt;/s:else&gt;
type: Answer
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/35196871
has text: Thanks! Works great. One of these days I should actually sit down and learn regular expressions.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23037569
type: Comment

http://stackoverflow.com/a/22970816
has body: In matters of speed a == 0 and 0 == a has the same speed. However people write 0 == a just not to mistake == with = because a = 0 compiles in certain programming languages inside the if/while/.. statements and result incorrect behavior of the program
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22970676
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35137264
type: QuestionComment
comment on: http://stackoverflow.com/q/23005071
has text: On which line do you get the exception? (mark it in your code with a comment as we cannot see your linenumbers)
score: 0
type: Comment

http://stackoverflow.com/comment/35286585
type: AnswerComment
type: Comment
has text: Thanks for your reply. I had updated the database right after update the Sonaqube. thank you.
comment on: http://stackoverflow.com/a/23076100
score: 0

http://stackoverflow.com/q/23037279
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/35291325
has comment: http://stackoverflow.com/comment/35293419
downvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/35290433
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/35291345
answer count: 1
has title: Java API to read XML and JSON properties
favorite count: 0
has body: Is there any Java open source library to read properties from an XML or a JSON file, using the same API call, irrespective of the format? Java has the Properties class, which offers a loadFromXML() method, but does not support JSON. The ideal case would be a library that handles either XML or JSON on its own, i.e. without the calling code having to specify whether the properties to be loaded are expressed in XML or JSON.
score: -3
has answer: http://stackoverflow.com/a/23037340
accepted answer: http://stackoverflow.com/a/23037340
tagged with: properties
has comment: http://stackoverflow.com/comment/35289756
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/23003542
tagged with: java-stream
has body: I have a List<Foo> and want a Multimap<String, Foo> where we've grouped the Foo's by their getId() function. I am using Java 8 and its almost awesome in that you can do: List<Foo> foos = ... Map<String, List<Foo>> foosById = foos.stream().collect(groupingBy(Foo::getId)); However, I have a good amount of code that wants a MultiMap<String, Foo> so this doesnt save me anything and I'm back to using a for-loop to create my Multimap. Is there a nice "functional" way that I am missing?
tagged with: java
has title: Cleanest way to create a Guava Multimap from a Java 8 stream
has comment: http://stackoverflow.com/comment/120963113
has comment: http://stackoverflow.com/comment/46640215
score: 90
linked to: http://stackoverflow.com/q/23003754
has answer: http://stackoverflow.com/a/23003630
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/68443128
downvote count: 0
has answer: http://stackoverflow.com/a/68443128
favorite count: 0
accepted answer: http://stackoverflow.com/a/23003630
type: Question
answer count: 2
upvote count: 90
has comment: http://stackoverflow.com/comment/113103123
has comment: http://stackoverflow.com/comment/76925312
tagged with: guava

http://stackoverflow.com/a/23032905
answers question: http://stackoverflow.com/q/23032851
downvote count: 0
score: 1
has body: public String getRandom() { return piratewords.get(new Random().nextInt(piratewords.size()); }
has comment: http://stackoverflow.com/comment/35189154
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23032851
type: Answer

http://stackoverflow.com/comment/35277917
comment on: http://stackoverflow.com/a/23080548
has text: So, because of `public static void` I don't need to create an object of the parameters? As opposed to `public void`?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35203679
type: Comment
comment on: http://stackoverflow.com/q/22976815
type: QuestionComment
has text: We would be very happy if you posted here on our forum the working source code so that someone making a similar mistake can find the solution: http://forum.jogamp.org/Render-offscreen-buffer-to-image-td4032144.html
score: 0

http://stackoverflow.com/comment/96866216
score: 0
type: Comment
has text: Good updated answer, thanks. I note that for each result line of the search, we could not see the dependency related to. It is very cumbersome in some cases.
type: AnswerComment
comment on: http://stackoverflow.com/a/50226019

http://stackoverflow.com/q/22990764
downvote count: 0
accepted answer: http://stackoverflow.com/a/25140647
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/23049570
score: 1
favorite count: 0
tagged with: proguard
tagged with: android-asynctask
tagged with: inner-classes
upvote count: 1
has body: in my activity I had some inline AsyncTask that didn't work well on android 11+ so I decided to change all inline code to inner classes. After change all inline AsyncTask to inner classes I got this warning in proguard and I can't compile the project. In debug mode all work well. This is my proguard blocking warnings: [proguard] Warning: com.test.MyActivity: can't find referenced class com.test.MyActivity$1 [proguard] Warning: com.test.MyActivity$MyBroadcastReceiver: can't find referenced class com.test.MyActivity$1 [proguard] Warning: com.test.MyActivity$MyBroadcastReceiver: can't find referenced class com.test.MyActivity$1 [proguard] Warning: com.test.MyActivity$MyBroadcastReceiver: can't find referenced class com.test.MyActivity$1 [proguard] Warning: com.test.MyActivity$LoadingTask: can't find referenced class com.test.MyActivity$1 [proguard] Warning: com.test.MyActivity$LoadingTask: can't find referenced class com.test.MyActivity$1 [proguard] Warning: com.test.MyActivity$LoadingTask: can't find referenced class com.test.MyActivity$1 This is my actual activity code: public class MyActivity extends FragmentActivity { private final WakefulBroadcastReceiver messageReceiver = new MyBroadcastReceiver(); @TargetApi(Build.VERSION_CODES.HONEYCOMB) protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final LoadingTask task = new LoadingTask(); if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { task.execute(); } } private final class MyBroadcastReceiver extends WakefulBroadcastReceiver { public void onReceive(Context context, Intent intent) { if (context == getContext()) { GcmBroadcastReceiver.completeWakefulIntent(intent); setResultCode(Activity.RESULT_OK); } else { setResultCode(Activity.RESULT_CANCELED); } } } private final class LoadingTask extends AsyncTask&lt;Void, Long, Boolean&gt; { private static final int MAX_SHOW_TIME = 120000; private long startTim…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25140647
tagged with: java
possible better answer: http://stackoverflow.com/a/22991040
has answer: http://stackoverflow.com/a/22991040
type: Question
has title: Proguard android can't find referenced class

http://stackoverflow.com/comment/35175276
comment on: http://stackoverflow.com/a/23025373
has text: Man I knew it was something small like that, obviously I could see in the debugger that my string was always the same size, which baffled me, but I couldn't figure out where I slipped up.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/35302399
type: Comment
has text: What does "most likely" mean in your last sentence?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23095751

http://stackoverflow.com/a/23101613
has body: try to execute the click action using javascriptexecutor ((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView(true);", driver.findElement(By.id("btnSaveUserProfile")));
answers question: http://stackoverflow.com/q/23100688
has comment: http://stackoverflow.com/comment/35312224
score: 0
type: Answer

http://stackoverflow.com/comment/35316244
score: 1
has text: It is the id you define in your MANIFEST.MF for your plugin. In the MANIFEST.MF/plugin.xml editor it is the ID field on the overview page.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23104149

http://stackoverflow.com/comment/35101773
type: Comment
type: QuestionComment
has text: Could you share your attempt with the Hash Map and explain what isn't working?
comment on: http://stackoverflow.com/q/22985543
score: 0

http://stackoverflow.com/q/23034083
tagged with: android
type: AnsweredQuestion
tagged with: java
has title: unfortunately my app has stopped (my first app in android)
type: Question
has comment: http://stackoverflow.com/comment/35190289
has answer: http://stackoverflow.com/a/23034197
has body: this is my first .... i try to search the problem in this website but i did not fix it this is my code in main activity package com.example.joker; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageButton; import android.os.Build; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button b=(Button)findViewById(R.id.button1); b.setText("why so serious ?"); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } } and this fregment &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.andro…
score: 0
has comment: http://stackoverflow.com/comment/35190428
answer count: 1
accepted answer: http://stackoverflow.com/a/23034197

http://stackoverflow.com/a/23003914
answers question: http://stackoverflow.com/q/23003874
has body: Use for(String s:suit){ System.out.println(s); } to get string from array of string
score: 0
type: Answer

http://stackoverflow.com/comment/35356323
score: 0
type: Comment
type: QuestionComment
has text: @AndrewThompson If I do that, this whole page would be filled up with code only. Its 200 lines of code.
comment on: http://stackoverflow.com/q/23069198

http://stackoverflow.com/comment/35080382
comment on: http://stackoverflow.com/q/22972660
type: Comment
type: QuestionComment
score: 0
has text: I'm not following your logic at all - I don't see where the loop is to show the test for the next student. But it seems to me that one way to do this would be to use a dialogue instead of a frame; and create it in a loop from your `main`. That way, each student would actually see a fresh instance of the dialogue.

http://stackoverflow.com/comment/35345708
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23097197
has text: Can I ask you to indulge me for a moment in running it? It is on github and compiles with maven. https://github.com/mobiusinversion/EtymologyDynamics it is just the beginning of a natural language processing application wherein I would like to store some data in the resources directory for internal application usage. The compilation and execution model is very simple `mvn clean package && java -jar target/EtymologyDynamics.one-jar.jar`
type: AnswerComment

http://stackoverflow.com/q/23049795
has title: How to make multiple references to same object in Java
tagged with: constructor
type: UnansweredQuestion
tagged with: clone
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23049948
tagged with: copy
has body: I am implementing a crossword puzzle backend. Crossword is composed of slots is composed of cells. Lets say cell at (3,14) has a value of "a" I want crossword.changeCellValueByCoordinate(3,14,"x") to do "a"->"x" Lets say some Slot slot has a head cell at coordinate (3,14) Slots head can be identified by (2,across) == Cell(3,14) So when I call slot.getCellValueByNumberAndDirection(2,across) next, it already changed from "a" to "x". And another method (for the same cell) crossword.getSlot(2,across).getHead also changed from "a" to "x". How do I make it so all three objects of different types (Crossword, Slot, Cell) has an attribute (perhaps of same name, lets call it "content") that is shared/referenced by all Classes?
score: 0
answer count: 1

http://stackoverflow.com/a/23038179
has comment: http://stackoverflow.com/comment/35198111
type: Answer
has comment: http://stackoverflow.com/comment/35198064
has body: Your FileOutputStream is not closed correctly, it may have the reason that you think it is not reading from console and writing to file. FileOutputStream fos=null;//initialize Fileoutputstream. finally { fos.close(); }
answers question: http://stackoverflow.com/q/23038121
downvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/35198130
upvote count: 0
has comment: http://stackoverflow.com/comment/35198141

http://stackoverflow.com/comment/35200218
type: AnswerComment
score: 0
has text: Nope, still not there. Thanks though.
type: Comment
comment on: http://stackoverflow.com/a/23039459

http://stackoverflow.com/comment/35144421
score: 0
type: Comment
type: QuestionComment
has text: Sorry about that; I have included the code that updates the XML.
comment on: http://stackoverflow.com/q/23008311

http://stackoverflow.com/q/23022079
score: 1
possible better answer: http://stackoverflow.com/a/23024046
upvote count: 1
has body: My question is both a language implementation question and an ANTLR4 API question. Is there way I can modify a ParseTree and it's accompanying TokenStream? Here is the scenario. I have a simple language that defines a dataflow program. You can see it on github, if you're curious. I lex and parse the language with ANTLR4. I use listeners to walk the parse tree and evaluate the code. The problem I have most recently run into is I need to be able to modify the code at runtime. I need to be able to define new objects and create instances from them. Note, I'm not referring to having reflection in the language. I'm referring to having a program like an IDE modify the internal representation of the source code. I have started off down the path of defining a bunch of definition objects to create an AST, but I just realized this approach will require me to come up with my own solutions for walking the AST. Rather than reinvent the wheel, I'd rather use ANTLR's listeners/visitors. Another problem I face is the need to be able to output the current state the AST as code at any point in time (The tool I'm embedding the language in needs to be able to save.) I am using StringTemplate to generate the code from my definition objects. I think I should be able to make ST render the parse tree. In general, I need to able to lex, parse, evaluate, refactor, evaluate, and generate code all from within my runtime. Rather than create my own definition objects, I'm wondering what the best approach is modify the ParseTree/TokenStreams?
has answer: http://stackoverflow.com/a/23024046
has answer: http://stackoverflow.com/a/23024069
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35173254
tagged with: java
tagged with: antlr
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/23028708
has title: Is there way I can modify a ParseTree and it's accompanying TokenStream?
downvote count: 0
favorite count: 0
tagged with: programming-languages
tagged with: antlr4
has comment: http://stackoverflow.com/comment/36680353
accepted answer: http://stackoverflow.com/a/23028708

http://stackoverflow.com/comment/35330269
has text: http://stackoverflow.com/questions/1739921/are-there-any-api-to-integrate-microsoft-exchange-server-with-java-application-f/7517021
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23018048

http://stackoverflow.com/comment/35229567
type: Comment
has text: /Urdu/Festive Poetry/ Complete path is: /mnt/sdcard/Android/data/com.goldenedge.poetry/Urdu/Festive Poetry/4__311159_248676158509124_848180994_n.jpg
comment on: http://stackoverflow.com/q/23055713
score: 0
type: QuestionComment

http://stackoverflow.com/a/23045837
accepted answer of: http://stackoverflow.com/q/23045759
score: 0
has comment: http://stackoverflow.com/comment/35212242
has comment: http://stackoverflow.com/comment/35212024
answers question: http://stackoverflow.com/q/23045759
type: Answer
has body: Why don't you iterate? String[] badWords = {"word1", "word2", ...}; for (int i=0; i&lt;badWords.length; i++){ if(event.getMessage().contains(plugin.getConfig().getString("PBSwears.words." + badWords[i]))){ String message = event.getMessage().replaceAll(plugin.getConfig().getString("PBSwears.blocked." + badWords[i]), plugin.getConfig().getString("PBSwears.replace." + badWords[i])); event.setMessage(message); } }
type: AcceptedAnswer

http://stackoverflow.com/comment/35135356
has text: that link seems to be broken, kindly check the link before posting;)
score: 0
comment on: http://stackoverflow.com/q/23003867
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22997130
downvote count: 0
has title: Where does getRequestDispatcher("path") look?
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/22997245
answer count: 1
favorite count: 0
score: 13
upvote count: 13
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22997245
tagged with: servlets
type: Question
has body: Using embedded tomcat, this code: System.out.println("getServletPath: " + request.getServletPath()); System.out.println("getServletContext: " + request.getServletContext().getContextPath()); System.out.println("getServerName: " + request.getServerName()); System.out.println("getServerPort: " + request.getServerPort()); Prints out: getServletPath: /example getServletContext: getServerName: localhost getServerPort: 9090 Does that mean that: request.getRequestDispatcher("/example/read.jsp").forward(request, response); Will look at this URL to forward(request, response) to the JSP: http://localhost:9090/example/read.jsp? Is there a way to print out what absolute URL getRequestDispatcher("relativePath") is addressing?

http://stackoverflow.com/q/23078603
has title: Struts 2 : double values with point or comma
has comment: http://stackoverflow.com/comment/35273377
favorite count: 0
has comment: http://stackoverflow.com/comment/35271020
has answer: http://stackoverflow.com/a/23081533
upvote count: 1
has comment: http://stackoverflow.com/comment/35271759
has comment: http://stackoverflow.com/comment/35271398
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/35271920
accepted answer: http://stackoverflow.com/a/23081533
tagged with: jsp
tagged with: struts2
linked to: http://stackoverflow.com/q/10019050
has comment: http://stackoverflow.com/comment/35275996
has comment: http://stackoverflow.com/comment/35271346
has comment: http://stackoverflow.com/comment/35271363
has comment: http://stackoverflow.com/comment/35272215
downvote count: 0
answer count: 1
has body: The problem that I can't insert double values with point (example 2.2), however I can insert them with comma (example : 2,2). but when I want to edit them using (JSP and Ajax), they appear with (point) even if I stock them with comma, so that I have to edit all values ! the scenario is as follows : I want to edit some double values in my application (hibernate and struts2),i pass the values from action to JSP : private Service Service; private Vehicule v; private Map<String, Object> map= new HashMap<>(); public String query() { Service = new ServiceImpl(); v = new Vehicule(); v= Service.getVehiculeByImmat(field1); map.put("date", v.getdate().toString()); map.put("kilometrage", v.getKilometrage()); return "success"; } then I show them in my JSP : $(document).ready(function(){ $('#field1').change(function(){ var selectedValue = $('#field1').val(); if ($.trim(selectedValue).length > 0) { alert(selectedValue); $.ajax( { type: 'POST', url : "<s:url action='query'/>", dataType : 'json', data: { field1: selectedValue}, success: function(result){ $.each(result, function(key,value) { $("#"+key).val(value); } ); }, }); } } ); }); struts.xml: map my question : it's possible to insert the double values with point ?

http://stackoverflow.com/q/23064824
tagged with: maven
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23449522
tagged with: java
type: Question
has body: I'm trying to install the content management system Polopoly on my PC. I get the following error when I run the mvn p:run command (this is intended to start up the Polopoly installation with an embedded database, jboss and web container): Failed to execute goal com.polopoly.extensions-maven-plugin:10.6.1-fp1 1-c871a5b:run (default-cli) on project myproject: Could not deploy com.polopoly. extensions-maven-plugin:import-scan: Could not scan content: Could not create content importer: org.apache.maven.plugin.MojoExecutionException: Unable to read connection properties. Could not get connection properties from 'http://localho st:8081/connection-properties/connection.properties', nor from backup 'C:\Users\ hollandv\AppData\Local\Temp\http___localhost_8081_connection-properties_connecti on.properties'. -&gt; The detailed version of the error is as follows: [ERROR] Failed to execute goal com.polopoly.extensions-maven-plugin:10.6.1-fp1 1-c871a5b:run (default-cli) on project myproject: Could not deploy com.polopoly. extensions-maven-plugin:import-scan: Could not scan content: Could not create content importer: org.apache.maven.plugin.MojoExecutionException: Unable to read connection properties. Could not get connection properties from 'http://localho st:8081/connection-properties/connection.properties', nor from backup 'C:\Users\ hollandv\AppData\Local\Temp\http___localhost_8081_connection-properties_connecti on.properties'. -&gt; [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal c om.polopoly.extensions-maven-plugin:10.6.1-fp11-c871a5b:run (default-cli) on p roject myproject: Could not deploy com.polopoly.extensions-maven-plugin:import -scan at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:213) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:145) at org.apache.maven.lifecycle.internal.Lifecycle…
tagged with: jboss
score: 0
tagged with: maven-jetty-plugin
answer count: 1
has answer: http://stackoverflow.com/a/23449522
has title: Connection properties error when starting JBoss as a Maven plugin

http://stackoverflow.com/a/23084750
score: 0
has body: change &lt;%@ taglib uri="java.sun.com/jsp/jstl/core"; prefix="c" %&gt; to &lt;%@ taglib uri="java.sun.com/jsp/jstl/core" prefix="c" %&gt; and give a try
type: Answer
answers question: http://stackoverflow.com/q/23082962

http://stackoverflow.com/comment/35169994
score: 0
has text: Your brain is not working either.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23021791

http://stackoverflow.com/q/23036640
accepted answer: http://stackoverflow.com/a/23040269
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23040269
tagged with: sql
has body: I was researching about Querydsl and landed on this slide. It has the coverage of almost all the information about querydsl that one should know. But on "Querydsl extensions" topic of the slide, it has the more information of Querydsl customization instead of extension. I am hugely confused over here. Can somebody explain me how those customizations can be regarded as extensions?
tagged with: jpa
downvote count: 0
has title: Confused on Querydsl extensions?
answer count: 1
has comment: http://stackoverflow.com/comment/35201302
favorite count: 0
tagged with: querydsl
type: AnsweredQuestion

http://stackoverflow.com/q/23072485
has answer: http://stackoverflow.com/a/23072537
type: AnsweredQuestion
has body: public static void main(String[] args) { boolean sorted=true; Scanner scan = new Scanner(System.in); System.out.println("Enter the length of your array then enter the elements of your array: "); int length=scan.nextInt(); int[] array=new int[length]; for (int i=0;i&lt;length;i++){ array[i]=scan.nextInt(); } for (int i=0;i&lt;length-1;i++){ if (array[i]&gt;array[i+1]){ sorted=false; } } if (sorted=true){ System.out.println("The list is already sorted"); } else { System.out.println("The list is not sorted"); } } I have to write a program that checks to see if an array is sorted or not for class. This is my current code. I can't figure out why the code wont go into the if statement int the second for loop even though the conditions are true. the test date I used for entry was: 8 10 1 5 16 61 9 11 1
tagged with: java
type: Question
tagged with: sorting
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23072535
accepted answer: http://stackoverflow.com/a/23072535
has answer: http://stackoverflow.com/a/23072550
possible better answer: http://stackoverflow.com/a/23072537
has title: Array sorting test

http://stackoverflow.com/q/23084182
downvote count: 0
tagged with: jersey-2.0
answer count: 6
has answer: http://stackoverflow.com/a/23241506
has answer: http://stackoverflow.com/a/23479647
linked to: http://stackoverflow.com/q/7023374
tagged with: filter
linked to: http://stackoverflow.com/q/2563344
has answer: http://stackoverflow.com/a/23142931
favorite count: 0
has answer: http://stackoverflow.com/a/23268578
has answer: http://stackoverflow.com/a/54588580
score: 6
linked to: http://stackoverflow.com/q/14736328
has body: I'm trying to ensure that all JSON responses from a Jersey based java application have a UTF-8 character encoding parameter appended to their ContentType header. So if it's a JSON response, I would like the response header for the Content-Type to be Content-Type: application/json;charset=UTF-8 EDIT: I know I can do this on a case by case basis, but I'd like to do it globally, so it affects all content responses that have a content type of "application/json". If I just try and set the character encoding in my filter regardless of the content type, it works fine. But I only want to set the character encoding if the ContentType is "application/json". I find that the response.getContentType() method always returns null unless I call chain.doFilter first. But if I try and change the Character Encoding after this, it seems to always get overwritten. import java.io.IOException; import javax.servlet.*; import javax.servlet.http.*; import javax.ws.rs.core.MediaType; public class EnsureJsonResponseIsUtf8Filter implements Filter { private class SimpleWrapper extends HttpServletResponseWrapper { public SimpleWrapper(HttpServletResponse response) { super(response); } @Override public String getCharacterEncoding() { return "UTF-8"; } } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { chain.doFilter(request, response); if (response.getContentType() != null &amp;&amp; response.getContentType().contains(MediaType.APPLICATION_JSON)) { response.setCharacterEncoding("UTF-8"); chain.doFilter(request, new SimpleWrapper((HttpServletResponse) response)); } } @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void destroy() { } } I've seen other similar questions, but none them seem to have this issue. I've tried registering my filter as the first, and last filter with no luck.
linked to: http://stackoverflow.com/q/9359728
upvote count: 6
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25725230
linked to: http://stackoverflow.com/q/6733115
tagged with: content-type
has title: Change ContentType or CharacterEncoding in Java Filter ONLY IF ContentType === JSON
type: Question
accepted answer: http://stackoverflow.com/a/23479647
possible better answer: http://stackoverflow.com/a/23268578

http://stackoverflow.com/comment/35140237
score: 0
type: AnswerComment
has text: So in C++ if you had just `Node nextNode;` instead of `Node* nextNode` everything would be much less efficient because copies are being passed, not pointers?
type: Comment
comment on: http://stackoverflow.com/a/23006719

http://stackoverflow.com/comment/35345060
type: Comment
score: 0
has text: Is the paddle a rectangle?
comment on: http://stackoverflow.com/q/23119954
type: QuestionComment

http://stackoverflow.com/q/23023611
answer count: 2
tagged with: web-services
has comment: http://stackoverflow.com/comment/35172801
tagged with: android-layout
has comment: http://stackoverflow.com/comment/35172563
has answer: http://stackoverflow.com/a/23026394
tagged with: java
type: UnansweredQuestion
has title: Refreshing a layout not working in Android
has body: I am trying to refresh a linear layout. This layout is being created dynamically from a web service. A refresh button invokes the below method: private void setUpFields(ArrayList&lt;String&gt; jsonDataViewTypeRestore, ArrayList&lt;String&gt; jsonDataValueRestore) { ArrayList&lt;String&gt; jsonDataValue = jsonDataValueRestore; ArrayList&lt;String&gt; jsonDataViewType = jsonDataViewTypeRestore; // linearLayoutHorizontal.invalidate(); // linearLayoutHorizontal.removeAllViews(); linearLayoutHorizontal = new LinearLayout(context); linearLayoutHorizontal = (LinearLayout) findViewById(R.id.linearLayoutHorizontal); linearLayoutHorizontal.requestLayout(); // linearLayoutHorizontal.removeView(editText); // linearLayoutHorizontal.removeView(helloButton); // linearLayoutHorizontal.removeAllViews(); for (int i = 0; i &lt; jsonDataValue.size(); i++) { System.out.println(jsonDataValue.get(i)); if (jsonDataViewType.get(i).toString().equals("editBox")) { editText = new EditText(context); // linearLayoutHorizontal.addView(editText); editText.setText(jsonDataValue.get(i)); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); params.weight = 1.0f; editText.setGravity(Gravity.CENTER_HORIZONTAL); editText.setLayoutParams(params); } else if (jsonDataViewType.get(i).toString().equals("button")) { helloButton = new Button(context); linearLayoutHorizontal.addView(helloButton); helloButton.setText(jsonDataValue.get(i)); } } System.out.println("linearLayoutHorizontal.getChildCount() " + linearLayoutHorizontal.getChildCount()); } As you can see I have tried quite a few things as they're commented out. What is happening is that the linearLayoutHorizontal is retaining the editText and helloButton view. As you can see from the image below, there should be only one Hello, but there are multiple.
has answer: http://stackoverflow.com/a/23025661
type: Question
tagged with: android
score: 0

http://stackoverflow.com/comment/35141324
comment on: http://stackoverflow.com/q/23006536
type: Comment
type: QuestionComment
has text: Hm. Don't really know then. Looking at tshark might help, it is a command-line version of Wireshark and it can do the actual capturing and then decode the data into something readable.
score: 0

http://stackoverflow.com/comment/35267629
score: 0
has text: Nothing looks wrong with the xpath. Possibly related to [Issue 6055](https://code.google.com/p/selenium/issues/detail?id=6055); Is this behavior across all browsers or a specific browser/version?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23064721

http://stackoverflow.com/q/23039643
has comment: http://stackoverflow.com/comment/35200490
accepted answer: http://stackoverflow.com/a/23039761
has answer: http://stackoverflow.com/a/23039745
favorite count: 0
possible better answer: http://stackoverflow.com/a/23039677
has answer: http://stackoverflow.com/a/23039677
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35200795
has comment: http://stackoverflow.com/comment/35200598
has comment: http://stackoverflow.com/comment/35200552
tagged with: hashmap
has comment: http://stackoverflow.com/comment/35200658
has body: Hello good people of SO, I'm having a hard time understanding why my code is returning a null pointer. Any help would be appreciated! public class GetTabByName { HashMap&lt;String,JPanel&gt; allTabs; public void getMap(HashMap&lt;String,JPanel&gt; allTabs){ this.allTabs = allTabs; //this print works fine System.out.println(allTabs.get("addPatDocTab").getName()); } public JPanel getTabByName(String tabName){ JPanel tab = null; //this is where the problem occurs. even I try to print the line above //I get the same null pointer if(allTabs.containsKey(tabName)){ tab = allTabs.get(tabName); } else{ System.out.println(tabName + " is not a tab"); } return tab; } } the error message is the following: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at edu.miami.cis324.swing.jfarache.GetTabByName.getTabByName(GetTabByName.java:23) at edu.miami.cis324.swing.jfarache.AddEditElements.addElementsToPane(AddEditElements.java:14) at edu.miami.cis324.swing.jfarache.MainFrame.&lt;init&gt;(MainFrame.java:177) at edu.miami.cis324.swing.jfarache.SwingHome.createAndShowGUI(SwingHome.java:27) at edu.miami.cis324.swing.jfarache.SwingHome.access$0(SwingHome.java:21) at edu.miami.cis324.swing.jfarache.SwingHome$1.run(SwingHome.java:16) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.p…
downvote count: 0
has answer: http://stackoverflow.com/a/23039761
has title: HashMap returns null pointer for unknown reason
tagged with: nullpointerexception
answer count: 3

http://stackoverflow.com/q/23105304
tagged with: jboss
type: Question
has comment: http://stackoverflow.com/comment/35325943
has comment: http://stackoverflow.com/comment/35320723
has comment: http://stackoverflow.com/comment/35339894
score: 0
has title: org.jboss.deployment.scanner.URLDeploymentScanner Scan URL, caught java.io.IOException: Could not list directory
tagged with: deployment
has body: I run JBoss 4.2.3 GA on a production server, it's the second time in a few days that the server crashes and the log file shows these messages: 2014-04-16 09:55:07,398 WARN [org.jboss.deployment.scanner.URLDeploymentScanner] Scan URL, caught java.io.IOException: Could not list directory '/usr/local/jboss/jboss-4.2.3.GA/server/default/deploy', reason unknown 2014-04-16 09:55:12,403 WARN [org.jboss.deployment.scanner.URLDeploymentScanner] Scan URL, caught java.io.IOException: Could not list directory '/usr/local/jboss/jboss-4.2.3.GA/server/default/deploy', reason unknown 2014-04-16 09:55:17,407 WARN [org.jboss.deployment.scanner.URLDeploymentScanner] Scan URL, caught java.io.IOException: Could not list directory '/usr/local/jboss/jboss-4.2.3.GA/server/default/deploy', reason unknown Of course the deploy directory is still there, no problems at the O/S level. Any suggestion about the direction in which to investigate the problem? Thank you.
has comment: http://stackoverflow.com/comment/35357322
has comment: http://stackoverflow.com/comment/35319299
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35328103
tagged with: ioexception
has comment: http://stackoverflow.com/comment/35318635
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35326026

http://stackoverflow.com/a/23089049
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23086667
answers question: http://stackoverflow.com/q/23086667
score: 1
has comment: http://stackoverflow.com/comment/35295572
upvote count: 1
type: AcceptedAnswer
has body: You could just use a bookmarklet and javascript to replace all of the forms' action attributes. That way your developer can do it with one click instead of changing urls. Something like this will prefix all form actions on the page with "/outputPOST". javascript:(function(){var forms=document.getElementsByTagName('FORM');for(i=0;i&lt;forms.length;++i){forms[i].setAttribute('action','/outputPOST'+forms[i].getAttribute('action'));}})();
type: Answer

http://stackoverflow.com/a/25270507
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/44363906
has comment: http://stackoverflow.com/comment/44668660
downvote count: 0
answers question: http://stackoverflow.com/q/22972418
has comment: http://stackoverflow.com/comment/70849986
type: Answer
has comment: http://stackoverflow.com/comment/43333962
has body: Actually, JAX-RPC is an old version of SOAP and which is overtaken by JAX-WS. That is why netbeans does not provide this plugin in default version. You can install the plugin by adding another plugin directory. Go to Tools -> plugins -> Settings -> Add and set URL as http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz After adding this URL you will be able to see JAX-RPC plugin under plugin section and install that.
has comment: http://stackoverflow.com/comment/91528717

http://stackoverflow.com/a/23126410
has comment: http://stackoverflow.com/comment/35356519
has comment: http://stackoverflow.com/comment/35357726
has comment: http://stackoverflow.com/comment/35357525
accepted answer of: http://stackoverflow.com/q/23125642
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35356560
has comment: http://stackoverflow.com/comment/35357450
type: Answer
has body: SwingWorker supports PropertyChange events, that is, you can listener to when the SwingWorker changes state or updates it's progress...yes, SwingWorker even supports progress notification, for example This means you could set up a PropertyChangeListener to monitor changes to the progress and state properties and take appropriate actions... A worker that simple sets progress updates... public class LoadMaster extends SwingWorker&lt;Void, Progress&gt; { @Override protected Void doInBackground() throws Exception { System.out.println("Working hard here, nothing to see..."); for (int index = 0; index &lt; 100; index++) { Thread.sleep(10); setProgress(index); } return null; } @Override protected void done() { try { get(); } catch (Exception e) { } } } A example PropertyChangeListener... public class LoadMasterPropertyChanegHandler implements PropertyChangeListener { private SwingWorkerExample example; public LoadMasterPropertyChanegHandler(SwingWorkerExample example) { this.example = example; } @Override public void propertyChange(PropertyChangeEvent evt) { System.out.println(evt.getPropertyName()); if ("progress".equalsIgnoreCase(evt.getPropertyName())) { int value = (int) evt.getNewValue(); example.showProgress(value); } else if ("state".equalsIgnoreCase(evt.getPropertyName())) { SwingWorker worker = (SwingWorker) evt.getSource(); if (worker.isDone()) { try { worker.get(); example.loadCompleted(); } catch (InterruptedException | ExecutionException exp) { example.loadFailed(); } } } } } Now, all this does is sends back information to the SwingWorkerExample (it's coming) which allows it to determine what it should do... In this example, the loadCompleted method updates the UI and then starts the second worker... protected void loadCompleted() { //... LoadStuffWorker stuffWorker = new LoadStuffWorker(this); stuffWorker.execute(); } In all truth, I might use interfaces instead, so I'm not overtly exposing the class, but that's a topic for another day... And the full example…
upvote count: 3
answers question: http://stackoverflow.com/q/23125642
score: 3

http://stackoverflow.com/q/23104247
has body: I am using the following code to test the bound values of a JFrame of mine: Rectangle r1 = new Rectangle(); Rectangle r2 = new Rectangle(); r1 = this.getBounds(); this.setExtendedState(JFrame.MAXIMIZED_BOTH); //this == JFrame r2 = this.getBounds(); At first, I thought that the values of r2 (regarding x, y, width and height) would be different, since the frame is automatically resized. However, the variables r1 and r2 seems to be (almost) equal, according to the Debugger. Why does this happen? What should I do in order to get the new values of the maximized JFrame? import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Insets; import java.awt.List; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; public class NewGUI extends JFrame { private JPanel contentPane; private List list; private JButton btnSelectAgent; private JTextField textField; private JButton btnBrowse; private JButton btnPreviousStep2; private JButton btnLoad; private JButton btnPreviousStep3; private JButton btnStart; private File file = null; ImageIcon icon = new ImageIcon("image.gif"); Border blackline = BorderFactory.createLineBorder(Color.black); private JPanel firstStepPanel; private JPanel secondStepPanel; private JPanel thirdStepPanel; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { NewGUI frame = new NewGUI(); frame.setVisible(true); } catch (…
tagged with: swing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35317847
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23104292
accepted answer: http://stackoverflow.com/a/23122326
has title: Getting new bound values from JFrame (Java)
score: 0
has comment: http://stackoverflow.com/comment/35348626
has answer: http://stackoverflow.com/a/23104292
has answer: http://stackoverflow.com/a/23122326
has comment: http://stackoverflow.com/comment/35316161
tagged with: jframe

http://stackoverflow.com/comment/35134898
type: AnswerComment
has text: When I try this, the correct result that I need appears for a split second, however, suddenly switches back to the strange symbols like ?$???cb@?=j?k??q??1?®?Q ?????PFI?Om?èy1??34?/?%}?A??????^?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23003339

http://stackoverflow.com/q/23007472
tagged with: selenium
upvote count: 7
type: Question
linked to: http://stackoverflow.com/q/23053632
has title: How wait for alert box to perform the action in Selenium?
has answer: http://stackoverflow.com/a/23010185
tagged with: java
has body: I am pressing a cancel button than according to my code it is checking some text. In Chrome and Firefox it is working fine but in IE it is taking time to perform operation on alert box but code moves to next line. So i want some code that stop till the operation is preformed on alert box and than it goes to next Step. I am doing automation testing using selenium. Please find piece of code: Alert al = driver.switchTo().alert(); al.accept(); wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(".//*[@id='content-body-full']/p[1]"))); assertEquals("Your cancellation request has been successfully executed.",driver.findElement(By.xpath(".//*[@id='content-body-full']/p[1]")).getText().toString());
tagged with: webdriver
answer count: 1
downvote count: 0
score: 7
favorite count: 0
tagged with: selenium-webdriver
type: UnansweredQuestion

http://stackoverflow.com/comment/35158206
type: AnswerComment
has text: Which will not round any better than simply casting to int.
type: Comment
comment on: http://stackoverflow.com/a/23012482
score: 0

http://stackoverflow.com/comment/35287490
type: AnswerComment
comment on: http://stackoverflow.com/a/23087417
score: 0
type: Comment
has text: @Eugene Outside of `unsafe` code, in C# you *can't* read memory that hasn't been allocated for you. It goes out of its way to make sure there *is no way* to read the memory after it is freed. If the memory is given over to some code not written in C#, and it decides to read memory allocated for it without first clearing/setting it, it can. There is no defined behavior for what it will see in such cases.

http://stackoverflow.com/q/23125289
type: Question
has comment: http://stackoverflow.com/comment/35464983
has answer: http://stackoverflow.com/a/23125322
has comment: http://stackoverflow.com/comment/35354378
has comment: http://stackoverflow.com/comment/35354325
tagged with: string
favorite count: 0
possible better answer: http://stackoverflow.com/a/23125322
has answer: http://stackoverflow.com/a/23125308
answer count: 3
has title: How do I convert the content of System.out.print to a String variable in java
has answer: http://stackoverflow.com/a/23125339
has comment: http://stackoverflow.com/comment/35354191
tagged with: system.out
upvote count: 2
has comment: http://stackoverflow.com/comment/35354415
downvote count: 3
tagged with: output
type: AnsweredQuestion
has body: I have this line of code: System.out.print(postalCodeIndex.findClosestBruteForce(latitude, longitude)); It returns output from a text file that was ran through an algorithm. For example the output is can be : "A0E 2Z0 Monkstown Newfoundland NL D [47.150300:-55.299500]". I would like to convert that output to a string so I can use it in a javafx GUI text. Is that posible?
has comment: http://stackoverflow.com/comment/35354434
tagged with: java
accepted answer: http://stackoverflow.com/a/23125339
tagged with: javafx
score: -1
has comment: http://stackoverflow.com/comment/35354290

http://stackoverflow.com/comment/35072489
comment on: http://stackoverflow.com/q/22969162
has text: @Takendarkk Incorrect output, sorry. Video frames do not play. It just skips to the end frame and outputs that.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35346104
score: 0
type: Comment
type: QuestionComment
has text: You should use the `after` method on java.util.Date. See http://docs.oracle.com/javase/6/docs/api/java/util/Date.html
comment on: http://stackoverflow.com/q/23120544

http://stackoverflow.com/a/23001716
accepted answer of: http://stackoverflow.com/q/22996284
type: Answer
downvote count: 0
score: 1
has body: Java APIs for RDS are part of the broader AWS Java SDK. The APIs exposed there can be used to start, modify, and destroy RDS instances. Data connectivity is via PgJDBC. The AWS SDK for RDS doesn't know or care about actually accessing the data, just managing the instances. So there's no single API like you describe, though you could probably write one as an extension/wrapper for an ORM like Hibernate, using the AWS SDK to provide automatic provisioning of servers when persistence units are created.
upvote count: 1
answers question: http://stackoverflow.com/q/22996284
type: AcceptedAnswer

http://stackoverflow.com/a/41020384
has body: Apart from DATABASE_URL, which is always there, Heroku creates 3 environment variables at Runtime. They are: JDBC_DATABASE_URL JDBC_DATABASE_USERNAME JDBC_DATABASE_PASSWORD As you may be aware, Spring Boot will automatically configure your database if it finds spring.datasource.* properties in your application.properties file. Here is an example of my application.properties spring.datasource.url=${JDBC_DATABASE_URL} spring.datasource.username=${JDBC_DATABASE_USERNAME} spring.datasource.password=${JDBC_DATABASE_PASSWORD} spring.jpa.show-sql=false spring.jpa.generate-ddl=true spring.jpa.hibernate.ddl-auto=update Hibernate / Postgres Dependencies In my case I'm using Hibernate (bundled in spring-boot-starter-jpa with PostgreSQL, so I needed the right dependencies in my build.gradle: dependencies { compile("org.springframework.boot:spring-boot-starter-data-jpa") compile('org.postgresql:postgresql:9.4.1212') }
downvote count: 0
answers question: http://stackoverflow.com/q/23041164
upvote count: 2
type: Answer
score: 2

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/23109388
tags question: http://stackoverflow.com/q/23055460
tag name: google-oauth
tags question: http://stackoverflow.com/q/23095779

http://stackoverflow.com/comment/35278613
type: Comment
has text: The article is not consistent: "Let’s say that again: Regardless of the active profiles, the resulting (main) artifact of the build must be identical!" and "It is perfectly legal to have profiles skip or include additional artifacts according to build profiles." or I did not get it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23082389

http://stackoverflow.com/comment/35180066
type: Comment
has text: Apache CXF generate proxy class for me.
score: 0
comment on: http://stackoverflow.com/a/23018211
type: AnswerComment

http://stackoverflow.com/q/23077971
type: Question
score: 3
tagged with: java
tagged with: jaxb
answer count: 1
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/23085336
upvote count: 3
type: UnansweredQuestion
has body: I have two similar schemas which have, for some elements, identical structure, but are defined under different namespaces. Is there any way to reuse the JAXB generated classes for the first schema when generating classes for the second schema? I know jaxb allows for binding customization, but I haven't been able to find out whether the same set of classes can be used simultaneously with two namespaces. More specifically: Schema1 &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt; &lt;xs:schema xmlns="ns1" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="ns1"&gt; &lt;xs:element name="Document" type="Document"/&gt; &lt;xs:complexType name="Document"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Root1" type="Root1Type"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="Root1Type"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Child" type="ChildType"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="ChildType"&gt; &lt;xs:sequence&gt; &lt;xs:element maxOccurs="1" minOccurs="0" name="MndtId" type="Max35Text"/&gt; &lt;xs:element name="MndtReqId" type="Max35Text"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:simpleType name="Max35Text"&gt; &lt;xs:restriction base="xs:string"&gt; &lt;xs:minLength value="1"/&gt; &lt;xs:maxLength value="35"/&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; &lt;/xs:schema&gt; Schema2 &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt; &lt;xs:schema xmlns="ns2" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="ns2"&gt; &lt;xs:element name="Document" type="Document"/&gt; &lt;xs:complexType name="Document"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Root2" type="Root2Type"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="Root2Type"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Child" type="ChildType"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:comple…
has title: Reuse JAXB classes for similar schemas

http://stackoverflow.com/q/23105769
downvote count: 0
has title: issues with print, format, println - java
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35318608
type: Question
has answer: http://stackoverflow.com/a/23106111
has comment: http://stackoverflow.com/comment/35318992
has comment: http://stackoverflow.com/comment/35318780
upvote count: 1
answer count: 1
favorite count: 0
has body: I started learning java with the deitel book and I'm doing the exercises they wrote. Suddenly after changing my java dir path (when opening) i started encountering problems with the printing methods like printf, format, println the compiler shows me that there is an error with it but it worked before and i changed back the path...opening a new class and still same problem, any thoughts? also, does anyone have a link to a file or a webpage with multiple exercises in java with solutions? package examples; import java.util.Scanner; public class exampleOne { public static int j=0; public static void main (String [] args){ boolean [] seats = new boolean [10]; for(int i=0; i&lt; seats.length; i++) seats[i]=false; Scanner clasScanner = new Scanner(System.in); char c=' '; while (c != '1' || c !='2' ){ System.out.println("Please choose the class of your choice:\n Press 1 for First class\n Press 2 for Economy\n"); String choice = clasScanner.next(); c = choice.charAt(0); if(c == '1') { System.out.print("you choce First class\n"); while (seats[j]==true &amp;&amp; j&lt;5) j++; seats[j]=true; System.out.printf("your seat is numbered %d", j+1); break; } if(c == '2') { System.out.print("you choce Eonomy class\n"); break; } } } } even this wont work: public class Test { public static void main (String [] args) { int i=6; System.out.printf("this is i: %d", i); } } this is the error I am getting: Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, Date) The method format(String, Object[]) in the type String is not applicable for the arguments (String, int, int, int) at examples.Date.&lt;init&gt;(Date.java:17) at examples.EmployeeTest.main(EmployeeTest.java:6)" tnx a lot
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35320669

http://stackoverflow.com/comment/35300819
comment on: http://stackoverflow.com/q/23094606
type: QuestionComment
type: Comment
has text: No worries, as future reference if want to let a stack overflow user know that you are responding to their comments you can use the @userName tag. That way they will get a notification and it will be easier for them to help. For example, you could have tagged me in your response comment, '@zgc7009 thank you so much for helping me..' :)
score: 0

http://stackoverflow.com/a/23038923
score: 2
has body: Check out the Swing tutorial on Using Layout Managers. You could use a vertical BoxLayout or a GridBagLayout or maybe a GridLayout. Whatever layout you choose to use the basic code for adding components to a visible GUI is: panel.add(...); panel.revalidate(); panel.repaint(); The other statements in your code are not necessary: //box.setVisible(true); // components are visible by default The following methods do not set a grid position. //box.setAlignmentX(0); //box.setAlignmentY(u);
downvote count: 0
answers question: http://stackoverflow.com/q/23038901
upvote count: 2
type: Answer

http://stackoverflow.com/a/23030611
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/23030593
has body: java.lang.IllegalStateException might help you PS. See also static Initializers in java. Maybe it can help you with initialization of your static fields.
downvote count: 0
type: Answer

http://stackoverflow.com/a/27540542
answers question: http://stackoverflow.com/q/23003617
has body: How to solve: Close Eclipse Copy all files from TOMCAT_7_HOME/conf to WORKSPACE_FOLDER/Servers/Tomcat v7.0 Server at localhost-config Start Eclipse Expand the Servers project, click on the Tomcat 7 project and hit F5 Start Tomcat from Eclipse
score: 0
type: Answer

http://stackoverflow.com/q/22999096
has body: I want to determine if JTextField.getText() contains only numbers between 0-9, where anything else is not accepted such as letters and other characters. What's a good way to do this? thanks.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35126824
has comment: http://stackoverflow.com/comment/35127053
has comment: http://stackoverflow.com/comment/35126974
score: -3
tagged with: swing
has comment: http://stackoverflow.com/comment/35126892
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/35127011
has comment: http://stackoverflow.com/comment/35126827
type: Question
has comment: http://stackoverflow.com/comment/35126913
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35126948
has comment: http://stackoverflow.com/comment/35126902
linked to: http://stackoverflow.com/q/237159
has comment: http://stackoverflow.com/comment/35131878
has answer: http://stackoverflow.com/a/22999233
has title: How to check if a text contains only int values in Java?
favorite count: 0

http://stackoverflow.com/comment/35174263
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23024811
has text: And regardless, it's always better to do, `if (Menu.subtractionBool)`

http://stackoverflow.com/comment/35217534
has text: Considering point 2 in [this answer](http://stackoverflow.com/a/8294127/3080094), I'm not sure what Kode Charlie suggests can be done. But I can't explain the difference in what Wireshark shows either. Maybe a comparison of what is received over the wire in both cases can give some insight.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23021763
score: 0

http://stackoverflow.com/a/22980137
accepted answer of: http://stackoverflow.com/q/22979728
type: Answer
has body: Just thought I should add my comments as an answer. You should only create one instance of the Ball class and use it. Each time you create a new instance of Ball, you set count = 0
has comment: http://stackoverflow.com/comment/35093727
answers question: http://stackoverflow.com/q/22979728
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35092341

http://stackoverflow.com/q/23077649
favorite count: 0
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/23077957
tagged with: web-services
has answer: http://stackoverflow.com/a/23077956
score: 4
has answer: http://stackoverflow.com/a/23078046
has answer: http://stackoverflow.com/a/23078052
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 1
has title: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 (little edit)
upvote count: 5
answer count: 5
type: UnansweredQuestion
has body: what I am having here is a web service that gives me the following JSON code : [ { "_OrderDetails": [ { "ProductName": "FUCHS SUPER GT SAE 10W30 6X5 / FP10100010102", "TotalAfterDiscount_Lc": "7500", "MeasureUnitName": "كرتونة", "TotalPrice_Lc": "7500", "PricePerUnit_Lc": "75", "Quantity": "100" } ], "Id": "274", "OrderDate": "4/10/2014 12:00:00 AM", "Number": "16", "CustomerName": "الأسد", "Note": "" } ] and I have made a java class (entity) with getters and setters for all data : package com.example.webservicetest; import java.util.List; public class Item { private String OrderDate; private String Number; private String Note; private String CustomerName; private String Id; private List&lt;_OrderDetails&gt; orderDetails; public String getOrderDate() { return OrderDate; } public void setOrderDate(String orderDate) { OrderDate = orderDate; } public String getNumber() { return Number; } public void setNumber(String number) { Number = number; } public String getNote() { return Note; } public void setNote(String note) { Note = note; } public String getId() { return Id; } public void setId(String id) { Id = id; } public String getCustomerName() { return CustomerName; } public void setCustomerName(String customerName) { CustomerName = customerName; } public List&lt;_OrderDetails&gt; getOrderDetails() { return orderDetails; } public void setOrderDetails(List&lt;_OrderDetails&gt; orderDetails) { this.orderDetails = orderDetails; } public class _OrderDetails{ private String OrderId; private String OrderDate; private String Number; private String Note; private String ProductName; private String TotalAfterDiscount_Lc; private String MeasureUnitName; private String TotalPrice_Lc; private String PricePerUnit_Lc; private String Quantity; public String getOrderId() { return OrderId; } public void setOrderId(String orderId) { OrderId = orderId; } public String getOrderDate() { return OrderDate; } public void setOrderDate(String orderDate) { OrderDate = orderDate; } public String ge…
has comment: http://stackoverflow.com/comment/35269795
has answer: http://stackoverflow.com/a/23078456

http://stackoverflow.com/a/23102342
accepted answer of: http://stackoverflow.com/q/23102193
score: 7
answers question: http://stackoverflow.com/q/23102193
upvote count: 7
has comment: http://stackoverflow.com/comment/35313254
has comment: http://stackoverflow.com/comment/35313169
has comment: http://stackoverflow.com/comment/35313562
type: AcceptedAnswer
downvote count: 0
has body: In beans.xml you are trying to set the field adminEmails of CollectionsWithProps. However the class doesn't have that field, it has the emails field. Either fix beans.xml to use emails instead of adminEmails, or fix the source code of CollectionsWithProps be renaming emails to adminEmails (along with the getters and setters)
type: Answer
has comment: http://stackoverflow.com/comment/35313386

http://stackoverflow.com/q/23048626
has answer: http://stackoverflow.com/a/23048673
has title: Get Android resource value from any class
has answer: http://stackoverflow.com/a/23048670
tagged with: android-resources
type: UnansweredQuestion
tagged with: android
has body: I'm just starting with Android programming and I'm still a little confused with some concepts. I'll tell you what I'm trying to do using a simplified example: I'm retrieving a list of cars from a remote server (PHP/MySQL/JSON) and showing them on a ListView. This is the server response JSON structure: { error: null, data: { cars: [ {name: "Lamborghini Diablo", color_id: 1}, {name: "McLaren F1", color_id: 2}, {name: "Ferrari F355", color_id: 1} ] } } Then I wrote the Car class: public class Car { public String name; public int color_id; public String color_name; public Car(JSONObject data) { try { this.name = data.getString("name"); this.color_id = data.getInt("color_id"); } catch (JSONException e) { e.printStackTrace(); } } } And last, this is a piece of the strings.xml resource file: White Yellow Orange Red Black When I get the data from server, there is a for loop to create the instances of the Car class, one for each item in the JSONArray. What I want to do is to get the color name from the , using the property color_id as the array index, but I can't find a way to get the R.array resource from the Car class constructor. How should I do this? Thank You!
tagged with: java
type: Question
tagged with: scope
score: 0
answer count: 2

http://stackoverflow.com/comment/35228182
comment on: http://stackoverflow.com/q/23055158
type: Comment
type: QuestionComment
has text: Using an SMB Java client library, yes
score: 1

http://stackoverflow.com/q/23011428
tagged with: swing
type: Question
has title: How to open an internal frame
tagged with: java
has answer: http://stackoverflow.com/a/23012179
answer count: 1
tagged with: user-interface
score: 0
tagged with: frame
has body: i open a new internalframe in this main frame, i have 2 class, DisplayInternalFrame aDisplay = new DisplayInternalFrame(name, surname); desktop.add(aDisplay); aDisplay.setMaximum(true); aDisplay.show() i have a desktop pane and its name desktop, this is my main frame, the internal frame is loading when the application runs, now my 2nd class is internalframe, it has a table, i want to open new internal frame when people push a table item, my table name is errorTable private void errorTableMouseClicked(java.awt.event.MouseEvent evt) { errorInternalFrame acceptFrame = new errorInternalFrame(); desktop.add(acceptFrame); the desktop is on the class 1 so i cant reach desktop cuz now i am on the internalframe event, basically when people push an item on the table on the internalframe, open a new internal frame, or something like this.
tagged with: mdi
type: UnansweredQuestion

http://stackoverflow.com/comment/35242095
score: 0
type: Comment
has text: Sorry for that. I made a spelling mistake. use equals() , :)
comment on: http://stackoverflow.com/a/23062239
type: AnswerComment

http://stackoverflow.com/comment/35126105
score: 0
has text: For future questions: take a look at the [help center](http://stackoverflow.com/help/how-to-ask).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22998626

spring-mvc
tags question: http://stackoverflow.com/q/23014761
tags question: http://stackoverflow.com/q/22974901
tags question: http://stackoverflow.com/q/23020532
tags question: http://stackoverflow.com/q/23128303
tags question: http://stackoverflow.com/q/23064024
tags question: http://stackoverflow.com/q/23118789
tags question: http://stackoverflow.com/q/22985846
tags question: http://stackoverflow.com/q/23025067
tags question: http://stackoverflow.com/q/22998776
tags question: http://stackoverflow.com/q/22984415
tags question: http://stackoverflow.com/q/23080668
tags question: http://stackoverflow.com/q/23035030
tags question: http://stackoverflow.com/q/23088597
tags question: http://stackoverflow.com/q/23027840
tags question: http://stackoverflow.com/q/23005746
tags question: http://stackoverflow.com/q/22999070
tags question: http://stackoverflow.com/q/23128660
tags question: http://stackoverflow.com/q/23027084
tags question: http://stackoverflow.com/q/23121805
tags question: http://stackoverflow.com/q/23017900
tags question: http://stackoverflow.com/q/23125641
tags question: http://stackoverflow.com/q/23020497
tags question: http://stackoverflow.com/q/23096350
tags question: http://stackoverflow.com/q/22988056
tags question: http://stackoverflow.com/q/23096078
tags question: http://stackoverflow.com/q/23077573
tags question: http://stackoverflow.com/q/22972762
tags question: http://stackoverflow.com/q/23076089
tags question: http://stackoverflow.com/q/22971831
tags question: http://stackoverflow.com/q/23061528
tags question: http://stackoverflow.com/q/23052155
tags question: http://stackoverflow.com/q/23054640
tags question: http://stackoverflow.com/q/23077008
tags question: http://stackoverflow.com/q/23077139
tags question: http://stackoverflow.com/q/23029458
tags question: http://stackoverflow.com/q/22999278
tags question: http://stackoverflow.com/q/22996319
tags question: http://stackoverflow.com/q/23032427
tags question: http://stackoverflow.com/q/22980858
tags question: http://stackoverflow.com/q/23049736
tags question: http://stackoverflow.com/q/23107318
tag name: spring-mvc
tags question: http://stackoverflow.com/q/22971793
tags question: http://stackoverflow.com/q/23118407
tags question: http://stackoverflow.com/q/23079511
tags question: http://stackoverflow.com/q/23117797
tags question: http://stackoverflow.com/q/22985204
tags question: http://stackoverflow.com/q/23052019
tags question: http://stackoverflow.com/q/23101260
tags question: http://stackoverflow.com/q/23096555
tags question: http://stackoverflow.com/q/23003309
tags question: http://stackoverflow.com/q/23113285
type: Tag
tags question: http://stackoverflow.com/q/23083883
tags question: http://stackoverflow.com/q/23106319
tags question: http://stackoverflow.com/q/23082038
tags question: http://stackoverflow.com/q/23093380
tags question: http://stackoverflow.com/q/23073291
tags question: http://stackoverflow.com/q/23022827
tags question: http://stackoverflow.com/q/23014873
tags question: http://stackoverflow.com/q/23107944
tags question: http://stackoverflow.com/q/23069673
tags question: http://stackoverflow.com/q/23014803
tags question: http://stackoverflow.com/q/23072619
tags question: http://stackoverflow.com/q/23062499
tags question: http://stackoverflow.com/q/23053341
tags question: http://stackoverflow.com/q/23074909
tags question: http://stackoverflow.com/q/22980597
tags question: http://stackoverflow.com/q/23008900
tags question: http://stackoverflow.com/q/23084029
tags question: http://stackoverflow.com/q/23009201
tags question: http://stackoverflow.com/q/23091410
tags question: http://stackoverflow.com/q/23005192
tags question: http://stackoverflow.com/q/23050466
tags question: http://stackoverflow.com/q/23066803
tags question: http://stackoverflow.com/q/23118478
tags question: http://stackoverflow.com/q/23077137
tags question: http://stackoverflow.com/q/23080102
tags question: http://stackoverflow.com/q/22998731
tags question: http://stackoverflow.com/q/23045856

http://stackoverflow.com/comment/35135336
comment on: http://stackoverflow.com/q/23003715
type: QuestionComment
type: Comment
has text: You can use an executable wrapper around Java program. See [How can I convert my Java program to an .exe file? \[closed\]][1]. [1]: http://stackoverflow.com/questions/147181/how-can-i-convert-my-java-program-to-an-exe-file
score: 3

http://stackoverflow.com/comment/35222986
type: Comment
comment on: http://stackoverflow.com/a/23051704
has text: Warning though about the "match trap" (`.matches()` considers the whole input and does not do "real" regex matching)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35171558
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23022912
has text: How do you pretend to select an employee without declaring a `value` attribute in the `selectOneMenu` itself? You're hacking it using a `valueChange` listener. This is, however, the less advisable choice to go with.

http://stackoverflow.com/comment/35299246
type: Comment
comment on: http://stackoverflow.com/q/23094008
has text: While http://projectlombok.org/ _does_ require one extra JAR the burden it removes is so gigantic it's well worth it. Never looked back.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35355761
type: Comment
comment on: http://stackoverflow.com/a/23125934
score: 0
type: AnswerComment
has text: Ok... Can you post the code that you use to insert in the db so I can edit on that?

http://stackoverflow.com/a/23001266
has body: It's working correctly now. I wish there was some way I could let you know. This is pretty robust; it will count the occurrences of multiple sequences if they occur more than once. The Map actually records all sequences but only prints out those that occur more than once. Note that the second for loop initializes ii to i and not 0. import java.util.ArrayList; import java.util.Map; import java.util.HashMap; public class Sequences { public static void main(String [] args) { int[] arr = {2, 9, 0, 6, 1, 2, 3, 6, 6, 1, 0, 1, 2, 3, 5, 4, 0, 3, 7, 1, 2, 3, 7, 5, 0}; int sequenceLength = 3; Map&lt;String, Integer&gt; map = new HashMap&lt;String, Integer&gt;(); int count; String str1, str2; for (int i = 0; i &lt;= arr.length - sequenceLength; i++) { str1 = ""; count = 0; for (int a = i; a &lt; i + sequenceLength; a++) { str1 += "" + arr[a]; } if (map.get(str1) != null) { continue; } else { map.put(str1, count); } for (int ii = i; ii &lt;= arr.length - sequenceLength; ii++) { str2 = ""; for (int a = ii; a &lt; ii + sequenceLength; a++) { str2 += "" + arr[a]; } if (str1.equals(str2)) { count++; map.put(str1, count); } } } for (Map.Entry&lt;String, Integer&gt; entry : map.entrySet()){ if (entry.getValue() &gt; 1) { System.out.println(entry.getKey() + " " + entry.getValue()); } } } }
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23001130
type: Answer
answers question: http://stackoverflow.com/q/23001130
upvote count: 4
has comment: http://stackoverflow.com/comment/35132062
has comment: http://stackoverflow.com/comment/35133693
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35131620
score: 4

relative-path
type: Tag
tags question: http://stackoverflow.com/q/22999666
tag name: relative-path

http://stackoverflow.com/comment/35078193
comment on: http://stackoverflow.com/a/22971514
score: 0
type: AnswerComment
type: Comment
has text: @DavidWallace i tried to explain why the errors, anyway i updated the answer.

http://stackoverflow.com/q/23033408
upvote count: 2
accepted answer: http://stackoverflow.com/a/23033616
has answer: http://stackoverflow.com/a/23033452
type: AnsweredQuestion
tagged with: split
has comment: http://stackoverflow.com/comment/35189263
tagged with: java
tagged with: substring
type: Question
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/23033508
has title: Extract String parts and add to ArrayList
downvote count: 0
has answer: http://stackoverflow.com/a/23033508
tagged with: string
has answer: http://stackoverflow.com/a/23033616
favorite count: 0
has answer: http://stackoverflow.com/a/23033451
has body: I have a problem with String substring option. I wanted to add some parts from a String into an ArrayList, but I only get to add the first text. ArrayList&lt;String&gt; arr = new ArrayList&lt;String&gt;(); String text = "[\"text1\",\"text2\",\"text3\"]"; text = text.substring(text.indexOf("\"") + 1); text = text.substring(0, text.indexOf("\"")); arr.add(text); for (int i = 0; i &lt; arr.size(); i++) { System.out.println(arr.get(i)); } The output for this is: text1 I would like the add all "texts" in the Array, each one in a different position: text1 text2 text3 Is there any possibility to do this? Thanks in advance.
answer count: 4
score: 2

http://stackoverflow.com/comment/35072306
has text: If you look at the code do you really think this is a solution here? I don't see it after this far to long day...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22969021
type: Comment

http://stackoverflow.com/a/24868148
score: 2
downvote count: 0
has body: Finally i got it. <TextView android:id="@+id/tv_archiv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingBottom="10dp" android:paddingTop="10dp" android:text="@string/archiv" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="#fff" /> <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/swipe_container" android:layout_width="match_parent" android:layout_height="match_parent" > </android.support.v4.widget.SwipeRefreshLayout> Inside of your code, u have to set the height of the footer as a padding for the listview. Because this is in px and u'll need dp, just transform it: float scale = getResources().getDisplayMetrics().density; int size = (int) (FOOTERHEIGHT * scale + 0.5f); SWIPEREFRESHLAYOUT.setPadding(0, 0, 0, size);
upvote count: 2
answers question: http://stackoverflow.com/q/23012765
type: Answer

http://stackoverflow.com/comment/35250681
comment on: http://stackoverflow.com/a/23066769
type: AnswerComment
score: 0
has text: I'm sorry ,I didn't mention that I make import of jdbc library in my project.The reason why I ma asking about this is the fact that if I run the same code as MainActivity without calling the ViewData it runs perfect.
type: Comment

opengl
tags question: http://stackoverflow.com/q/22999977
tags question: http://stackoverflow.com/q/22976815
tags question: http://stackoverflow.com/q/23075922
tags question: http://stackoverflow.com/q/22995103
type: Tag
tags question: http://stackoverflow.com/q/23092530
tags question: http://stackoverflow.com/q/23007931
tags question: http://stackoverflow.com/q/23068836
tags question: http://stackoverflow.com/q/23032325
tags question: http://stackoverflow.com/q/23031933
tags question: http://stackoverflow.com/q/23048271
tags question: http://stackoverflow.com/q/23034926
tag name: opengl
tags question: http://stackoverflow.com/q/23009912

http://stackoverflow.com/comment/35139827
type: Comment
has text: Last question : is this regex badly done ? `"Online\">(.*) "`
comment on: http://stackoverflow.com/a/23003085
type: AnswerComment
score: 0

gnu-make
type: Tag
tags question: http://stackoverflow.com/q/23034276
tags question: http://stackoverflow.com/q/23038047
tag name: gnu-make

http://stackoverflow.com/q/23020058
upvote count: 1
tagged with: swing
has body: I am using MilliDTSC class in my program. I want the refresh rate to be set as 100ms . I have used javax.swing.Timer to update the GUI after 100ms, but my domain axis updates after each millisecond, because unit is 'MilliSecond' (as shown below) Is there any way to change the unit of domain axis to 100ms instead of 1ms ?
score: 1
tagged with: java
tagged with: jfreechart
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23027401
has comment: http://stackoverflow.com/comment/35176552
has comment: http://stackoverflow.com/comment/35172961
linked to: http://stackoverflow.com/q/22256756
has answer: http://stackoverflow.com/a/23025512
linked to: http://stackoverflow.com/q/6856979
has title: Set no. of MilliSecond for plot in JFreeChart
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/64726142
has text: While this makes sense, is there a reason why there isn't an alternative static `Stream.of(Iterable)`, which would at least make the method reasonably discoverable by reading the API documentation -- as somebody who has never really worked with the internals of Streams I'd never even *looked* at `StreamSupport`, which is described in the documentation as providing "low-level operations" that are "mostly for library writers".
type: Comment
score: 68
comment on: http://stackoverflow.com/a/23177907
type: AnswerComment

http://stackoverflow.com/comment/35192094
score: 0
type: Comment
type: QuestionComment
has text: its a sudo code. assume its date type object
comment on: http://stackoverflow.com/q/23035080

http://stackoverflow.com/comment/35228066
has text: hey where is your said package is it in src or existing project or is it some other jar which you are trying to incorporate into this if yes add it lib in WEB-INF/lib and for safety just add it also to build
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23055076

http://stackoverflow.com/comment/35235932
has text: This is because, if I am not mistaken, the JRE (at least Oracle's) has a cache of all `Integer`s between -128 and 127 or something like that
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23059445

http://stackoverflow.com/q/23056659
has answer: http://stackoverflow.com/a/23060899
tagged with: multithreading
has body: does offer blocks poll or vice versa ? meaning , can a producer offer and at the same time a consumer trying to poll ? or if a producer was offering , the queue blocks till he is done ? object A while (true){ inputQueue.offer(newPartList); } object B while (true){ inputQueue.poll(newPartList); }
has title: concurrentLinkedQueue offer/poll blocking
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/23056822
upvote count: 3
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23056822
has comment: http://stackoverflow.com/comment/108914625
answer count: 3
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/23060899
has answer: http://stackoverflow.com/a/23057652

http://stackoverflow.com/comment/35197900
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23038024
has text: I should have phrased that better, which class are you including your enumeration in?
score: 0

http://stackoverflow.com/a/23020644
downvote count: 0
has comment: http://stackoverflow.com/comment/35167758
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/35167925
has body: Try override equals on your Hashsets, like this: HashSet set = new HashSet(list1){ public boolean equals(Object o) { return this.toString().equals(o.toString()); }; };
has comment: http://stackoverflow.com/comment/35167235
answers question: http://stackoverflow.com/q/23020328

http://stackoverflow.com/comment/35168867
has text: The [javadoc](http://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html) of the class explains this: *Reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines.*
comment on: http://stackoverflow.com/q/23021964
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22995955
has comment: http://stackoverflow.com/comment/35123434
has comment: http://stackoverflow.com/comment/35121040
type: Answer
has comment: http://stackoverflow.com/comment/35120965
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22995419
answers question: http://stackoverflow.com/q/22995419
has body: Try with this code &lt;c:set var="actionName"&gt; &lt;s:property value="%{#context['struts.actionMapping'].name}"/&gt; &lt;/c:set&gt; action name: ${actionName}&lt;br/&gt;
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35298808
comment on: http://stackoverflow.com/a/23093433
score: 0
type: Comment
type: AnswerComment
has text: @BheshGurung To double-check, you're talking about the version whose `equals` returns `true` unconditionally? In that case, consider again: There is no guarantee that `equals` is only called for objects with equal hash code (at least there isn't in the page you link to). Furthermore, that version violates the part of the `hashCode` contract that states "If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.".

http://stackoverflow.com/comment/35334379
has text: `fallbackIntValue` is a string or integer?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23113547
score: 0

http://stackoverflow.com/comment/35084783
type: AnswerComment
has text: So, the space efficiency would be 50% or 20%?
type: Comment
comment on: http://stackoverflow.com/a/22975152
score: 0

http://stackoverflow.com/comment/35149593
type: QuestionComment
comment on: http://stackoverflow.com/q/23011649
has text: Clarify you original question, rather than asking it again but in different words.
score: 1
type: Comment

http://stackoverflow.com/comment/35178953
comment on: http://stackoverflow.com/q/23027535
type: Comment
type: QuestionComment
score: 2
has text: What do your imports look like?

http://stackoverflow.com/a/23143716
score: 1
upvote count: 1
has body: That wasn't too bad. I created a frame, added the filechooser to the frame, modified what the "approve button" said, set the mode so it would display the name I wanted, and set action to when the buttons were pressed (actually saving or rewriting the file). Here's what worked: JFrame saveFrame = new JFrame(); saveFrame.setVisible(true); String unzippedPath = fullPath.substring(0,fullPath.length() - 4); JFileChooser jfc = new JFileChooser(); jfc.setCurrentDirectory(new File(unzippedPath)); jfc.setSelectedFile(new File(newSavedFile4)); jfc.setApproveButtonText("Save"); jfc.setFileSelectionMode(JFileChooser.FILES_ONLY); int result = jfc.showSaveDialog(null); if(result == JFileChooser.APPROVE_OPTION){ in = new File(unzippedPath); out = new File(jfc.getSelectedFile().toString() + ".docx"); System.out.println(out.getAbsolutePath()); int BUF_SIZE = (int) in.length(); FileInputStream fiss = new FileInputStream(in); FileOutputStream foss = new FileOutputStream(out); try{ byte[]buf = new byte[BUF_SIZE]; int i = 0; while((i = fiss.read(buf)) != -1){ foss.write(buf, 0, i); } } catch(Exception e){ throw e; } finally{ if(fiss != null) fiss.close(); if(foss != null) foss.close(); } saveFrame.setVisible(false); } else if(result == JFileChooser.CANCEL_OPTION){ saveFrame.setVisible(false); } JPanel SPanel = new JPanel(); SPanel.setLayout(new FlowLayout()); SPanel.add(jfc); saveFrame.setLayout(new FlowLayout()); saveFrame.add(SPanel); saveFrame.pack(); saveFrame.setTitle("Save your Doc"); saveFrame.setLocationRelativeTo(null); Thanks Luke D! +1 if I could ( I don't think I have enough points yet) (I'm the original poster and can't remember my password, sorry)
type: Answer
answers question: http://stackoverflow.com/q/23065877
downvote count: 0

http://stackoverflow.com/comment/35086453
comment on: http://stackoverflow.com/q/22976394
score: 0
has text: "My passed array is one dimensional and must be converted into a two dimensional array." So how do you know how to split up the array??
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35152320
has text: I used imageView.setLayoutParams(new GridView.LayoutParams(85, 85)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(4,4,4,4); But why is the w: 85 and h:85
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23012825
type: AnswerComment

http://stackoverflow.com/q/23062293
has comment: http://stackoverflow.com/comment/35242496
type: Question
tagged with: spring-batch
has title: ERROR: Encountered an error executing the step org.springframework.batch.item.ItemStreamException: Failed to initialize the reader
answer count: 1
has comment: http://stackoverflow.com/comment/35241589
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23069292
has comment: http://stackoverflow.com/comment/35241718
upvote count: 1
tagged with: spring
has body: This is my FlatFileItemReader configuration &lt;beans:bean id="myFileItemReader" class="org.springframework.batch.item.file.FlatFileItemReader" p:resource="file://tmp/my-#{jobParameters[date]}/data.txt" p:lineMapper-ref="myLineMapper" scope="step"/&gt; I am getting this error ERROR: org.springframework.batch.core.step.AbstractStep - Encountered an error executing the step org.springframework.batch.item.ItemStreamException: Failed to initialize the reader at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:142) 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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:132) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:120) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy25.open(Unknown Source) at org.springframework.batch.item.support.CompositeItemStream.open(CompositeItemStream.java:96) at org.springframework.batch.core.step.tasklet.TaskletStep.open(TaskletStep.java:307) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:195) at org.springframework.batch.core.job.Sim…
accepted answer: http://stackoverflow.com/a/23069292
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/35112942
comment on: http://stackoverflow.com/q/22990067
score: 0
type: Comment
type: QuestionComment
has text: @MenoHochschild I've updated my question with timezone info and corrected the actual value from GTM to localtime. Is there an easier way to get the epoch of some `LocalDateTime` other than manually calculating it?

http://stackoverflow.com/q/23120860
tagged with: java
has body: I hope I'm asking the right questions here but feel free to ask me for any additonal information. I am trying to write a program in Java that will process a chunk of code from a textarea. the program does exactly what i expect of it but can take some time, so I want to put a JProgressBar on the dialog that will update. I have reviewed the oracle samples on progress bars and am attempting to do something like the example in http://docs.oracle.com/javase/tutorial/uiswing/components/progress.html This uses a simple enough example where... the overall JFrame class has a Task subclass that extends Swingworker. The Swingworker class (Task) executes the task in the background using the doinBackground() method. The Progress is updated using the setProgress() method. The main JFrame Task implements propertychangelistener so as I understand it, when ProgressBarDemo calls Task, it associates its own propertychangelistener with task and when Task calls setprogress() the data change is broadcast to the ProgressBarDemos propertyChange(evt) method. And this works perfectly as an example. public class ProgressBarDemo extends JPanel implements ActionListener, PropertyChangeListener { 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. */ @Override public Void doInBackground() { Random random = new Random(); int progress = 0; //Initialize progress property. setProgress(0); while (progress &lt; 100) { //Sleep for up to one second. try { Thread.sleep(random.nextInt(1000)); } catch (InterruptedException ignore) { } //Make random progress. progress += random.nextInt(10); setProgress(Math.min(progress, 100)); } return null; } /* * Executed in event dispatching thread */ @Override public void done() { Toolkit.getDefaultToolkit().beep(); startButton.setEnabled(true); setCursor(null); //turn off the wait cursor taskOutput.append("Done!\…
type: Question
tagged with: swingworker
has comment: http://stackoverflow.com/comment/35413636
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/23158809
tagged with: dialog
has title: Swingworker Freezing Dialogs, not updating

http://stackoverflow.com/comment/35355937
type: QuestionComment
has text: Look in the .log file in the .metadata directory of the workspace to see if there is a more detailed message
comment on: http://stackoverflow.com/q/23125695
score: 0
type: Comment

http://stackoverflow.com/q/23118001
tagged with: encode
type: UnansweredQuestion
tagged with: android
upvote count: 1
tagged with: audio
has body: I am trying to convert PCM data byte to OGG format. I am using xiph Vorbis Encoder classes to do this. My code generate the OGG file but When I play it then there is no such sound simply sshhh. Please see here https://www.dropbox.com/s/2m3fwujjm88s66a/demo.ogg Code public AudioRecord findAudioRecord() { for (int rate : mSampleRates) { for (short audioFormat : new short[]{AudioFormat.ENCODING_PCM_16BIT}) { for (short channelConfig : new short[]{AudioFormat.CHANNEL_IN_STEREO}) { try { Log.d(LOG_TAG, "Attempting rate " + rate + "Hz, bits: " + audioFormat + ", channel: " + channelConfig); bufferSize = AudioRecord.getMinBufferSize(rate, channelConfig, audioFormat); if (bufferSize != AudioRecord.ERROR_BAD_VALUE) { // check if we can instantiate and have a success recorder = new AudioRecord(MediaRecorder.AudioSource.DEFAULT, rate, channelConfig, audioFormat, bufferSize); if (recorder.getState() == AudioRecord.STATE_INITIALIZED) return recorder; } } catch (Exception e) { Log.e(LOG_TAG, rate + "Exception, keep trying.", e); } } } } return null; } // convert short to byte private byte[] short2byte(short[] sData) { int shortArrsize = sData.length; byte[] bytes = new byte[shortArrsize * 2]; for (int i = 0; i &lt; shortArrsize; i++) { bytes[i * 2] = (byte) (sData[i] &amp; 0x00FF); bytes[(i * 2) + 1] = (byte) (sData[i] &gt;&gt; 8); sData[i] = 0; } return bytes; } private void writeAudioDataToFile() { // Write the output audio in byte short sData[] = new short[bufferSize / 2]; try { vorbisFileOutputStream = new VorbisFileOutputStream( "/sdcard/demo.ogg"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } BufferedOutputStream bufferedOutputStream = new BufferedOutputStream( vorbisFileOutputStream); dataOutputStream = new DataOutputStream(bufferedOutputStream); while (isRecording) { // gets the voice output from microphone to byte format recorder.read(sData, 0, bufferSize / 2); System.out.println("Short writing to file" + sData.toString()); try { //…
score: 1
tagged with: java
type: Question
has title: PCM data bytes to Vorbis in Android
downvote count: 0
tagged with: oggvorbis
favorite count: 0
answer count: 0

http://stackoverflow.com/comment/35136394
has text: Can you try the upload using "https" instead of "http" and update the status?
comment on: http://stackoverflow.com/q/23003364
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35139667
type: QuestionComment
comment on: http://stackoverflow.com/q/23006440
score: 0
type: Comment
has text: In which Version And device you are running your application?

http://stackoverflow.com/q/23073885
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35263211
has comment: http://stackoverflow.com/comment/35263090
has comment: http://stackoverflow.com/comment/35263186
tagged with: java
has title: Why doesn't arrayList sort in java even after using collections.reverse()
has comment: http://stackoverflow.com/comment/35263002
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/35265553
has answer: http://stackoverflow.com/a/23073951
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/35265586
answer count: 1
has comment: http://stackoverflow.com/comment/35263150
has body: I am trying to sort a hashmap based on its values, The way I am doing this is separating the keyset and valueset of the hashmap into two arrayList ,then sorting the lists individually and then adding the values in a new haspMap after some comparison operations but for some reason collection.reverse(LIST), won't sort the list in descending order Here is my code: public LinkedHashMap sortHashMapByValuesD(HashMap passedMap) { ArrayList &lt;Integer&gt;mapKeys = new ArrayList&lt;Integer&gt;(passedMap.keySet()); ArrayList &lt;Double&gt;mapValues= new ArrayList&lt;Double&gt;(passedMap.values()); Collections.reverse(mapValues); Collections.reverse(mapKeys); //&gt;&gt;**Here the list won't sort for some reason** LinkedHashMap&lt;Integer, Double&gt; sortedMap = new LinkedHashMap&lt;Integer, Double&gt;(); Iterator valueIt = mapValues.iterator(); while (valueIt.hasNext()) { Object val = valueIt.next(); //System.out.println(val); Iterator keyIt = mapKeys.iterator(); while (keyIt.hasNext()) { Object key = keyIt.next(); Double comp1 =(Double)passedMap.get(key); Double comp2 = (Double)val; if (comp1==comp2){ passedMap.remove(key); mapKeys.remove(key); sortedMap.put((Integer)key,(Double)val); break; } } } return sortedMap; } Thanks in advance

http://stackoverflow.com/comment/35311748
score: 2
comment on: http://stackoverflow.com/q/23101679
has text: What have you done so far?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23059174
type: Question
tagged with: resources
has comment: http://stackoverflow.com/comment/35235540
has answer: http://stackoverflow.com/a/23060697
score: 0
has body: I want to name my resource file something like レオウ.png (Japanese). However, there is error when loading that resource. I wonder if there is any way I can do that.
answer count: 1
has title: How to name resource file in android other than english
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35235481
has comment: http://stackoverflow.com/comment/35263603
has comment: http://stackoverflow.com/comment/35235636
has comment: http://stackoverflow.com/comment/35235654
tagged with: java
has comment: http://stackoverflow.com/comment/35235503
has comment: http://stackoverflow.com/comment/35235574

android-asynctask
tags question: http://stackoverflow.com/q/23066532
tags question: http://stackoverflow.com/q/23119689
tags question: http://stackoverflow.com/q/23044208
tags question: http://stackoverflow.com/q/23106657
tags question: http://stackoverflow.com/q/23022117
type: Tag
tag name: android-asynctask
tags question: http://stackoverflow.com/q/23071245
tags question: http://stackoverflow.com/q/23049501
tags question: http://stackoverflow.com/q/22969889
tags question: http://stackoverflow.com/q/23096006
tags question: http://stackoverflow.com/q/23086743
tags question: http://stackoverflow.com/q/23118803
tags question: http://stackoverflow.com/q/23117598
tags question: http://stackoverflow.com/q/22979622
tags question: http://stackoverflow.com/q/23072907
tags question: http://stackoverflow.com/q/23017275
tags question: http://stackoverflow.com/q/23014760
tags question: http://stackoverflow.com/q/22979647
tags question: http://stackoverflow.com/q/23125548
tags question: http://stackoverflow.com/q/23034700
tags question: http://stackoverflow.com/q/22990764
tags question: http://stackoverflow.com/q/23113218
tags question: http://stackoverflow.com/q/23053462
tags question: http://stackoverflow.com/q/23054575
tags question: http://stackoverflow.com/q/23086805

http://stackoverflow.com/q/23051879
has answer: http://stackoverflow.com/a/23052588
tagged with: java-8
type: Question
score: 14
has comment: http://stackoverflow.com/comment/35223280
tagged with: java
possible better answer: http://stackoverflow.com/a/23052588
has body: say I have the following code public class A { int x; public boolean is() {return x%2==0;} public static boolean is (A a) {return !a.is();} } and in another class... List&lt;A&gt; a = ... a.stream().filter(b-&gt;b.isCool()); a.stream().filter(A::is); //would be equivalent if the static method is(A a) did not exist the question is how do I refer to the instance method version using the A::is type notation? Thanks a lot
answer count: 2
has answer: http://stackoverflow.com/a/23055997
has title: Java 8 reference to a static method vs. instance method
downvote count: 0
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23055997
tagged with: java-stream
upvote count: 14
tagged with: method-reference
has comment: http://stackoverflow.com/comment/35223542

http://stackoverflow.com/comment/35143798
type: QuestionComment
has text: Just to add to Stephen's comment. Learning to use a debugger will make you a much more productive programmer. It's one of the most important skills a programmer can learn. And it ought to be taught as early as possible in every introductory programming course. Sadly, it is not.
score: 1
comment on: http://stackoverflow.com/q/23007044
type: Comment

http://stackoverflow.com/comment/35277713
score: 0
has text: can you please modify my code i am unable to understand
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23081003

http://stackoverflow.com/q/23038215
tagged with: rectangles
has answer: http://stackoverflow.com/a/23038227
score: 1
tagged with: java
has body: I am creating a game, and it requires an infinite number of Rectangles. For example, let's say I name the variables car: public Rectangle car1; public Rectangle car2; public Rectangle car3; and so on, Would there be an easier way? Like: public int carNumber; public Rectange car + carNumber;//if carNumber was one, it would be called car1 Also, I will need to test if the rectangles contain others. &lt;-- I know how to do this.
downvote count: 1
has comment: http://stackoverflow.com/comment/35198097
has title: How would I define an infinite number of variables? *Java*
type: Question
possible better answer: http://stackoverflow.com/a/23038227
has answer: http://stackoverflow.com/a/23038273
tagged with: variables
has answer: http://stackoverflow.com/a/23038222
has answer: http://stackoverflow.com/a/23038223
favorite count: 0
has answer: http://stackoverflow.com/a/23038383
upvote count: 2
tagged with: infinite
answer count: 5
accepted answer: http://stackoverflow.com/a/23038222
type: AnsweredQuestion

http://stackoverflow.com/a/22982277
answers question: http://stackoverflow.com/q/22982157
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: If q1 is one of JCF implementations of Queue like ArrayQueue etc are Cloneable you can use Queue q2 = ((Cloneable)q1).clone(); otherwise Queue q2 = q1.getClass().newInstance(); for(Object e : q1) { q2.add(e); }

http://stackoverflow.com/q/23086296
tagged with: android-mediaplayer
downvote count: 0
has comment: http://stackoverflow.com/comment/55032490
tagged with: media-player
has comment: http://stackoverflow.com/comment/48366133
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 3
answer count: 0
upvote count: 3
tagged with: java
tagged with: stream
has title: Android MediaPlayer onError delegate method never called
type: Question
has body: I have an Android app currently in production. This app streams remote live audio files using the MediaPlayer class of the Android SDK. I set an errorListener on my mediaplayer like this: player = new MediaPlayer(); player.setOnErrorListener(this); But I never get in the following delegate method (according to Google Analytics, none of my thousand users get in this delegate method) : public boolean onError(MediaPlayer mp, int what, int extras) { GoogleAnalytics.trackAction("MainActivity", "Streaming onError", "onError what = " + what + " extras = " + extras); return true; } My question is : why I never get in the OnError method ? Is there a bug in the MediaPlayer class ?

string
tags question: http://stackoverflow.com/q/23078639
tags question: http://stackoverflow.com/q/22973732
tags question: http://stackoverflow.com/q/23077692
tags question: http://stackoverflow.com/q/23057573
tags question: http://stackoverflow.com/q/22998395
tags question: http://stackoverflow.com/q/23111471
tags question: http://stackoverflow.com/q/23033737
tags question: http://stackoverflow.com/q/23099950
tags question: http://stackoverflow.com/q/23064481
tags question: http://stackoverflow.com/q/22992681
tags question: http://stackoverflow.com/q/22969348
tags question: http://stackoverflow.com/q/23039447
tags question: http://stackoverflow.com/q/23046251
tags question: http://stackoverflow.com/q/23060292
tags question: http://stackoverflow.com/q/22974008
tags question: http://stackoverflow.com/q/23068623
tags question: http://stackoverflow.com/q/23036248
tags question: http://stackoverflow.com/q/23054587
tags question: http://stackoverflow.com/q/22975413
tags question: http://stackoverflow.com/q/23115177
tags question: http://stackoverflow.com/q/23027393
tags question: http://stackoverflow.com/q/22991988
tags question: http://stackoverflow.com/q/23082517
tags question: http://stackoverflow.com/q/23105464
tags question: http://stackoverflow.com/q/23047763
tags question: http://stackoverflow.com/q/23119788
tags question: http://stackoverflow.com/q/23008717
tags question: http://stackoverflow.com/q/23109869
tags question: http://stackoverflow.com/q/23122665
tags question: http://stackoverflow.com/q/23014242
tags question: http://stackoverflow.com/q/23003519
tags question: http://stackoverflow.com/q/23115927
tags question: http://stackoverflow.com/q/22975197
tags question: http://stackoverflow.com/q/23046493
tags question: http://stackoverflow.com/q/23076966
tags question: http://stackoverflow.com/q/23125968
tags question: http://stackoverflow.com/q/23079197
tags question: http://stackoverflow.com/q/22976498
tags question: http://stackoverflow.com/q/23048228
tags question: http://stackoverflow.com/q/23089616
tags question: http://stackoverflow.com/q/22994497
tags question: http://stackoverflow.com/q/23043472
tags question: http://stackoverflow.com/q/23018302
tag name: string
tags question: http://stackoverflow.com/q/23003874
tags question: http://stackoverflow.com/q/23002522
tags question: http://stackoverflow.com/q/23071759
tags question: http://stackoverflow.com/q/23114875
tags question: http://stackoverflow.com/q/23064247
tags question: http://stackoverflow.com/q/23123920
tags question: http://stackoverflow.com/q/23078525
tags question: http://stackoverflow.com/q/22983399
tags question: http://stackoverflow.com/q/23052884
tags question: http://stackoverflow.com/q/23026492
tags question: http://stackoverflow.com/q/23036898
tags question: http://stackoverflow.com/q/23123008
tags question: http://stackoverflow.com/q/23044557
tags question: http://stackoverflow.com/q/23124977
tags question: http://stackoverflow.com/q/22986832
tags question: http://stackoverflow.com/q/23044159
tags question: http://stackoverflow.com/q/23092996
tags question: http://stackoverflow.com/q/23106657
tags question: http://stackoverflow.com/q/23104837
tags question: http://stackoverflow.com/q/23044824
type: Tag
tags question: http://stackoverflow.com/q/23005851
tags question: http://stackoverflow.com/q/23120768
tags question: http://stackoverflow.com/q/22976153
tags question: http://stackoverflow.com/q/23125289
tags question: http://stackoverflow.com/q/22993407
tags question: http://stackoverflow.com/q/23068221
tags question: http://stackoverflow.com/q/23033408
tags question: http://stackoverflow.com/q/23001085
tags question: http://stackoverflow.com/q/23100657
tags question: http://stackoverflow.com/q/22987988
tags question: http://stackoverflow.com/q/23122191
tags question: http://stackoverflow.com/q/23003142
tags question: http://stackoverflow.com/q/23048613
tags question: http://stackoverflow.com/q/22973505
tags question: http://stackoverflow.com/q/23117568

http://stackoverflow.com/comment/35228299
type: AnswerComment
comment on: http://stackoverflow.com/a/23052364
type: Comment
score: 2
has text: Sir i have already read the question carefully even when you haven't defined it well. I can give you the solution with what inputs I have. So better now you try it your own as I have already provide u the snippet that how to parse it. This site is not for spoon feeding. Try to put some efforts by you own as well.

http://stackoverflow.com/a/22995904
has comment: http://stackoverflow.com/comment/35121006
downvote count: 0
has comment: http://stackoverflow.com/comment/35133347
accepted answer of: http://stackoverflow.com/q/22995753
answers question: http://stackoverflow.com/q/22995753
type: AcceptedAnswer
score: 1
type: Answer
upvote count: 1
has body: Basically, it's to do with performance. A 'stack' is just an interface - it's a way of getting at the data for viewing and modification through some set of commands. However, this tells is nothing about how that data is stored in the structure - that's where stuff like ArrayStack and LinkedStack become important. Essentially, each of these stacks is 'backed' by some more primitive structure - this is the bit behind the scenes that actually stores the data that we put in it. In the case of the ArrayStack, this is an array - in the case of the LinkedStack, this is a linked list. So what's the difference? Well, consider the array. Arrays must use contiguous memory - namely, the whole array has to be given a block in memory which is one long uninterrupted chunk. On the other hand, a linked list consists of individual nodes linked by pointers - there is no requirement that it be contiguous at all. This makes resizing arrays problematic - essentially, we have to make a new array, and copy everything into it to resize it. This can be a problem with stacks, as we often have no idea precisely how large the stack will get. Linked lists don't have this problem - we just create a new node and link it to the list as it was before. Thus, overall, the difference is memory use and performance - try implementing both and timing how they work with big data to see the difference.

http://stackoverflow.com/a/23008701
score: 0
has body: Yes it is possible. As you said - it compiles (and I imagine runs), so it's legal. In fact it is legal to declare a subinterface in an interface, or an enum (but only public ones, as private ones don't make any sense in an interface, just like private methods). As for practical uses: You can declare a private inner class in your abstract class and use it in methods of said abstract class (I hope you can think of a usage for that). Or two of those. And if you need a shared contract for both - you can use an interface. Or you would need to return a specific thing that doesn't make sense outside the parent class. A more down-to-earth example is the interface Map and it's sub-interface Map.Entry. Some methods of Map return and Entry, yet entry is meaningless without Map, so is not a standalone interface. If Map was an abstract class rather than an interface you would have exactly the situation you described.
answers question: http://stackoverflow.com/q/23008433
type: Answer

http://stackoverflow.com/a/23116303
downvote count: 0
type: Answer
has body: Uninstalling the program, deleting the IntelliJ settings folder in "MyDocuments", deleting the IntelliJ folder in "Program Files" and Reinstalling a fresh new IntelliJ from the site resolved the issue.
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/23030663
answers question: http://stackoverflow.com/q/23030663
type: AcceptedAnswer

http://stackoverflow.com/comment/35344325
type: AnswerComment
comment on: http://stackoverflow.com/a/23103381
score: 0
type: Comment
has text: works fine for me. maybe we can have a list of all the jars in WEB-INF/lib and the actual output of the ajax call (error message/stack trace?)

http://stackoverflow.com/q/22974475
tagged with: servlet-2.5
tagged with: spring-boot
accepted answer: http://stackoverflow.com/a/22980862
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has title: Does Spring Boot support servlet 2.5 auto-configuration?
type: Question
tagged with: google-app-engine
tagged with: spring
has answer: http://stackoverflow.com/a/22980862
upvote count: 2
tagged with: java
has body: I would like to create a Spring Boot application to be deployed on Google AppEngine infrastructure. GAE currently only supports servlet 2.5 web applications. Is it possible to use Spring Boot - using auto-configuration - in combination with a old-fashioned web.xml? Can I for example use a contextClass/contextConfigLocation pointing to a @Configration class including @EnableAutoConfiguration? All Spring Boot examples seem to use a simple Application class with main method to run the application. So I would like to know if Spring Boot supports using a web.xml as start point to boot the application?
answer count: 1

http://stackoverflow.com/comment/35301310
score: 1
has text: @donfuxx: Internally, `String.replaceAll` will generate a regex. If you however plan to perform this task multiple times, you don't need to recompile the regex each time as it is static.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23095093

http://stackoverflow.com/comment/35191062
type: AnswerComment
score: 0
type: Comment
has text: Thank you StaxMan. Is it too bad performance-wise? We are converting to a String, then to a full hierarchical JSonNode, and later the Play Framework converts it back again to a String.
comment on: http://stackoverflow.com/a/23026354

http://stackoverflow.com/q/23043873
answer count: 0
has title: How run 2 and more nodes on same selenium hub programmatically(without console)
upvote count: 3
has body: I can run 1 node on selenium grid hub. Here is snippet of my code. GridHubConfiguration config = new GridHubConfiguration() config.setHost("localhost") config.setTimeout(60000000) Hub hub = new Hub(config) hub.start() RegistrationRequest req = new RegistrationRequest() req.setRole(GridRole.NODE) Map&lt;String, Object&gt; nodeConfiguration = new HashMap&lt;String, Object&gt;(); nodeConfiguration.put(RegistrationRequest.PROXY_CLASS, "org.openqa.grid.selenium.proxy.DefaultRemoteProxy") nodeConfiguration.put(RegistrationRequest.MAX_SESSION, 25) nodeConfiguration.put(RegistrationRequest.PORT, 5555) nodeConfiguration.put(RegistrationRequest.HOST, hub.getHost()) nodeConfiguration.put(RegistrationRequest.AUTO_REGISTER, true) nodeConfiguration.put(RegistrationRequest.REGISTER_CYCLE, 5000) nodeConfiguration.put(RegistrationRequest.HUB_HOST, hub.getHost()) nodeConfiguration.put(RegistrationRequest.HUB_PORT, hub.getPort()) URL remoteURL = new URL("http://" + hub.getHost() + ":" + 5555) nodeConfiguration.put(RegistrationRequest.REMOTE_HOST, remoteURL) req.setConfiguration(nodeConfiguration) DesiredCapabilities capabilities = DesiredCapabilities.chrome() capabilities.setCapability("browserName","chrome") capabilities.setCapability("maxInstances",25) capabilities.setCapability("seleniumProtocol","Selenium") req.setCapabilities([capabilities]); SelfRegisteringRemote remote = new SelfRegisteringRemote(req) remote.startRemoteServer() remote.startRegistrationProcess() I have 3 problems.. As you can see I set MAX_SESSION and maxInstances to 25, although I can't run more than 10 Chrome driver Instances, maybe I did something wrong or maybe it is a bug? How run 2 and more nodes on same selenium hub programmatically(without console) ? How run web driver in headless mode? There is a very usefull link Headless tests with Firefox and Chrome WebDriver, but I couldn't find out how do it for Selenium grid. I am using selenium-server-standalone-2.40.0.jar
tagged with: java
tagged with: selenium
type: Question
has comment: http://stackoverflow.com/comment/51180576
tagged with: selenium-grid
has comment: http://stackoverflow.com/comment/40979910
score: 3
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: selenium-webdriver

http://stackoverflow.com/q/23016853
has title: ViewScope in managed bean throwing NotSerializableException: com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate
has comment: http://stackoverflow.com/comment/35161779
linked to: http://stackoverflow.com/q/3037722
type: AnsweredQuestion
tagged with: jsf
has body: Right now I'm facing the following issue: I'm using @ViewScoped in my Managed bean, but when the application is redering the JSF is throwing the following exception: Grave: Error Rendering View[/historico/reporteHistoricoComparativo.xhtml] java.io.NotSerializableException: com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347) at java.util.HashMap.writeObject(HashMap.java:1133) at sun.reflect.GeneratedMethodAccessor72.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.writ…
tagged with: java
has answer: http://stackoverflow.com/a/23022346
accepted answer: http://stackoverflow.com/a/23022346
type: Question
tagged with: jakarta-ee
score: 0
answer count: 1

http://stackoverflow.com/comment/35215132
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23005797
has text: getHashMapData() simplifies code. It just returns a hashmap but problem occurs after that point.I can see only one just element(persistData) before adding. after putting processCodeDVO:test.dvo.ProcessCodeDVO@a31742c object I print out the result as above.
score: 0

http://stackoverflow.com/a/23043785
has comment: http://stackoverflow.com/comment/35207441
has comment: http://stackoverflow.com/comment/35207588
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23043670
score: 2
has body: Since you are using Apache Commons, you can do it in one line: String contents = FileUtils.readFileToString(new File("arff_file/"+results.get(0)), "UTF-16").replaceAll("^.*?(?=@data)", ""); This works by reading the whole file into a single String using regex-based replaceAll() to remove (by replacing with a blank) everything up to, but not including, @data The regex breakdown of ^.*?(?=@data) is: ^ start of input .*? a reluctantly quantified wildcard (?=@data) a positive (non-consuming) look ahead that asserts that the next input is @data A reluctant quantifier could be important to use so it won't skip past the first @data, in case it appears more than once in the input.
accepted answer of: http://stackoverflow.com/q/23043670
has comment: http://stackoverflow.com/comment/35207521
has comment: http://stackoverflow.com/comment/35207412
downvote count: 0
has comment: http://stackoverflow.com/comment/35207377
type: AcceptedAnswer

http://stackoverflow.com/q/23032706
type: UnansweredQuestion
has body: Hello I have to update my the qty in my database every night for a minimum of a 2 million parts. I am using jdbc as my mysql connector. I am working with only 1 table a warehouse table. We get sent in a file every night from each warehouse with the part number and the qty that needs to be updated. here is the warehouse schema: warehouse | CREATE TABLE `warehouse` ( `id` int(11) NOT NULL AUTO_INCREMENT, `sap_article_id` varchar(128) NOT NULL, `sap_warehouse` varchar(24) NOT NULL, `as400_warehouse` varchar(10) NOT NULL, `ds_warehouse` varchar(10) NOT NULL, `atp_qty` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `article` (`sap_article_id`) ) ENGINE=MyISAM AUTO_INCREMENT=497524962 DEFAULT CHARSET=latin1 | Warehouse indexes: +-----------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | +-----------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+ | warehouse | 0 | PRIMARY | 1 | id | A | 2858699 | NULL | NULL | | BTREE | | | warehouse | 1 | article | 1 | sap_article_id | A | 571739 | NULL | NULL | | BTREE | | +-----------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+ the warehouse table has about 3 million records in it. I am unable to finish the processing of all these files during the night. Here is my logic... like I said I have multiple files I need to process one for each warehouse. "SELECT sap_article_id FROM " + WAREHOUSE_TABLE + " WHERE " + "sap_article_id='" + sapArticleId + "' AND sap_warehouse='" + sapWarehouse + "'"; if part exists at warehouse... we update it.. "UPDATE " + WAREHOUSE_TABLE + " " + "SET ds_warehouse='0'," + "atp_qty=" + atpQty + " WHERE sap_article_id='" + sapA…
has comment: http://stackoverflow.com/comment/35188033
tagged with: java
has answer: http://stackoverflow.com/a/23033074
tagged with: mysql
has comment: http://stackoverflow.com/comment/35188436
type: Question
has comment: http://stackoverflow.com/comment/35189951
has comment: http://stackoverflow.com/comment/35188183
answer count: 1
has title: Performance tuning my update statement
has comment: http://stackoverflow.com/comment/35188303
tagged with: optimization
has comment: http://stackoverflow.com/comment/35188363
score: 0
has comment: http://stackoverflow.com/comment/35188114
tagged with: sql-update
tagged with: sql
has comment: http://stackoverflow.com/comment/35189583
has comment: http://stackoverflow.com/comment/35356257
has comment: http://stackoverflow.com/comment/35190601

http://stackoverflow.com/a/32829034
upvote count: 7
type: Answer
has comment: http://stackoverflow.com/comment/54157139
downvote count: 0
has body: EDIT: As pointed out in the comments, this is a much simpler version: Arrays.stream(stringArray).mapToInt(Integer::parseInt).toArray() This way we can skip the whole conversion to and from a list. I found another one line solution, but it's still pretty slow (takes about 100 times longer than a for cycle - tested on an array of 6000 0's) String[] stringArray = ... int[] out= Arrays.asList(stringArray).stream().map(Integer::parseInt).mapToInt(i-&gt;i).toArray(); What this does: Arrays.asList() converts the array to a List .stream converts it to a Stream (needed to perform a map) .map(Integer::parseInt) converts all the elements in the stream to Integers .mapToInt(i->i) converts all the Integers to ints (you don't have to do this if you only want Integers) .toArray() converts the Stream back to an array
score: 7
answers question: http://stackoverflow.com/q/23057549

http://stackoverflow.com/a/23083828
has body: try using public boolean addListener (EventListener listener) {...} method of Actor. Which version of libgdx are you using? I think actor does not have "setListener" method. Check your actor bounds. (width &amp; height)
has comment: http://stackoverflow.com/comment/35287784
answers question: http://stackoverflow.com/q/23074278
score: 0
type: Answer

http://stackoverflow.com/q/23128242
has title: Mapping multiple rows to 2 entities using JPA?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23129399
tagged with: jpa
downvote count: 0
score: 1
favorite count: 0
type: Question
has body: I have an entity "Project" with multiple "subTask" entities (List). Now normaly this would be simple and seperated in the DB and easy to map. But in this case I've only got 1 view. This means a row for every subTask with project data on every record. Example: projectId | projectName | subTaskId | subTaskName | .... --------------------------------------------------------- 1 | projectTest | 1 | subTaskTest | .... 1 | projectTest | 2 | subTaskTest2| .... I'm trying to find a way to map this using JPA but i'm unsure if this is at all possible and if so which would be the best way to do this. Has anyone tried this before? Could you point me in the right direction? EDIT: Some extra info: I need to create a webservice which can return Projects (including all subTasks). And it's ofcourse read only, no writing or editing.
has answer: http://stackoverflow.com/a/23129399
upvote count: 1
tagged with: oracle11g
answer count: 1
tagged with: java

http://stackoverflow.com/a/23054816
answers question: http://stackoverflow.com/q/23054054
type: Answer
has comment: http://stackoverflow.com/comment/35228737
score: 0
has body: As matlab imgradient() returns the gradient "magnitude" (i.e. sqrt(dx(x,y)² + dy(x,y)²) for each pixel with coordinates x,y), you may want to do something like: // 1) Get the horizontal gradient Mat kH = (cv::Mat_&lt;double&gt;(1,3) &lt;&lt; -1,0,1); // differential kernel in x Mat Dx; filter2D(image, Dx, -1, kH, cv::Point(-1,-1), 0); // 2) Get the vertical gradient Mat kV = (cv::Mat_&lt;double&gt;(3,1) &lt;&lt; -1,0,1); // differential kernel in y Mat Dy; filter2D(image, Dy, -1, kV, cv::Point(-1,-1), 0); // 3) Get sqrt(dx²+dy²) in each point for(int i=0; i&lt;Dx.rows; i++) for(int j=0; j&lt;Dx.cols; j++) Dmag.at&lt;double&gt;(i,j) = sqrt(pow(Dx.at&lt;double&gt;(i,j),2)+pow(Dy.at&lt;double&gt;(i,j),2)); It should get you what you you want. You can achieve a better performance by accessing gradient data instead of using .at(i,j) for each pixel. Hope it helps!

ajax
tags question: http://stackoverflow.com/q/23102862
tags question: http://stackoverflow.com/q/23026452
type: Tag
tags question: http://stackoverflow.com/q/22987082
tags question: http://stackoverflow.com/q/23055284
tags question: http://stackoverflow.com/q/23077099
tags question: http://stackoverflow.com/q/23118478
tags question: http://stackoverflow.com/q/23033150
tags question: http://stackoverflow.com/q/22989278
tags question: http://stackoverflow.com/q/22984284
tags question: http://stackoverflow.com/q/23032427
tag name: ajax

http://stackoverflow.com/q/23069291
type: AnsweredQuestion
upvote count: 1
possible better answer: http://stackoverflow.com/a/23082176
type: Question
has answer: http://stackoverflow.com/a/23082176
has comment: http://stackoverflow.com/comment/35256639
has body: I have a neo4j database containing some 120 million nodes. I am using the traversal framework to traverse through my graph and count the occurence of certain nodes. This works like a charm. Unfortunately, when running my code on my entire dataset I run out of memory. I already allocated 4gb to the Java VM, I think I commit my transcations (using the tx.success in the try-with-resources statement), but still I fill my heap quite fast. Below you can find my code: First I generate about 40 versions (these are root nodes). Then for each of these I look for all neighbouring child nodes. For each of these children (files) I check the entire subtree for the occurence of a certain node. I was under the understanding that using try(Transaction tx){ } automatically closed my transaction, but my heap is still full. This makes my query run slow from the second or third passthrough of versions and eventually it crashes. Am I misunderstanding something? Or is there something I else I can do? Collection&lt;Node&gt; versions; Collection&lt;Node&gt; files; Collection&lt;Node&gt; nodes; try ( Transaction ignored = db.beginTx() ) { versions = IteratorUtil.asCollection(db.traversalDescription().breadthFirst().relationships(ProjectRelations.HASVERSION, Direction.OUTGOING).evaluator(Evaluators.toDepth(1)).evaluator(Evaluators.excludeStartPosition()).traverse(db.getNodeById(0)).nodes()); ignored.success(); } for(Node v : versions){ int fors = 0; test = 0; try( Transaction tx = db.beginTx()){ files = IteratorUtil.asCollection(db.traversalDescription().breadthFirst().relationships(ProjectRelations.FILES, Direction.OUTGOING).evaluator(Evaluators.excludeStartPosition()).traverse(v).nodes()); tx.success(); } for( Node f : files ) { try (Transaction t = db.beginTx()){ int i = 0; for(Node node : db.traversalDescription().depthFirst().relationships(RelTypes.ISPARENTOF, Direction.OUTGOING).evaluator(Evaluators.excludeStartPosition()).evaluator(e).traverse(f).nodes()){ //do some stuff } t.success()…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35279808
has answer: http://stackoverflow.com/a/23220879
answer count: 2
downvote count: 0
tagged with: neo4j
favorite count: 0
has comment: http://stackoverflow.com/comment/35300137
has comment: http://stackoverflow.com/comment/35300175
has title: Neo4J Traversal Running out of memory
has comment: http://stackoverflow.com/comment/35300165
accepted answer: http://stackoverflow.com/a/23220879

http://stackoverflow.com/comment/45262880
has text: @cemo clicking that link doesn't take me to the search results...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23022244

http://stackoverflow.com/comment/35236443
comment on: http://stackoverflow.com/a/23059379
type: AnswerComment
has text: Ehhmmm: You misunderstood me! The output _was_ already correct. It _was_ in-order. Only the method was incorrect. Now you fixed the method, but also screw up the output completely. Now you have to change back your output to the initial form.
score: 0
type: Comment

http://stackoverflow.com/a/23021616
has comment: http://stackoverflow.com/comment/35168148
score: 1
has comment: http://stackoverflow.com/comment/35168194
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23021409
has comment: http://stackoverflow.com/comment/35168150
answers question: http://stackoverflow.com/q/23021409
type: Answer
has body: Based on your requirement, you have to use it like shown below, even in your IDE Scanner scan = new Scanner(System.in); int res; while (scan.hasNext()) { res = scan.nextInt(); if (res != 42) { System.out.println(res); } else { System.exit(0); } } Reason being what @jrbeverly mentioned above as his comment update 1: If you meant "stop printing the input" as the program must exit on encountering '42',you are good. But if your requirement is just to discard printing the number, and let the program run and accept the next number, then remove System.exit(0) . because System.exit(0) means to terminate the JVM from further execution of the program update 2: As @Giovanni Botta mentioned below, the exact solution is provided in the mentioned link, snippet adding here public class Main { public static void main (String[] args) throws java.lang.Exception { java.io.BufferedReader r = new java.io.BufferedReader (new java.io.InputStreamReader (System.in)); String s; while (!(s=r.readLine()).startsWith("42")) System.out.println(s); } }
has comment: http://stackoverflow.com/comment/35168276
upvote count: 1
has comment: http://stackoverflow.com/comment/35168432

http://stackoverflow.com/comment/35298166
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23030621
has text: Ditto on these comments - autowired should only appear in a @Configuration annotated class!
score: 0

http://stackoverflow.com/comment/35124256
has text: @MarkoTopolnik the stacktrace isn't complete, how do you know it's definitely not due to recursion?
comment on: http://stackoverflow.com/q/22996820
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35084628
type: Comment
has text: @Galaga: you would have less criticism if you show your work, show your attempt, and then ask specific questions about your attempt. That way you're guaranteed not to get criticisms. I appreciate my answer being accepted, but it really was a SWAG, and still I'm not comfortable with the vagueness of the question. I'm not really sure just what I answered.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22975465

http://stackoverflow.com/comment/35261431
type: Comment
has text: @AndreaF Can you please debug once and check the value of oldUser just before list.set(list.indexOf(oldUser), newUser); line?
comment on: http://stackoverflow.com/a/23073006
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35277674
type: QuestionComment
type: Comment
score: 0
has text: possible duplicate of [What is the ellipsis (...) for in this method signature?](http://stackoverflow.com/questions/2367398/what-is-the-ellipsis-for-in-this-method-signature)
comment on: http://stackoverflow.com/q/23082358

http://stackoverflow.com/q/23077222
tagged with: hibernate-search
tagged with: jpa
tagged with: lucene
score: 0
has title: Hibernate Search with Jpa 2 and lucene java.lang.ClassNotFoundException
has answer: http://stackoverflow.com/a/23077694
answer count: 1
has body: I am writing an application where i am trying to make an example on hibernate search with Lucene. In my database, i got an array named A_ROLE witch contains an ID field and a NAME field. Into this array i have store the data bellow: 1 - Agalloh 2 - Rorry Galaher 3 - Isis Isis My entity class looks like this: @Entity @Table(name="A_ROLE") @NamedQuery(name="ARole.findAll", query="SELECT a FROM ARole a") @Indexed public class ARole implements Serializable { private static final long serialVersionUID = 1L; @Id @DocumentId @SequenceGenerator(name="A_ROLE_ID_GENERATOR", sequenceName="A_ROLE_SEQ") @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="A_ROLE_ID_GENERATOR") @Column(unique=true, nullable=false, precision=38) @Field(index=Index.YES, analyze=Analyze.YES, store=Store.NO) //@NumericField private long id; @Column(length=50) @Field(index=Index.YES, analyze=Analyze.YES, store=Store.NO) private String name; //bi-directional many-to-many association to APermission @ManyToMany @JoinTable( name="A_ROLE_PERMISSION" , joinColumns={ @JoinColumn(name="ROLE_ID", nullable=false) } , inverseJoinColumns={ @JoinColumn(name="PERMISSION_ID", nullable=false) } ) private List&lt;APermission&gt; APermissions; //bi-directional many-to-many association to AUser @ManyToMany(mappedBy="ARoles") private List&lt;AUser&gt; AUsers; constructor, getters and setters and i have create an interface named DataBaseExchanges which contains a method lucinExample(). This method is responsible for the hibernate search and its implementation is being from the class bellow import ec.ep.europarl.appdif.db.entity.ARole; import ec.ep.europarl.appdif.service.DataBaseExchanges; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.hibernate.search.jpa.FullTextEntityManager; import org.hibernate.search.query.dsl.QueryBuilder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Se…
type: UnansweredQuestion
tagged with: spring
tagged with: java
has comment: http://stackoverflow.com/comment/35317754
type: Question

http://stackoverflow.com/comment/115437411
score: 0
has text: @Marv Well, all you really need is an `ObservableValue`, not a `Property`; so you could provide a very minimal implementation yourself if you need to optimize. It's still some overhead compared to a plain value, but barely any (e.g. for an immutable value your add/remove listeners could be no-ops and you just implement `getValue()` to return the value).
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23012266

heap-memory
tag name: heap-memory
type: Tag
tags question: http://stackoverflow.com/q/23110555
tags question: http://stackoverflow.com/q/23081565

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

http://stackoverflow.com/a/23074718
score: 1
type: AcceptedAnswer
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35271508
type: Answer
has comment: http://stackoverflow.com/comment/35270842
accepted answer of: http://stackoverflow.com/q/23074240
has body: I don't know how Servlet's and the like work however i can give you a rundown of what you need to do. In DemoServlet you need to take in the input of the Image_Name field and make that one of your parameters of FileUpload public static boolean processFile(String path, FileItemStream item, String fileName){ //Method Code } Because currently your processFile method is taking the name of the file from your FileItemStream. You need to change it from that to your actual fileName File savedFile = new File(f.getAbsolutePath() + File.separator + item.getName()); to File savedFile = new File(f.getAbsolutePath() + File.separator + fileName + ".png");
answers question: http://stackoverflow.com/q/23074240

http://stackoverflow.com/q/23080763
has comment: http://stackoverflow.com/comment/35274699
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23084465
has comment: http://stackoverflow.com/comment/35276117
has body: I have created Neo4j nodes and relatioships in java ,their values are coming from DB.When i am trying to display it on Neoclipse only first two nodes and their relationship is shown. Code: GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase("D://ws-NEO//Fade"); Transaction tx=graphDb.beginTx(); Connection conn = null; try{ conn=ConnectionFactory.getConnection(); Statement stat=conn.createStatement(); String sql="select * from Fade where App_Int_Id &lt; 19"; //Two records are there in result ResultSet rs=stat.executeQuery(sql); String n1 = "",n2="",rel="",type=""; while(rs.next()){ n1=rs.getString(2); n2=rs.getString(7); rel=rs.getString(3); type=rs.getString(4); Node first=graphDb.createNode(); first.setProperty("name", n1); Node second=graphDb.createNode(); second.setProperty("name", n2); RelationshipType KNOWS = DynamicRelationshipType.withName(rel); first.createRelationshipTo(second, KNOWS); } tx.success();} finally { tx.finish(); graphDb.shutdown(); conn.close(); } It outputs two records in console: node1 -- My App node2 -- GCAM relationship -- Cash focus Node1 ceated Node2 ceated relationship created ---------------------------------------------------------------------------------------------------- node1 -- My Test app node2 -- GCAM relationship -- Test Interface 11 Node1 ceated Node2 ceated relationship created ---------------------------------------------------------------------------------------------------- however only single record is displayed in Neoclipse ,others are missing . Plz guide.
tagged with: neoclipse
tagged with: neo4j
favorite count: 0
has comment: http://stackoverflow.com/comment/35276881
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35275853
score: 1
tagged with: java
has title: Nodes are missing in Neoclipse graph
type: Question
has answer: http://stackoverflow.com/a/23084465
has comment: http://stackoverflow.com/comment/35275272
has comment: http://stackoverflow.com/comment/35276675

http://stackoverflow.com/comment/35168422
type: Comment
type: QuestionComment
has text: and just output your arr[] when pos is 6
score: 0
comment on: http://stackoverflow.com/q/23021180

http://stackoverflow.com/q/23053041
has answer: http://stackoverflow.com/a/23629690
has comment: http://stackoverflow.com/comment/35225851
upvote count: 7
accepted answer: http://stackoverflow.com/a/23629690
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/35224826
has comment: http://stackoverflow.com/comment/35224478
has title: How to get Glass serial number programmatically
has comment: http://stackoverflow.com/comment/35225600
tagged with: java
has comment: http://stackoverflow.com/comment/35225682
has body: How can I get the 14 character alphanumeric(like LGGXXXXXXXXXXX) serial number of Google Glass programmatically?
has comment: http://stackoverflow.com/comment/35225469
type: Question
has comment: http://stackoverflow.com/comment/35225785
downvote count: 4
has comment: http://stackoverflow.com/comment/35225368
has comment: http://stackoverflow.com/comment/35224969
linked to: http://stackoverflow.com/q/2785485
has comment: http://stackoverflow.com/comment/35224879
tagged with: google-glass
has comment: http://stackoverflow.com/comment/38596158
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/35224978
favorite count: 0

http://stackoverflow.com/comment/35205719
comment on: http://stackoverflow.com/q/23042655
score: 0
has text: I have read the stacktrace before posting this and the array which is returned by the findEntries method is not null.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23041553
answers question: http://stackoverflow.com/q/23041480
score: 0
has body: Multiple problems 1.';' after if means eachElement = null gets executed for every iteration 2.eachElement = null will not have no affect on array it is a seperate reference, you should use old style for loop in this case and access array element using index. public void removeElement(String input){ for(String eachElement : dynamicString){ if(eachElement.equalsIgnoreCase(input)) ; eachElement = null; } } Other best option is to use ArrayList.
type: Answer
has comment: http://stackoverflow.com/comment/35203453

http://stackoverflow.com/q/23087136
has body: I need to validate an entity with the @Valid annotation. A field of my entity can take a set of numerical values and I thought to use the @Enumerated annotation. It may take the values ​​5, 10, 15, 20 and 30. Can I handle it with that annotation? How? Thanks! UPDATE I solved my issue in the following way: I created an annotation @ValidateIntegerSet @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD,ElementType.FIELD,ElementType.CONSTRUCTOR,ElementType.PARAMETER,ElementType.ANNOTATION_TYPE}) @Constraint(validatedBy=IntegerSet.class) public @interface ValidateIntegerSet { int[] acceptedValues(); String message() default "Il valore inserito non è tra quelli ammissibili"; Class&lt;?&gt;[] groups() default { }; Class&lt;? extends Payload&gt;[] payload() default { }; } I created an class IntegerSet to perform the validation public class IntegerSet implements ConstraintValidator&lt;ValidateIntegerSet, Integer&gt; { private List&lt;Integer&gt; valueList; @Override public void initialize(ValidateIntegerSet constraintAnnotation) { valueList = new ArrayList&lt;Integer&gt;(); for(int val : constraintAnnotation.acceptedValues()) { valueList.add(Integer.valueOf(val)); } } @Override public boolean isValid(Integer value, ConstraintValidatorContext context) { if(!valueList.contains(value)) { return false; } return true; } } I have used the new annotation in the following way: @ValidateIntegerSet(acceptedValues={5, 10, 15, 20, 30})
answer count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/23087198
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35286080
tagged with: java
tagged with: hibernate
tagged with: annotations
has title: Validate field with @Enumerated annotation
type: Question
accepted answer: http://stackoverflow.com/a/23087198
score: 0

http://stackoverflow.com/comment/35314519
has text: You can always use JNI and bind Java to C code
comment on: http://stackoverflow.com/q/23103297
type: Comment
score: 2
type: QuestionComment

http://stackoverflow.com/a/22981505
type: Answer
has comment: http://stackoverflow.com/comment/35095034
score: 1
upvote count: 1
has body: Right click on the file, choose Restore from Local History. That is the only option as far as i know. Give it a try. As @greg-449 said - Replace With &gt; Local History.. is the perfect option
downvote count: 0
answers question: http://stackoverflow.com/q/22981405

http://stackoverflow.com/q/23058143
has answer: http://stackoverflow.com/a/23058265
has body: Why is the public visibility modifier not allowed as an entity field access type.
tagged with: java
has title: public visibillity modifier and jpa
upvote count: 0
answer count: 1
tagged with: jpa
linked to: http://stackoverflow.com/q/2040836
favorite count: 0
accepted answer: http://stackoverflow.com/a/23058265
duplicate of: http://stackoverflow.com/q/2040836
type: AnsweredQuestion
downvote count: 3
score: -3
type: Question

http://stackoverflow.com/q/22971222
has answer: http://stackoverflow.com/a/22971981
has comment: http://stackoverflow.com/comment/35077538
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35077167
has comment: http://stackoverflow.com/comment/35076606
has comment: http://stackoverflow.com/comment/35077585
has title: Multiple Tasks JavaFX
tagged with: java
tagged with: javafx
type: Question
tagged with: task
has answer: http://stackoverflow.com/a/22973012
has body: I've been searching for some time now on how to create multiple tasks and have them run one after the other. Here is the java code: public class Main extends Application { DropShadow shadow = new DropShadow(); Button button = new Button("Start"); Task&lt;Integer&gt; task; Task&lt;Integer&gt; task2; Label label1 = new Label("Status: NOT STARTED"); ProgressBar bar = new ProgressBar(0); ProgressIndicator pi = new ProgressIndicator(0); Thread th = new Thread(); public void start(Stage stage) { task = new Task&lt;Integer&gt;() { protected Integer call() throws Exception { int iterations; for (iterations = 0; iterations &lt; 1001; iterations++) { if (isCancelled()) { updateMessage("Cancelled"); break; } updateProgress(iterations, 1001); updateMessage("Test"); try { Thread.sleep(10); } catch (InterruptedException interrupted) { if (isCancelled()) { //updateMessage("Cancelled"); break; } } } return iterations; } }; task2 = new Task&lt;Integer&gt;() { protected Integer call() throws Exception { int iterations; for (iterations = 0; iterations &lt; 1001; iterations++) { if (isCancelled()) { updateMessage("Cancelled"); break; } updateProgress(iterations, 1001); updateMessage("Test"); try { Thread.sleep(10); } catch (InterruptedException interrupted) { if (isCancelled()) { //updateMessage("Cancelled"); break; } } } return iterations; } }; task.setOnSucceeded(new EventHandler&lt;WorkerStateEvent&gt;(){ public void handle(WorkerStateEvent arg0) { label1.setText("Done"); new Thread(task2).start(); } }); Group root = new Group(); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("Progress Controls"); final Slider slider = new Slider(); slider.setMin(0); slider.setMax(50); bar.progressProperty().bind(task.progressProperty()); pi.progressProperty().bind(task.progressProperty()); label1.textProperty().bind(task.messageProperty()); button.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler&lt;MouseEvent&gt;() { public void handle(MouseEvent e) { button.setEffec…
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/16368793
has comment: http://stackoverflow.com/comment/35076845

http://stackoverflow.com/q/23044889
tagged with: maven
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35212211
has body: I am using form based authentication in a java maven web project that I am building. The application is deployed to a tomcat web server, so I added a few users to the users file. When I try to access a protected resource, I get the login page, as expected. However, when I enter the credentials, I am taken to the form-error page. Is that usually indicative of the user not being correctly declared in the tomcat-users.xml file? I also have declared a 403 error page, so that I can distinguish between an authentication and an authorization issue. My tomcat-users file is pretty thin, but looks like: <?xml version='1.0' encoding='utf-8'?> <role rolename="administrator"/> <user username="bill" password="billpw" roles="administrator"/> I am trying to login with bill, and I'm not sure what the problem is. Any ideas what could be going on? I've tried resetting the server, no luck. Here is my web.xml file: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> SecureAC /WEB-INF/admin/sec.jsp SecureAC /admin/sec FORM /WEB-INF/login/login.html /WEB-INF/login/login-error.html <web-resource-collection> Administrative Resources /admin/* </web-resource-collection> administrator CONFIDENTIAL administrator employee 403 /WEB-INF/error/403error.jsp
tagged with: authentication
type: Question
has comment: http://stackoverflow.com/comment/35211917
has comment: http://stackoverflow.com/comment/35212828
linked to: http://stackoverflow.com/q/11382159
linked to: http://stackoverflow.com/q/9979593
score: 0
has title: Form based authentication configuration issue
tagged with: tomcat
has comment: http://stackoverflow.com/comment/35213872
has comment: http://stackoverflow.com/comment/35214547
type: UnansweredQuestion

http://stackoverflow.com/comment/35213261
has text: You're probably using a TreeSet class which is not java.util.TreeSet, but another TreeSet class, in another package, that doesn't implement Set. Check your imports. If you have defined your own TreeSet class, then it has to implement Set for the above code to make sense.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23046601
type: Comment

http://stackoverflow.com/comment/35323931
type: Comment
type: QuestionComment
has text: As long as that ID appears **anywhere** the end user will be able to see it.
score: 0
comment on: http://stackoverflow.com/q/23102862

http://stackoverflow.com/a/23012046
score: 9
accepted answer of: http://stackoverflow.com/q/23012022
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23012022
has body: Local variables and parameters cannot have public or private modifier. You can only give final to them. Not even static can be used.
upvote count: 9

http://stackoverflow.com/comment/35202998
score: 0
type: Comment
type: QuestionComment
has text: google search for a example. http://www.chrisumbel.com/article/android_textview_rich_text_spannablestring
comment on: http://stackoverflow.com/q/23041265

http://stackoverflow.com/a/22992536
downvote count: 0
has body: \\b(\\w+) \\1\\b matches a word, a space, and the same word again, flanked by word boundaries. For instance, it would match "a a" in "a a ", but would not match anything in "aa-", "aab", or "a ab". \\b(\\w+)\\1\\b matches a word, and the same word again, flanked by word boundaries. For instance, it would match "aa", in "aa-" but would not match anything in "aab" or "a a". \\b(\\w+) \\1 matches a word, a space, and the same word again, but only needs a word boundary at the start. For instance, it would match "a a" in "a ab", but nothing in "aa" or "aab"
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22992260
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22992260
score: 1

jsf
tags question: http://stackoverflow.com/q/23015634
type: Tag
tags question: http://stackoverflow.com/q/23126618
tags question: http://stackoverflow.com/q/23119980
tags question: http://stackoverflow.com/q/23031746
tags question: http://stackoverflow.com/q/22981167
tags question: http://stackoverflow.com/q/22982884
tags question: http://stackoverflow.com/q/23014527
tags question: http://stackoverflow.com/q/23061172
tags question: http://stackoverflow.com/q/23018519
tags question: http://stackoverflow.com/q/23043692
tags question: http://stackoverflow.com/q/23105498
tags question: http://stackoverflow.com/q/23082769
tags question: http://stackoverflow.com/q/23042347
tags question: http://stackoverflow.com/q/23094158
tags question: http://stackoverflow.com/q/23074558
tags question: http://stackoverflow.com/q/23078684
tags question: http://stackoverflow.com/q/22980359
tags question: http://stackoverflow.com/q/23107470
tags question: http://stackoverflow.com/q/23126916
tags question: http://stackoverflow.com/q/23049694
tags question: http://stackoverflow.com/q/22980579
tags question: http://stackoverflow.com/q/23007635
tags question: http://stackoverflow.com/q/23103952
tags question: http://stackoverflow.com/q/23083558
tags question: http://stackoverflow.com/q/23006444
tag name: jsf
tags question: http://stackoverflow.com/q/23026630
tags question: http://stackoverflow.com/q/23084344
tags question: http://stackoverflow.com/q/23016853
tags question: http://stackoverflow.com/q/22996301
tags question: http://stackoverflow.com/q/23035248
tags question: http://stackoverflow.com/q/22992225
tags question: http://stackoverflow.com/q/22986292
tags question: http://stackoverflow.com/q/23042675
tags question: http://stackoverflow.com/q/22982635
tags question: http://stackoverflow.com/q/23031555
tags question: http://stackoverflow.com/q/22981586
tags question: http://stackoverflow.com/q/23022912
tags question: http://stackoverflow.com/q/23071516
tags question: http://stackoverflow.com/q/23076242
tags question: http://stackoverflow.com/q/22985468
tags question: http://stackoverflow.com/q/23090405
tags question: http://stackoverflow.com/q/22973548
tags question: http://stackoverflow.com/q/22983169

http://stackoverflow.com/q/23012639
favorite count: 0
has comment: http://stackoverflow.com/comment/35151159
has answer: http://stackoverflow.com/a/23012967
has title: OnSensorChanged Thread
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35151294
tagged with: android-sensors
has comment: http://stackoverflow.com/comment/35152205
tagged with: service
score: 1
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35152783
upvote count: 1
has comment: http://stackoverflow.com/comment/35152966
type: Question
has comment: http://stackoverflow.com/comment/35151103
has comment: http://stackoverflow.com/comment/35152425
has answer: http://stackoverflow.com/a/23020576
tagged with: java
answer count: 2
downvote count: 0
has body: I need to do a lot of work in method onSensorChanged so my App is freezing. I tryied to create thread in method OnSensorChanged. It helps a little but creating new thread manytimes per secound is not the best way I think. What should I do? I created my own sensorService which extends Service and implements SensorEventListener. @Override public void onSensorChanged(SensorEvent event) { Thread w = new Thread(new Worker(event)); w.start(); } class Worker implements Runnable{ SensorEvent event; Worker(SensorEvent event){ this.event=event; } @Override public void run() { if(event.sensor.getType()==Sensor.TYPE_ACCELEROMETER){ accelerometerData(event); } if(event.sensor.getType()==Sensor.TYPE_GRAVITY){ gravityData(event); } if(event.sensor.getType()==Sensor.TYPE_LINEAR_ACCELERATION){ linearAccelerometerData(event); } } private void linearAccelerometerData(SensorEvent event) { expensiveWork(); Intent intent = new Intent("SensorService"); intent.putExtra("data",data) LocalBroadcastManager.getInstance(SensorService.this).sendBroadcast(intent); } private void accelerometerData(SensorEvent event){ expensiveWork2(); Intent intent = new Intent("SensorService"); intent.putExtra("data",data) LocalBroadcastManager.getInstance(SensorService.this).sendBroadcast(intent); } } Can I start service on its own thread? Or create just one thread and give him the work?

http://stackoverflow.com/a/48148175
has body: Use the phase "process-resources" with the goal "resources" (or mekondelta proposition of using "prepare-package") Set the output directory to ${basedir}/target/${project.artifactId}-${project.version} Here's a complete example <build> <plugins> maven-resources-plugin copy-resources process-resources resources ${basedir}/target/${project.artifactId}-${project.version} ${project.parent.basedir}/ejb/src/main/resources/META-INF ...
answers question: http://stackoverflow.com/q/23026183
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/35091731
type: AnswerComment
comment on: http://stackoverflow.com/a/22978328
score: 0
has text: @EJB Can you name the book?
type: Comment

http://stackoverflow.com/comment/35295690
score: 0
type: Comment
type: QuestionComment
has text: use `POST` instead of `GET`
comment on: http://stackoverflow.com/q/23092124

http://stackoverflow.com/comment/35306540
has text: retry as mentioned above
comment on: http://stackoverflow.com/a/23098096
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23096881
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35304412
has comment: http://stackoverflow.com/comment/35304454
has answer: http://stackoverflow.com/a/23096984
tagged with: arraylist
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has comment: http://stackoverflow.com/comment/35304387
tagged with: parsing
has body: I'm creating a web crawler and I just read the html of a page and stored into into a string. I then found all of the anchor tags inside the html and stored them into an ArrayList called anchorTags. I now need to get ride of the "a href=" part of each string in the array list. To do this I wrote the following code; however, for some reason I am getting an outofbounds exception. Please note that I need to do this using loops, arraylists only: ArrayList&lt;String&gt; parsedLinks = new ArrayList&lt;String&gt;(); String storeHTML = ""; for(int i = 0; i &lt; anchorTags.size(); i++) { String anchorTag = anchorTags.get(i); int hrefIndex = anchorTag.indexOf("a href="); if (hrefIndex &gt; -1) { int beginQuote = anchorTag.indexOf("\"", hrefIndex); int EndQuote = anchorTag.indexOf("\"", beginQuote +1); if (EndQuote &gt; beginQuote) { storeHTML.substring(beginQuote +1, EndQuote); } } } parsedLinks.add(storeHTML); System.out.println(parsedLinks); return parsedLinks; }
accepted answer: http://stackoverflow.com/a/23096984
has comment: http://stackoverflow.com/comment/35304429
has title: Parse anchor tags in java string
type: AnsweredQuestion

http://stackoverflow.com/comment/35348902
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23121585
has text: The error is in VehicleSearch one = new VehicleSearch ();. one must be a VehicleClass. (Not a VehicleSearch).

http://stackoverflow.com/a/25578221
has body: Admittedly, I've been struggling with the seeming vacuum of JavaFX 3D resources, and the lack of thoroughness in the few resources that I've found. However, I've come up with a satisfying guess. The transformations are split and nested so that they are performed in order. Specifically, each Node (and every class you work with is a subclass of Node) has its own list of transformations. The Group class is a special subclass of Node designed, as far as I can tell, to be a general container of other JavaFX Nodes. The Oracle documentation for Group says: Any transform, effect, or state applied to a Group will be applied to all children of that group. As a result, an instance of XForm (a Group subclass that bundles all of the possible transformations together) inside of another XForm will apply the outer transformation and then the inner transformation to anything on the inside. In this case the transformations aren't named very well, but cameraXform is used exclusively for x/y rotation, cameraXform2 is used exclusively for x/y translation, and cameraXform3 is used exclusively for z rotation*. The order (and by extension, the nesting) is important because rotations are performed about the axes; translating first will cause the scene to react in unintuitive ways to the user's input. *The z rotation (which is set exactly once in the sample app), as far as I can tell, is used so that the y axis is pointed up instead of the JavaFX default of y down. This allows the shapes to be added in the commonly accepted x/y/z axis orientation, while allowing them to be rendered in JavaFX's own orientation.
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23015752
type: Answer
answers question: http://stackoverflow.com/q/23015752
upvote count: 5

http://stackoverflow.com/comment/35163229
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23019070
has text: I need to keep the city, state, and zip in the same string, otherwise I'd have to have them enter three different variables. Is there a way I can do that but keep the same format?
score: 0

http://stackoverflow.com/comment/35189496
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23033481
has text: I wrote that just to have an ideea of what should be there(the number of clients which is stored in an array), I don't know how to do that....

http://stackoverflow.com/comment/35885761
type: QuestionComment
has text: I figured out by using webservices of SSRS. ReportExecutionServiceSoapStub and created a method which passed ReportExecutionServiceSoapStub and throws SOAPException. Used axis, axis-wsdl4j to get webservice xml and convert to java. Iterated thru parameters in application's DB and sent it via java to SSRS.
score: 0
comment on: http://stackoverflow.com/q/23038933
type: Comment

http://stackoverflow.com/a/23045446
answers question: http://stackoverflow.com/q/23045361
has body: I suggest you to use Map in place of List in this situation where Id is treated as key and POJO as its value. HashMap is more faster than List in search. Sample code: class Student { private String id; private String name; private String program; // getter setter } class Course { private String id; private String name; private int creditHours; // getter setter } class StudentCourses { private String studentId; private String courseId; // getter setter } Map&lt;String, Student&gt; students = new HashMap&lt;String, Student&gt;(); Map&lt;String, Course&gt; courses = new HashMap&lt;String, Course&gt;();
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35210666
upvote count: 1
has comment: http://stackoverflow.com/comment/35210607
has comment: http://stackoverflow.com/comment/35210787

http://stackoverflow.com/q/23116086
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35337934
possible better answer: http://stackoverflow.com/a/23116685
tagged with: statistics
answer count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/23116690
has title: Using two streams in Java lambda to compute covariance
favorite count: 0
has body: Let's say I have two arrays of double. I've been experimenting with Stream from Java 8. I think I've understood the main ideas but then I realised that I'm not sure how to manipulate two Streams at the same time. For example, I want to calculate the covariance of both arrays. public class foo { public static double mean(double[] xs) { return Arrays.stream(xs).average().getAsDouble(); } public static void main(String[] args) { double[] xs = {1, 2, 3, 4, 5, 6, 7, 8, 9}; double[] ys = {1517.93, 1757.78, 1981.1, 2215.73, 2942.66, 3558.32, 4063.91, 4521.16, 5101.76, 5234.12}; System.out.println("Mean of xs: " + mean(xs)); double xs_sumDeviation = Arrays.stream(xs) .boxed() .mapToDouble(d -&gt; d.doubleValue() - mean(xs)) .sum(); // Covariance double covXY = Arrays.stream(xs, ys) .mapToDouble(x,y -&gt; { double numerator = (x-mean(xs)* (y-mean(ys); double denominator = Math.sqrt((x-mean(xs)* (x-mean(xs)); return numerator / denominator; }) .sum(); } } Thank you for suggestions. Attempt 1. public static double covariance(double[] xs, double[] ys) { double xmean = mean(xs); double ymean = mean(ys); double numerator = IntStream.range(0, Math.min(xs.length, ys.length)) .parallel() .mapToDouble(i -&gt; (xs[i] - xmean) * (ys[i] - ymean)) .sum(); double denominator = Math.sqrt(IntStream.range(0, xs.length) .parallel() .mapToDouble(i -&gt; (xs[i] - xmean) * (xs[i] - xmean)) .sum()); return numerator / denominator;
has answer: http://stackoverflow.com/a/23116685
has answer: http://stackoverflow.com/a/23116690
tagged with: lambda
tagged with: java-8
has comment: http://stackoverflow.com/comment/35341064
type: AnsweredQuestion
downvote count: 0
tagged with: java-stream

http://stackoverflow.com/q/22979509
score: -1
tagged with: arraylist
answer count: 2
linked to: http://stackoverflow.com/q/5533368
favorite count: 0
has answer: http://stackoverflow.com/a/22979649
type: UnansweredQuestion
downvote count: 2
tagged with: android
upvote count: 1
has answer: http://stackoverflow.com/a/22980038
has title: Error Type mismatch: cannot convert
tagged with: java
has comment: http://stackoverflow.com/comment/35091781
has body: Help me please. I am a student. I have abstract class A. Class A1 extends A. If I write ArrayList&lt;A&gt; a = ArrayList&lt;A1&gt; a1 I get error Type mismatch: cannot convert from ArrayList&lt;A1&gt; to ArrayList&lt;A&gt;
type: Question

http://stackoverflow.com/comment/35091597
has text: write "Cannot cast from ArrayList<A1> to ArrayList"
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22979649

http://stackoverflow.com/q/23071593
has title: Join Two Sphere with a Cylinder using JavaFX8 3D
has answer: http://stackoverflow.com/a/23072019
type: Question
linked to: http://stackoverflow.com/q/16975412
has answer: http://stackoverflow.com/a/39540550
score: 3
has body: Please I want to draw a 3D graph using JavaFX 8 (3D). I already know some basics of 3D like draw sphere, firstly coloring the sphere and add shadow, then some light and initialisation of the sphere. My problem is I want to join the spheres by using a cylinder, but if there are for example 2 cylinders between two spheres it must be an arc or curved cylinder (I don't know if this is possible). I already tried that but nothing appears, even if something appears it's just a cylinder (not like a line just small). Another problem, I want to know how the rotation can help in such a situation. And last question, is it possible to make a scrollbar or just using event of Zoom? Thanks. the picture taken from : Here This is my code: import java.util.ArrayList; import java.util.Random; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.PerspectiveCamera; import javafx.scene.PointLight; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.paint.PhongMaterial; import javafx.scene.shape.CullFace; import javafx.scene.shape.DrawMode; import javafx.scene.shape.Sphere; import javafx.stage.Stage; public class Graphe3D extends Application { Group root; PhongMaterial material; ArrayList&lt;Sphere&gt; sphere; @Override public void start(Stage primaryStage) { sphere=new ArrayList&lt;&gt;(); root=new Group(); material= new PhongMaterial(); for(int i=0;i&lt;3;i++){ sphere.add(new Sphere(50)); //Sphere Color material.setDiffuseColor(Color.RED); //Shadow Color material.setSpecularColor(Color.rgb(30, 30, 30)); //Init Sphere sphere.get(i).setMaterial(material); sphere.get(i).setTranslateX(new Random().nextInt(600));//set location X,Y and Z sphere.get(i).setTranslateY(new Random().nextInt(600)); sphere.get(i).setTranslateZ(50); // ? sphere.get(i).setDrawMode(DrawMode.FILL); sphere.get(i).setCullFace(CullFace.BACK);// ? //Create Light PointLight pointLight = new PointLight(Color.ANTIQUEWHITE); pointLight.setTranslateX(800); pointLight.se…
possible better answer: http://stackoverflow.com/a/39540550
answer count: 2
tagged with: 3d
downvote count: 0
accepted answer: http://stackoverflow.com/a/23072019
favorite count: 0
tagged with: javafx-2
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: javafx

http://stackoverflow.com/a/23104534
answers question: http://stackoverflow.com/q/23091914
score: 2
downvote count: 0
has body: The setting grails.tomcat.jvmArgs is only used for the development time Tomcat instance started by grails run-app, not for when you deploy to an external Tomcat instance. In that case the settings can be customized using CATALINA_OPTS export CATALINA_OPTS=”-Xms256m -Xmx512m” These settings apply to all apps deployed to Tomcat, so if you have 3 Grails apps you need to set sufficient memory for the three.
upvote count: 2
type: Answer

http://stackoverflow.com/comment/35282064
comment on: http://stackoverflow.com/q/23083654
has text: What does GPG stand for?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35138109
has text: Reading the architecture document of your favorite ORM framework should help. I hate ORM frameworks.
comment on: http://stackoverflow.com/q/23005593
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22968595
has body: I started learn javafx yesterday for my project. I trying fast learn taking data from database to javafx. Today I take from example how to bind query from db to tableview http://blog.ngopal.com.np/2011/10/19/dyanmic-tableview-data-from-database/ This is working nice and now I looking why on my function public void buildData(){ Connection c ; data = FXCollections.observableArrayList(); try{ c = DBConnect.connect(); String SQL = "SELECT * from tabela"; ResultSet rs = c.createStatement().executeQuery(SQL); for(int i=0 ; i&lt;rs.getMetaData().getColumnCount(); i++) { //We are using non property style for making dynamic table final int j = i; TableColumn col = new TableColumn(rs.getMetaData().getColumnName(i+1)); col.setCellValueFactory(new Callback&lt;CellDataFeatures&lt;ObservableList,String&gt;,ObservableValue&lt;String&gt;&gt;() { public ObservableValue&lt;String&gt; call(CellDataFeatures&lt;ObservableList, String&gt; param) { return new SimpleStringProperty(param.getValue().get(j).toString()); } }); t.getColumns().addAll(col); System.out.println("Column ["+i+"] "); } /******************************** * Data added to ObservableList * ********************************/ while(rs.next()){ //Iterate Row ObservableList&lt;String&gt; row = FXCollections.observableArrayList(); for(int i=1 ; i&lt;=rs.getMetaData().getColumnCount(); i++) { //Iterate Column row.add(rs.getString(i)); } System.out.println("Row [1] added "+row ); data.add(row); } //FINALLY ADDED TO TableView t.setItems(data); }catch(Exception e){ e.printStackTrace(); System.out.println("Error on Building Data"); } } can't edit cells after click. What is what change I need?
has answer: http://stackoverflow.com/a/23063827
type: AnsweredQuestion
tagged with: java
tagged with: javafx
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23063827
has comment: http://stackoverflow.com/comment/35073941
has title: Tableview how to edit cells
has comment: http://stackoverflow.com/comment/35074068

http://stackoverflow.com/comment/35222250
type: QuestionComment
has text: Well...sorta. Overall, my goal is to keep each object separate and change all 3 objects balance and then print out each objects balance using my toString method.
comment on: http://stackoverflow.com/q/23051709
score: 0
type: Comment

http://stackoverflow.com/a/23084465
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Neoclipse seems to have a default traversal depth of 1, giving you the result that you saw. But the traversal depth is adjustable, and neoclipse will remember the last-used traversal depth the next time it starts up. To increment the traversal depth, you can click on the green '+' button in the toolbar at the top of the graph pane, and to decrement it you click on the green '-' button. You can also change the starting node (for traversal purposes) by clicking on it. And double-clicking on a node causes all its neighbor nodes to display. There is a lot more functionality, but you need to read the help documentation and play around with the tool to discover all its capabilities.
score: 1
answers question: http://stackoverflow.com/q/23080763
accepted answer of: http://stackoverflow.com/q/23080763
has comment: http://stackoverflow.com/comment/35317713

http://stackoverflow.com/a/23129597
answers question: http://stackoverflow.com/q/23128728
score: 0
type: Answer
has body: The point of private is that "outside" classes should not be able to see private variables. But A and B are both part of the same class, or are nested within each other, so they can access each others private members. So this will work: public class A { private void a() { int bVal = this.new B().val; //! Accessing B private } class B { A a = new A(); private int val = 10; public void b() { a.a(); // !! Accessing A private } } BUT, this will fail, even if both A and B are in the same file but not within each other: class A { private void a() {} } class B extends A { A a = new A(); public void b() { a.a(); // can't see even if B extends A } }

http://stackoverflow.com/q/23094117
has comment: http://stackoverflow.com/comment/35299842
has answer: http://stackoverflow.com/a/23121314
score: 0
has comment: http://stackoverflow.com/comment/35346183
has body: I have a java application and want to create a runnable JAR file. I cannot see the runnable JAR file option on export dialog box in my eclipse. Do I need to download something or change the setting in order to see this option? If so, would you tell me how to do it. thanks in advance
answer count: 1
has comment: http://stackoverflow.com/comment/35309094
accepted answer: http://stackoverflow.com/a/23121314
has comment: http://stackoverflow.com/comment/35300929
has comment: http://stackoverflow.com/comment/35300947
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/12805059
tagged with: eclipse
has title: No Runnable JAR file option on the export window in eclipse
has comment: http://stackoverflow.com/comment/35299673
type: Question
has comment: http://stackoverflow.com/comment/35314802

http://stackoverflow.com/a/23132091
answers question: http://stackoverflow.com/q/23129011
score: 0
has comment: http://stackoverflow.com/comment/35366969
has comment: http://stackoverflow.com/comment/35401687
has comment: http://stackoverflow.com/comment/35367794
has comment: http://stackoverflow.com/comment/35396453
has body: If this is the ip address of your router and you are connecting your android mobile to the router through wifi , then you have to port forward the port 1109 in your router to your mobile. If this is the ip address of your android mobile connected through data connection , then there will be some restrictions on your data provider blocking ports for security . 46.114.153.58 is this a static ip address or dynamic ? If its a dynamic ip address , first check the availability of the ip address by pinging it.
has comment: http://stackoverflow.com/comment/35368895
type: Answer
has comment: http://stackoverflow.com/comment/35397381
has comment: http://stackoverflow.com/comment/35399223
has comment: http://stackoverflow.com/comment/35398943
has comment: http://stackoverflow.com/comment/35404070
has comment: http://stackoverflow.com/comment/35402593

google-cloud-datastore
tags question: http://stackoverflow.com/q/23003381
tag name: google-cloud-datastore
tags question: http://stackoverflow.com/q/23084910
type: Tag
tags question: http://stackoverflow.com/q/23043117
tags question: http://stackoverflow.com/q/23121614
tags question: http://stackoverflow.com/q/23072732

http://stackoverflow.com/comment/35254103
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23068932
has text: @Kakarot I made a mistake when I copied my code, now you can see where I define it
score: 0

http://stackoverflow.com/comment/35353952
comment on: http://stackoverflow.com/a/23125026
type: Comment
has text: @KugathasanAbimaran, suppose if `t3!=0` then it will not check condition for `t4` and `t5`.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23068623
type: Question
has body: I have this program that requests the user to enter a time in the format of XX:XX, where X is a digit. It accepts this as a string. I'm trying to figure out how I can take this string, separate the first 2 digits into a substring, convert them to integers, and assign them to the "hours" instance variable. Then to do the same for the following 2 digits as "minutes". But how can I separate a single string with specific index values. Is that even possible?
has answer: http://stackoverflow.com/a/23068672
tagged with: substring
answer count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/23068683
score: 1
tagged with: string
favorite count: 0
has title: Separating a string into substrings, converting them to ints, and assigning them to an instance variable
possible better answer: http://stackoverflow.com/a/23068696
has answer: http://stackoverflow.com/a/23068696
type: AnsweredQuestion
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23068683

http://stackoverflow.com/q/23082522
has comment: http://stackoverflow.com/comment/35283016
has comment: http://stackoverflow.com/comment/35284231
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35340830
has answer: http://stackoverflow.com/a/23194947
answer count: 3
linked to: http://stackoverflow.com/q/730359
downvote count: 0
tagged with: utf-8
has body: I receive data from a external Microsoft SQL 2008 database (I make queries with MyBatis). The data is encoded as "Windows-1252". I have tried to re-encode to UTF-8: String textoFormado = ...value from MyBatis... ; String s = new String(textoFormado.getBytes("Windows-1252"), "UTF-8"); Almost the whole string is correctly decoded, but some letters with accents are not. For example: I received this: Ã�vila The code above makes: �?vila I expected: Ávila
favorite count: 0
linked to: http://stackoverflow.com/q/3040597
possible better answer: http://stackoverflow.com/a/23082716
has comment: http://stackoverflow.com/comment/35277889
score: 6
accepted answer: http://stackoverflow.com/a/23194947
has answer: http://stackoverflow.com/a/68383103
has answer: http://stackoverflow.com/a/23082716
upvote count: 6
has title: Java convert Windows-1252 to UTF-8, some letters are wrong
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35281750
tagged with: windows-1252

http://stackoverflow.com/comment/35358321
has text: @WASasquatch does it mean every password in such case uses the same salt value ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23127392

http://stackoverflow.com/q/22995541
tagged with: mongodb
answer count: 1
downvote count: 0
upvote count: 3
tagged with: groovy
has body: I am having difficulty connecting to mongo v2.6 using x509 certificates for authentication from Java/Groovy. I have built mongo with ssl and feel I have it configured correctly. Our project has two applications that connect to Mongo - one written in NodeJS and one written in Java/Groovy. The NodeJS project is successfully able to authenticate using an X509 Certificate and query. Additionally, I am able to shell into mongo by specifying ssl and providing the PEM file on the command line. However, I am unable to connect to mongo using the Java Mongo Driver. I would greatly appreciate some assistance and here are the steps I have taken thus far: Building MongoDB 2.6 to run with ssl using SCONS: I have downloaded the 2.6 release of MongoDB from the mongodb github page Then, built it with scons to include ssl scons --64 --dd --ssl all scons --ssl --prefix=/opt/mongo install Generating Keys for Mongo:: I generated the following keys/certs openssl req -new -newkey rsa:1024 -nodes -out myMongo.req -keyout myMongo.key -subj "/C=US/ST=myState/CN=myMongo/OU=myUnit/L=myLocation" -days 36500 openssl x509 -CA myCA.pem -CAkey myCa.key -CAserial myCa.srl -req -in myMongo.req -out myMongo.pem -days 36500 This gives me the following files: myMongo.key ( Containing a private key ) myMongo.pem ( Containing a certificate ) myMongo.req ( Containing a certificate request ) (I'm not sure if I need this one, and haven't used it yet ) In compliance with the mongo instructions, I concatenated the key and certificate together into 1 file cat myMongo.key myMongo.pem &gt; combined.pem Following the mongo instructions for x509 configuration: http://docs.mongodb.org/manual/tutorial/configure-x509/ openssl x509 -in combined.pem -inform PEM -subject -nameopt RFC2253 which gives me the subject: "C=US,ST=myState,CN=myMongo,OU=myUnit,L=myLocation" I then add that subject to the users on the database db.getSiblingDB("$external").runCommand( { createUser: "C=US,ST=myState,CN=myMongo,OU=myUnit,L=myLocatio…
has comment: http://stackoverflow.com/comment/38753137
has answer: http://stackoverflow.com/a/23000190
favorite count: 0
has title: Trouble authenticating against MongoDB v2.6 with x509 certificates using mongo-java-driver
type: UnansweredQuestion
tagged with: x509
score: 3
tagged with: java
tagged with: ssl
type: Question

http://stackoverflow.com/a/23057694
score: 2
has comment: http://stackoverflow.com/comment/35237995
answers question: http://stackoverflow.com/q/23055616
has comment: http://stackoverflow.com/comment/35233333
accepted answer of: http://stackoverflow.com/q/23055616
type: AcceptedAnswer
downvote count: 0
has body: Use full hostname: <-- * in front of hostname (*auth) is optional --> <-- it allows for subdomain (version) mapping --> *auth.hostname.com/* auth You should also consider configuring the subdomain wildcard mapping: then GAE will allow you to map to particular module versions, e.g. auth.hostname.com -> auth module, default version v1.auth.hostname.com -> auth module, version v1 This is useful for using SSL during development, when you want to directly address particular version of a module.
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/35236892

split
tags question: http://stackoverflow.com/q/23100683
tags question: http://stackoverflow.com/q/23055505
tags question: http://stackoverflow.com/q/23106842
tags question: http://stackoverflow.com/q/23072872
tags question: http://stackoverflow.com/q/22985543
tag name: split
tags question: http://stackoverflow.com/q/22996122
tags question: http://stackoverflow.com/q/23033408
tags question: http://stackoverflow.com/q/22994831
tags question: http://stackoverflow.com/q/23080540
tags question: http://stackoverflow.com/q/23033737
tags question: http://stackoverflow.com/q/23099950
tags question: http://stackoverflow.com/q/23115885
tags question: http://stackoverflow.com/q/22999122
tags question: http://stackoverflow.com/q/23096091
tags question: http://stackoverflow.com/q/23008717
tags question: http://stackoverflow.com/q/22994497
tags question: http://stackoverflow.com/q/23072013
type: Tag
tags question: http://stackoverflow.com/q/22993727

http://stackoverflow.com/q/23123683
has comment: http://stackoverflow.com/comment/35351476
has comment: http://stackoverflow.com/comment/35351508
linked to: http://stackoverflow.com/q/9094784
has comment: http://stackoverflow.com/comment/35351494
has answer: http://stackoverflow.com/a/23139670
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35351559
possible better answer: http://stackoverflow.com/a/23139670
accepted answer: http://stackoverflow.com/a/23123813
favorite count: 0
has body: Basically, my program compiles and runs fine in Eclipse but doesn't compile in Command Prompt. It gives me Symbol Not Found with the pointer on the name of one of my classes. I've never had this happen before- the only difference between this program and the other ones I wrote is that I made a package in Eclipse for them. Any ideas?
has title: Program compiling in Eclipse but not in Command Prompt
has comment: http://stackoverflow.com/comment/35351437
has comment: http://stackoverflow.com/comment/35351572
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23123813

http://stackoverflow.com/q/23066108
has body: I have my java code like below: oracle.sql.ArrayDescriptor arrayDesc = new oracle.sql.ArrayDescriptor("ARRAY_DESC", conectionObj); oracle.sql.ARRAY sqlArray = new oracle.sql.ARRAY(arrayDesc, conectionObj, valueArray ); _statement = (oracle.jdbc.OracleCallableStatement) conectionObj.prepareCall("BEGIN ? := pkg_abc.getProd(?);END;"); _statement.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR); _statement.setARRAY(2, sqlArray); I want to check what the cursor is returning in SQL editor such as TOAD. So, please let me know how to pass for the arguement sqlArray object in TOAD. Thanks in advance!
favorite count: 0
tagged with: oracle-database
tagged with: sql
answer count: 0
type: UnansweredQuestion
score: 2
tagged with: toad
has comment: http://stackoverflow.com/comment/36996643
downvote count: 0
tagged with: java
has title: how to pass array object to a cursor in Oracle?
type: Question
upvote count: 2

http://stackoverflow.com/a/23125223
upvote count: 1
type: Answer
has body: make sure you have used proper jdbc driver for that database connection.
downvote count: 0
has comment: http://stackoverflow.com/comment/35422168
answers question: http://stackoverflow.com/q/23125112
score: 1
has comment: http://stackoverflow.com/comment/35422407

http://stackoverflow.com/q/22984521
has answer: http://stackoverflow.com/a/22984870
upvote count: 1
type: Question
has title: Vaadin : CustomLayout don't generate content
tagged with: java
tagged with: vaadin
answer count: 2
downvote count: 0
score: 1
favorite count: 0
has body: I'm using Vaadin 7. When I try to add html content to CustomLayout it does not generate a paragraph inside a div element. Here is the input : Profile setting Tasks My paragraph In java I use this : String html; //This var contain my input InputStream is = new ByteArrayInputStream(html.getBytes()); CustomLayout custom = null; try { custom = new CustomLayout(is); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Finaly I add the customLayout to my mainLayout. When I run the application I get this output : Profile setting Tasks My paragraph inside div with id=setting was not generated by Vaadin. Any Ideas to fix this problem ?
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/23005951

http://stackoverflow.com/comment/35200237
type: AnswerComment
has text: Sir, I want to check a variable value with the .property file value. How can we do it?? i.e using if condition (a == the property file value)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23033691

http://stackoverflow.com/a/23062970
downvote count: 0
has comment: http://stackoverflow.com/comment/35288835
score: 1
answers question: http://stackoverflow.com/q/23062341
has body: One way is to add a ListSelectionListener to menuList and have the handler set the other list's model to display the details for the selected row.
upvote count: 1
type: Answer

http://stackoverflow.com/comment/35200293
type: Comment
has text: No never. I think in the say way you can use this program for read random value from map. search for 100000 random keys then take the average. find the hits. Let me code it for you.
comment on: http://stackoverflow.com/a/23039492
type: AnswerComment
score: 0

http://stackoverflow.com/q/23058540
answer count: 1
has body: i'm trying to load a dll in an equinox osgi environement using System.load() , the path to the dll file is correct but i always get java.lang.UnsatisfiedLinkError . i managed to load the dll when it is placed in System32 folder. using : System.loadLibrary(). the dll works just fine when i experiment with a plain java main class , there's no need to programmaticaly load the dll since eclipse does it . is there anything specific to OSGI that prevents me from loading my DLL ?
tagged with: osgi
has answer: http://stackoverflow.com/a/23059110
score: 0
type: UnansweredQuestion
tagged with: dll
has title: java.lang.UnsatisfiedLinkError when loading topaz dll in OSGI environement
tagged with: java
tagged with: topaz-signatures
type: Question

http://stackoverflow.com/q/23006172
has comment: http://stackoverflow.com/comment/35139258
has body: I have several entities using AUTO key generation strategy with Hibernate and postgres. @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; This will result in a hibernate_sequence generated, and each entity will make use of that sequence when assigning keys. Now I have a table that has lots of cache data (like 100k entries), and some user tables. As both use strategy AUTO, they both get their keys from the same hibernate sequence. As a result, even if I only have 10 users, they will all have an id of 6-7 digits long, like 123123. I wonder if, in general, one should introduce a custom sequence for each table? Or shouldn't I care about the id generation that much?
tagged with: sql
downvote count: 0
has answer: http://stackoverflow.com/a/23006923
favorite count: 0
tagged with: postgresql
has answer: http://stackoverflow.com/a/23006460
has comment: http://stackoverflow.com/comment/35139161
has answer: http://stackoverflow.com/a/23007244
has title: Should hibernate use unique sequences for each table?
upvote count: 6
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35139841
possible better answer: http://stackoverflow.com/a/23006460
has comment: http://stackoverflow.com/comment/35140034
accepted answer: http://stackoverflow.com/a/23007244
score: 6
type: Question
has answer: http://stackoverflow.com/a/23006291
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/3585034

http://stackoverflow.com/q/23079623
type: Question
has answer: http://stackoverflow.com/a/23459898
has title: JavaFX 2.2 Editor Resizing of Shapes
has body: I want to build an JavaFX Graphics Editor with object-orientated patterns, such as Prototype, Composite, Singleton, etc. The problem I have, is to resize an already drawn shape in my AnchorPane. So my idea would be to click i.e. on a rectangle, then a sourrounding border appears which small buttons in each corner to start resizing for that rectangle. Imagine Photoshop resizing, there you also hava such a border, you know. So how can I do this? Thanks in advance ;)
score: 0
answer count: 1
tagged with: javafx-2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23459898

http://stackoverflow.com/a/23019904
has body: I would suggest two changes at the very least. Add out.print("Error: " + e.getMessage()); to your catch block. Your comment "no stacktaces nothing just plain blank page" makes me think you don't know that e.printStackTrace(); prints to a log not to the page in the browser. System.out.println() also does not print to the page. Replace %&gt;&lt;%= name%&gt;&lt;% with out.print(name);. Its messy and horrible practice to close and reopen scriptlet tags every time you want to print something. &lt;% try { System.out.println("ID\tName\tPhone"); //Print in background out.print("&lt;P&gt;ID\tName\tPhone"); //Print to actual page while (rs.next()) { //int id = rs.getInt(1); String name = rs.getString(2); String phone = rs.getString(3); out.print(name); //Print without closing/opening scriptlet } } catch (Exception e) { //Might not want to show the user the exact error in production though. out.print("Error: " + e.getMessage()); //print error to page e.printStackTrace(); //print error to log } %&gt; You also really need to start indenting your blocks better.
answers question: http://stackoverflow.com/q/23011934
type: Answer
has comment: http://stackoverflow.com/comment/35177027
has comment: http://stackoverflow.com/comment/35252182
score: 0

http://stackoverflow.com/a/29597007
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23030059
type: Answer
answers question: http://stackoverflow.com/q/23030059
has body: So where'd you end up on this? What I've determined is that the actor model is not the same thing as the agent model, and that, in order to make agents make sense in AKKA, you need to do quite a bit yourself. because AKKA is going to send all requests through a router, you need to store state in the message itself. in order to emulate the masterless behavior of agent peers, you will have to build a routing master that will know which agents to send what to. Also, if you have a "repeated averaging" problem, like group opinions, that master will need to watch over the state for the problem / send the results of other agents to each agent on the next iteration. I think you may need to ask what you're looking for in your framework. If you're looking for ruggedness, AKKA is probably an OK bet (it's inspired by ErLang), if you're looking for an agent platform that can run simulations, JADE or RePast is probably a much better bet. At least for agent systems, AKKA is about as much of a match as ActiveMQ or ZeroMQ is (i.e. it handles some communication problems for distributed systems, but it's not an agent based framework).
upvote count: 2

http://stackoverflow.com/comment/35332774
type: QuestionComment
has text: Also, you're not creating a new sesion in this code.
comment on: http://stackoverflow.com/q/23113492
score: 0
type: Comment

http://stackoverflow.com/q/23065323
has comment: http://stackoverflow.com/comment/35247759
has comment: http://stackoverflow.com/comment/35249291
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35247213
tagged with: paint
answer count: 0
type: Question
has body: I'm new to this so there might be many problems in the code below. It should take user written text from the text field and draw the Morse code for it. It gets the text, transmits the String in CharArray form to this class, but the paint method doesn't draw anything(variables are not recognized in paint method!!). Input: the constructor gets the link(or what in that)of the other class, a char from the string, and its place number in the string Output: just the last 3 rows are drawn, other variables from outside paint method are not recognized! Here is the class that doesn't work: public class Procesare extends Canvas{ Morse fereastra; String lit="",cod=""; char car; int nr; public Procesare(Morse parinte,char c,int i){ fereastra=parinte; car=c; // with or without "this" doesn't seem to transmit values to the class nr=i; //this.lit=String.valueOf(c); switch (c){ //this part is just testing that values were transmited, it works case 'a': fereastra.canv.setBackground(Color.orange); System.out.println(c+" .-"); break; case 'b': fereastra.canv.setBackground(Color.blue); System.out.println(c+" -..."); break; case 'c': fereastra.canv.setBackground(Color.red); System.out.println(c+" -.-."); break; case 'd': fereastra.canv.setBackground(Color.green); System.out.println(c+" -.."); break; default: break; } } public void paint(Graphics g){ lit=String.valueOf(car); switch (lit){ case "a": cod=".-"; break; case "b": cod="-..."; break; default: break; } g.drawString(lit,5,10+nr*10); g.drawString(cod,15,10+nr*10); g.drawString(lit,5,10); // these aren't drawing anything !?!? g.fillOval(15, 3, 6, 6); // just testing g.drawString("z",5,20); g.fillOval(15, 13, 6, 6); } } the main class, which works: public class Morse extends Frame { xText camp; Procesare proc,canv; String s1, str; char[] cuv; int n; public Morse(String titlu){ super(titlu); init(); } public static void main (String args[]){ Morse app=new Morse("Morse much?"); app.setSize(250,250); app.show(); } public boolean handleE…
has comment: http://stackoverflow.com/comment/35267976
tagged with: java
has title: how to transmit user variables to paint method
score: 0
has comment: http://stackoverflow.com/comment/35249124

http://stackoverflow.com/q/23122579
answer count: 1
has comment: http://stackoverflow.com/comment/35349625
has comment: http://stackoverflow.com/comment/35349595
favorite count: 0
has title: Java toString() printing issues
has comment: http://stackoverflow.com/comment/35349444
has comment: http://stackoverflow.com/comment/35349656
upvote count: 1
accepted answer: http://stackoverflow.com/a/23122698
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35349514
has comment: http://stackoverflow.com/comment/35349575
type: Question
has comment: http://stackoverflow.com/comment/35349545
downvote count: 0
has body: I am currently using an toString() method to print out an array list. It works but the output comes out all wonky in the console when it prints out. I was wondering is anyone would point out to me where i am going wrong or even direct me to a tutorial that would help better explain his type of formatting. Method i am using: rental number, release and releaseYear are all ints. film , fname, studio are all strings public String toString() { //Returns a String return String.format("DVDDetails [%s |\t\t %s \t\t | \t\t %s | %s | %s| %s| ]",rental, fFName, FAName, studio, releaseYear); }
has answer: http://stackoverflow.com/a/23122698

http://stackoverflow.com/q/23089648
answer count: 2
has answer: http://stackoverflow.com/a/23089698
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12688068
has title: What does printStackTrace() mean in simple and easy to understand phrase?
duplicate of: http://stackoverflow.com/q/12688068
upvote count: 2
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/35290709
type: Question
has comment: http://stackoverflow.com/comment/35290613
score: -1
has body: I encountered this method when I'm reading a java book. I've looked for its meaning in java doc but it's difficult to understand. Can you tell me its meaning in easy to understand way?
has answer: http://stackoverflow.com/a/23089714

http://stackoverflow.com/comment/35276743
score: 0
has text: OK, then it should work. What is it you are trying to do more precisely? Maybe put some code in the question?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23055801

http://stackoverflow.com/a/23060776
downvote count: 0
answers question: http://stackoverflow.com/q/23060693
type: Answer
score: 1
has body: Try ^[-+]?[0-9]*(\\.[0-9]*)?([eE][-+]?[0-9]+)?$ You didn't take account of the case of scientific formats without specified fractions. Note that this regex recorginzes numbers like 123.E14. if you do not want decimal points without an explicit fraction specified, replace the quantifier for the fraction part, ie. ^[-+]?[0-9]*(\\.[0-9]+)?([eE][-+]?[0-9]+)?$
upvote count: 1

http://stackoverflow.com/a/23050025
answers question: http://stackoverflow.com/q/23049956
score: 0
has body: I wouldn't focus on inverting the order of the data in the Adapter. Try to invert the list of data before you So you have your array listabefore you create your adapter with lista do the following: String[] invertedList = new String[lista.length]; for(int i = 0; i &lt; lista.length; i ++) { invertedList[i] = lista[lista.length - 1 - i]; } And then create your adapter with invertedList instead.
type: Answer

http://stackoverflow.com/a/22972058
answers question: http://stackoverflow.com/q/22971855
type: Answer
downvote count: 0
score: 1
has body: I did this thanks for the idea @rgettman package excel; import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.util.ArrayList; import java.util.List; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; public class CsvToXlx { public static void csvToXLSX(HSSFWorkbook workBook,String filename, String sheetno) { try { String csvFile = filename; //csv file address String excelFile = "E:\\test.xls"; //xlsx file address //HSSFWorkbook workBook = new HSSFWorkbook(); HSSFSheet sheet = workBook.createSheet(sheetno); String currentLine = null; int RowNum = 0; BufferedReader br = new BufferedReader(new FileReader(csvFile)); while ((currentLine = br.readLine()) != null) { String str[] = currentLine.split(","); HSSFRow currentRow = sheet.createRow(RowNum); RowNum++; for (int i = 0; i &lt; str.length; i++) { currentRow.createCell(i).setCellValue(str[i]); } } FileOutputStream fileOutputStream = new FileOutputStream(excelFile); workBook.write(fileOutputStream); fileOutputStream.close(); System.out.println("Done"); } catch (Exception ex) { System.out.println(ex.getMessage() + "Exception in try"); } } public static List listOfFiles() { List&lt;String&gt; results = new ArrayList&lt;String&gt;(); File[] files = new File("f:\\csv").listFiles(); for (File file : files) { if (file.isFile()) { results.add(file.getAbsolutePath()); } } return results; } public static void main(String[] args) { List list = listOfFiles(); int size = list.size(); HSSFWorkbook workBook = new HSSFWorkbook(); for (int i = 0; i &lt; size; i++) { csvToXLSX(workBook,list.get(i).toString(), "sheet" + i + 1); } } }
upvote count: 1

http://stackoverflow.com/a/23101274
answers question: http://stackoverflow.com/q/23101171
has comment: http://stackoverflow.com/comment/35311544
type: Answer
score: 1
upvote count: 1
has body: If you want to store Strings in the same ArrayList with your custom objects it means your classes works with string too no? Implement CharSequence in your classes. And methods of CharSequence which you don't need throw MethodNotImplementedException.
downvote count: 0

http://stackoverflow.com/q/23043324
tagged with: c#
tagged with: java
accepted answer: http://stackoverflow.com/a/23445030
type: Question
score: 0
answer count: 1
has title: C# Parsing Response of a Java Web Service
has answer: http://stackoverflow.com/a/23445030
linked to: http://stackoverflow.com/q/21440843
has body: I am calling a Java WebLogic web service from my .Net application. I have added a service reference to the jws service. The service can be called fine and I can see the response in Fiddler, however the problem is that the propery listOfHolds is coming as null although I can see a list of holds in the XML of the response. Here is the code for calling holdsList result = proxy.viewHoldsList(request.AccountNo); int noOfHolds = result.NumberOfHolds; // This value is read fine object[] holds = result.listOfHolds; // This is coming as Null despite the values in the response Here is the response XML as captured by Fiddler &lt;?xml version='1.0' encoding='UTF-8'?&gt; &lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;S:Header&gt; &lt;work:WorkContext xmlns:work="http://oracle.com/weblogic/soap/workarea/"&gt;rO0...AAA&lt;/work:WorkContext&gt; &lt;/S:Header&gt; &lt;S:Body&gt; &lt;ns0:viewHoldsListResponse xmlns:ns0="http://www.openuri.org/"&gt; &lt;ns0:viewHoldsListResult&gt; &lt;ns0:TotalAmount&gt;130.0&lt;/ns0:TotalAmount&gt; &lt;ns0:NumberOfHolds&gt;4&lt;/ns0:NumberOfHolds&gt; &lt;ns0:listOfHolds&gt; &lt;ns0:item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns0:holdDetails"&gt; &lt;ns0:xsiType&gt;HoldDetails&lt;/ns0:xsiType&gt; &lt;ns0:Amount&gt;100.0&lt;/ns0:Amount&gt; &lt;ns0:StartDate&gt;2014-02-15T00:00:00.0&lt;/ns0:StartDate&gt; &lt;ns0:ExpiryDate&gt;2014-02-20T00:00:00.0&lt;/ns0:ExpiryDate&gt; &lt;ns0:Description&gt;For testing&lt;/ns0:Description&gt; &lt;ns0:Instruction/&gt; &lt;ns0:Tracer&gt;00000810000287294002&lt;/ns0:Tracer&gt; &lt;ns0:HoldId&gt;3591376655&lt;/ns0:HoldId&gt; &lt;ns0:EmployeeId&gt;0&lt;/ns0:EmployeeId&gt; &lt;/ns0:item&gt; &lt;ns0:item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns0:holdDetails"&gt; &lt;ns0:xsiType&gt;HoldDetails&lt;/ns0:xsiType&gt; &lt;ns0:Amount&gt;10.0&lt;/ns0:Amount&gt; &lt;ns0:StartDate&gt;2014-02-15T00:00:00.0&lt;/ns0:StartDate&gt; &lt;ns0:ExpiryDate&gt;2014-02-1…
linked to: http://stackoverflow.com/q/13077653
tagged with: web-services
type: AnsweredQuestion

http://stackoverflow.com/comment/46640215
score: 6
type: Comment
has text: This is not a duplicate as the other question is indexing the Foo's by a property of theirs that is an arrays (Tags) instead of a property with a single value (id)
comment on: http://stackoverflow.com/q/23003542
type: QuestionComment

http://stackoverflow.com/comment/35190904
type: Comment
has text: mipsim -v < test1.cmd > test1.log The following syntax on unix/windows machines will make test1.cmd be the standard input (the keyboard) and test1.log be the standard output (System.out) No setup is required
comment on: http://stackoverflow.com/q/23034276
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35098736
has text: What is the variable result? Is either 1 or 0 which I imagine are the return values of pst.executeUpdate()?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22982514

http://stackoverflow.com/comment/35203935
has text: i know how actions are implemented.How do i get the data submited from the form into two tables.Of what i know one one class can be mapped for a table.one class can not submit data to two differnt tables.there has to be another class for another table.Am i wrong?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23039505
type: Comment

http://stackoverflow.com/comment/35224620
score: 0
has text: Thank you. How can I now retrieve 10 elements each time which are proportion of this percentages from this list?
type: Comment
comment on: http://stackoverflow.com/a/23052663
type: AnswerComment

http://stackoverflow.com/q/23092688
tagged with: jooq
type: Question
has title: JOOQ seems not to close connections when using keepStatement()
accepted answer: http://stackoverflow.com/a/23106108
tagged with: java
has body: When I use the keepStatement() method to reuse a prepared statement, I'm running out of connections when using java.sql.DataSource and connection pooling... private void keepStatmentTest() { Settings jooqSettings = = new Settings(); jooqSettings.setRenderSchema(false); InitialContext ic = new InitialContext(); DataSource ds = (DataSource) ic.lookup(dataSourceName); DSLContext create = DSL.using(dataSource, SQLDialect.MYSQL, jooqSettings) for (int i = 0; i &lt; 100; i++) { ResultQuery&lt;Record1&lt;String&gt;&gt; q = create.select(ROLES.NAME) .from(ROLES) .where(ROLES.ID.equal(DSL.param("p", 0))) .keepStatement(true); q.bind("p", 1); q.execute(); q.bind("p", 2); q.execute(); q.close(); } } Results into (max. 10 open connections allowed in the connection pool): org.jooq.exception.DataAccessException: Error getting connection from data source org.apache.tomcat.dbcp.dbcp.BasicDataSource@22fc4de4 at org.jooq.impl.DataSourceConnectionProvider.acquire(DataSourceConnectionProvider.java:89) at org.jooq.impl.DefaultExecuteContext.connection(DefaultExecuteContext.java:426) at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:278) ... Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at org.jooq.impl.DataSourceConnectionProvider.acquire(DataSourceConnectionProvider.java:86) ... 23 more Caused by: java.util.NoSuchElementException: Timeout waiting for idle object at org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1167) at org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:79) at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106) ... 25 more If I remove the .keepStatement(true) from the code above, everything runs w…
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/23106108
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/35307247
score: 1
has text: There are multiple ways to construct a URL and you need to pay attention to what the parameters are named. If the second string parameter is named "host" you may only pass a host name in. The reason for this is that internally a URL is not a single string but multiple fields (and one of them is for the hostname). the simplest method is to use `new URL("http://host/path")` as it will try to parse the string and separate it. Only this version splits the segments (often correctly). If you have the different components in variables, it is better to specify them directly to avoid the parsing.
comment on: http://stackoverflow.com/a/23098479
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35246022
type: Comment
comment on: http://stackoverflow.com/a/23064793
has text: Same result is getting displayed. I have also used (Calender.Hour, -24)
type: AnswerComment
score: 0

http://stackoverflow.com/q/22975203
downvote count: 0
possible better answer: http://stackoverflow.com/a/22975447
has body: How can you display text inside a JProgressBar? i.e. "000/100" progPanel.setBorder(BorderFactory. createEmptyBorder(10,10,10,10)); timerBar = new JProgressBar(0,100); timerBar.setOrientation(JProgressBar.VERTICAL); timerBarLabel = new JLabel("Play"); timerBarLabel.setForeground(Color.white); progPanel.add(timerBarLabel); progPanel.add(timerBar); This is my code for my progress bar.
has answer: http://stackoverflow.com/a/22975447
has comment: http://stackoverflow.com/comment/35083994
accepted answer: http://stackoverflow.com/a/22975605
has title: JProgress Bar with Values
favorite count: 0
tagged with: jlabel
tagged with: jprogressbar
has comment: http://stackoverflow.com/comment/35085465
upvote count: 1
tagged with: swing
tagged with: text
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22975605
type: Question
answer count: 2

http://stackoverflow.com/q/23032262
tagged with: url
tagged with: security
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23032691
tagged with: encryption
type: Question
tagged with: des
has body: Am being able to encrypt/decrypt my URL successfully before sending the url in an email, but after passing the URL and retrieving it am decrypting the encrypted part of the URL, its not being decrypted correctly. Am getting strange characters after decryption, for example: my text before encryption: dkjkb7i8doprgeh521tbbdll9r-Sat Apr 12 17:21:01 EEST 2014 my text after: decryption:ziUO5baLOpFaOfWBtMOLhrRBR2ucXnxFHbA2KoRUVVQst6oDqUrGIU04qey4xU6haNvyp18+BROzadH6MXNxKA== URL decryption after sending the url,decrypted text after sending url : dkjkb7i8doprgeh521tbbdll9r-Sat Apr 12 17:21:01 **E[???xno** this is my DES class that i use for encryption, decryption: package com; import java.security.spec.KeySpec; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpec; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; public class DESEncryption { private static final String UNICODE_FORMAT = "UTF8"; public static final String DES_ENCRYPTION_SCHEME = "DES"; private KeySpec myKeySpec; private SecretKeyFactory mySecretKeyFactory; private Cipher cipher; byte[] keyAsBytes; private String myEncryptionKey; private String myEncryptionScheme; SecretKey key; public DESEncryption() throws Exception { myEncryptionKey = "ThisIsSecretEncryptionKey"; myEncryptionScheme = DES_ENCRYPTION_SCHEME; keyAsBytes = myEncryptionKey.getBytes(UNICODE_FORMAT); myKeySpec = new DESKeySpec(keyAsBytes); mySecretKeyFactory = SecretKeyFactory.getInstance(myEncryptionScheme); cipher = Cipher.getInstance(myEncryptionScheme); key = mySecretKeyFactory.generateSecret(myKeySpec); } /** * Method To Encrypt The String */ public String encrypt(String unencryptedString) { String encryptedString = null; try { cipher.init(Cipher.ENCRYPT_MODE, key); byte[] plainText = unencryptedString.getBytes(UNICODE_FORMAT); byte[] encryptedText = cipher.doFinal(plainText); BASE64Encoder base64encoder = new BASE64Encoder(); encryptedString = base64e…
tagged with: java
score: 0
has title: URL decryption error using DES
answer count: 1
has answer: http://stackoverflow.com/a/23032691

http://stackoverflow.com/comment/35278612
comment on: http://stackoverflow.com/a/23079698
has text: @user3533531 What do you expect to happen when the provided value of n isn't in the sequence? (Sequence is 1,3,7,13,21,... What if the provided n value is 5?)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23049814
tagged with: java
has answer: http://stackoverflow.com/a/23051038
accepted answer: http://stackoverflow.com/a/23051038
tagged with: layout
answer count: 1
downvote count: 0
has title: How to Center JButtons in a centered JLabel in a BoxLayout?
favorite count: 0
tagged with: jlabel
type: AnsweredQuestion
score: 1
upvote count: 1
tagged with: swing
tagged with: boxlayout
has body: I'm new in Java GUI programming and I have a strange issue with the BoxLayout: I have an JLabel with an Icon. Added to the label are two JButtons. The Jlabel is placed in the CENTER position of the BorderLayout from a JFrame. Now I want that these two JButtons are always in the center of the JLabel even when I resize the JFrame. With setAlignmentX() the Jbuttons are centered horizontally , but there is no solution with setAlignmentY() for the vertical direction. here is the code: package footballQuestioner; import java.awt.BorderLayout; import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; public class Houdini { public static void main(String[] args) { JFrame frame = new House(); } } class House extends JFrame { private JLabel label = new JLabel( new ImageIcon( "C:\\Users\\laudatio\\Documents\\Java\\MyProject\\src\\footballQuestioner\\footballfield.jpg") ); private JButton one=new JButton("one"); private JButton two=new JButton("two"); public House() { label.setLayout(new BoxLayout(label, BoxLayout.Y_AXIS)); label.add(one); label.add(two); one.setAlignmentX(CENTER_ALIGNMENT); one.setAlignmentY(CENTER_ALIGNMENT); two.setAlignmentX(CENTER_ALIGNMENT); two.setAlignmentY(CENTER_ALIGNMENT); setLayout(new BorderLayout()); setLocation(300, 500); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(true); add(label,BorderLayout.CENTER); pack(); setVisible(true); } } Please Help! :-((((
type: Question
has comment: http://stackoverflow.com/comment/35219002

http://stackoverflow.com/comment/35239079
comment on: http://stackoverflow.com/a/23061068
score: 1
type: AnswerComment
has text: I believe the best would be to add the name parameter to the child constructor.
type: Comment

marker
tag name: marker
tags question: http://stackoverflow.com/q/23108709
type: Tag

http://stackoverflow.com/comment/35311723
comment on: http://stackoverflow.com/q/23089703
type: Comment
type: QuestionComment
score: 0
has text: @Elliott Frisch : I have added the scenario in the question that I had poseted. Thanks in advance.

http://stackoverflow.com/comment/35258634
comment on: http://stackoverflow.com/q/23071402
score: 0
type: Comment
has text: @MikeB When I call `scanner.nextLine()` in a `true` loop, it blocks until I type something (while using System's InputStream for input). I don't get the `NoSuchElementException`. Why not?
type: QuestionComment

http://stackoverflow.com/comment/35282457
type: AnswerComment
type: Comment
has text: I created a chatroom: http://chat.stackoverflow.com/rooms/50698/maven-profiles to continue this discussion if needed.
comment on: http://stackoverflow.com/a/23082389
score: 0

http://stackoverflow.com/q/23010385
tagged with: eclipse
tagged with: filezilla
type: Question
has comment: http://stackoverflow.com/comment/35147313
has comment: http://stackoverflow.com/comment/35148440
has comment: http://stackoverflow.com/comment/35146771
has comment: http://stackoverflow.com/comment/35146623
has title: modifying the code in java classes on the server, as we do for jsp pages in vi editor
has body: My application requirement forces us to modify the code in the java classes frequently. We are developing the java web application using using eclipse on tomcat server. We develop and test our project on localhost. Once every thing is fine on localhost, we export the project as a war file and upload the war file through filezilla on our hosting server and using putty deploy the war file in webapps of tomcat and restart the tomcat for production (live). After that if we find any thing to modify on the front end / UI side we connect to our hosting server through putty and go inside the project and modfiy the jsp page using vi editor. But if we had to modify anything in java classes (say just a single line of additional code )then we upload the complete war file again which takes nearly 2 hours to upload because of the war file size. My question is, is there any shortcut or alternative to modify the code in the java classes on the hosting server (not in local) without having the need to upload the complete war file again ?
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: war
tagged with: putty
answer count: 0
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/23202402
has body: Your question is very broad, but I will do my best to explain optical character recognition (OCR) in a programmatic context and give you a general project workflow followed by successful OCR algorithms. The problem you face is easier than most, because instead of having to recognize/differentiate between different characters, you only have to recognize a single image (assuming this is the only city you want to recognize). You are, however, subject to many of the limitations of any image recognition algorithm (quality, lighting, image variation). Things you need to do: 1) Image isolation You'll have to isolate your image from a noisy background: I think that the best isolation technique would be to first isolate the license plate, and then isolate the specific characters you're looking for. Important things to keep in mind during this step: Does the license plate always appear in the same place on the car? Are cars always in the same position when the image is taken? Is the word you are looking for always in the same spot on the license plate? The difficulty/implementation of the task depends greatly on the answers to these three questions. 2) Image capture/preprocessing This is a very important step for your particular implementation. Although possible, it is highly unlikely that your image will look like this: as your camera would have to be directly in front of the license plate. More likely, your image may look like one of these: depending on the perspective where the image is taken from. Ideally, all of your images will be taken from the same vantage point and you'll simply be able to apply a single transform so that they all look similar (or not apply one at all). If you have photos taken from different vantage points, you need to manipulate them or else you will be comparing two different images. Also, especially if you are taking images from only one vantage point and decide not to do a transform, make sure that the text your algorithm is looking for is trans…
downvote count: 1
type: AcceptedAnswer
score: 47
accepted answer of: http://stackoverflow.com/q/23028037
type: Answer
upvote count: 48
answers question: http://stackoverflow.com/q/23028037

http://stackoverflow.com/a/23009180
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35146359
has body: Use onevent attribute of &lt;f:ajax&gt; as follows: &lt;h:selectOneMenu id="collectorType" value="#{activityDataSource.object.type}" rendered="#{empty activityDataSource.object.id}" disabled="#{!sp:hasRight(facesContext, 'ManageApplication')}" readonly="#{!sp:hasRight(facesContext, 'ManageApplication')}"&gt; &lt;f:ajax event="change" execute="@this" render="dsTransformationRule dsCorrelationRule" listener="#{activityDataSource.handleCollectorTypeChange}" onevent="$('#editForm\\:selectTypeButton').click();"/&gt; &lt;f:selectItem itemValue="" itemLabel="#{msgs.select_collector_type}"/&gt; &lt;f:selectItems value="#{activityDataSource.collectorTypes}"/&gt; &lt;/h:selectOneMenu&gt; also notice I've modified the selector '#editForm\\:selectTypeButton' to escape the : in your button's id. [UPDATE] Here's what you can do to achieve the scenario we've discussed in the comments: First to populate both dsTransformationRule and dsCorrelationRule with _selectedTransformationRule and _selectedCorrelationRule respectively, create an initialization method for them, and call it in @PostConstruct method (check Why use @PostConstruct?), so in your bean class you would have something like this: @PostConstuct public void init() { initRules(); //include another things you want to be initializaed when this page finishes constructing. } private void initRules() { ActivityDataSourceDTO dto = getObject(); if (dto == null) return; if (_selectedTransformationRule == null) _selectedTransformationRule = dto.getTransformationRule(); if (_selectedCorrelationRule == null) _selectedCorrelationRule = dto.getCorrelationRule(); } //Let the getters do no dto access, so it won't matter if they're called twice on change public String getSelectedTransformationRule() { return _selectedTransformationRule; } public String getSelectedCorrelationRule() { return _selectedCorrelationRule; } Now your f:ajax can normally execute and render your select menus without fearing to access your DTO layer multiple times &…
has comment: http://stackoverflow.com/comment/35153963
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23006444
has comment: http://stackoverflow.com/comment/35146703
answers question: http://stackoverflow.com/q/23006444
has comment: http://stackoverflow.com/comment/35153420
has comment: http://stackoverflow.com/comment/35152685

http://stackoverflow.com/q/23128852
has title: log4j not logging into file
tagged with: java
type: Question
has body: log4j.rootLogger=INFO log4j.logger.com.app.yum.package.WatchDog=INFO,logfile log4j.appender.logfile=org.apache.log4j.RollingFileAppender log4j.appender.logfile.file=watchdog/watchdog.log log4j.appender.logfile.maxFileSize=1024KB log4j.appender.logfile.maxBackupIndex=5 log4j.appender.logfile.append=true log4j.appender.logfile.layout=org.apache.log4j.PatternLayout log4j.appender.logfile.layout.ConversionPattern=%d | %-5p | %m | %c | %t%n I am using above config in log4j properties file. I could see a new file has been created but there are no logs inside it. Instead I see the logs on console. What I am trying to do is log all the logs of particular class in a file watchdog.log. Below is my logger initialization private static final Logger logger = LoggerFactory.getLogger(WatchDog.class); Am I missing anything?
has answer: http://stackoverflow.com/a/23129003
answer count: 1
has comment: http://stackoverflow.com/comment/35546397
score: 0
has comment: http://stackoverflow.com/comment/35360865
has comment: http://stackoverflow.com/comment/35361252
tagged with: log4j
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35362348
tagged with: logging

http://stackoverflow.com/a/23045919
has body: I would recommend loading a Map with the replacement words keyed by the blocked words. Then you could leverage a method like this: public Map&lt;String, String&gt; replacementWords = new HashMap&lt;String, String&gt;(); public String getWordReplacement(String word) { if (replacementWords.containsKey(word) { return replacementWords.get(word); } return word; } You would have to pre-populate your map similar to this: public void populateReplacementWordMap() { int numberOfWords = 6; for (int i = 1; i &lt;= numberOfWords; i++) { String blockedWord = plugin.getConfig().getString("PBSwears.blocked.word" + i); String replacementWord = plugin.getConfig().getString("PBSwears.replace.word" + i); replacementWords.put(blockedWord, replacementWord); } }
type: Answer
answers question: http://stackoverflow.com/q/23045759
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/35114792
comment on: http://stackoverflow.com/a/22983242
has text: @Nik replied to my answer
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23021760
type: Answer
answers question: http://stackoverflow.com/q/22997636
has body: First, what do you mean I wonder how I can add JAR file to the dependencies.? Do you mean that you need to add a jar to the compile classpath in Eclipse? Do you mean there's a jar that you need to access whether locally built or from some open source project somewhere on the web? Is this a jar that Project "A" builds and Project "B" needs? You can simply check the jar into Subversion. That way, when someone checks out the project, they have the jar. This is a common way to handle this issue, and it's known as the wrong way. The right way is to use Ivy or Maven, and then use a third party Jar repository like Nexus or Artifactory to host your locally built jars that your projects need. Then, use m2eclipse or IvyDE to connect your repo to your Eclipse project. Doing things the right way is a bit more difficult, and you and your developers will have to learn Maven or Ivy and how it works. In the end, it makes your development faster and easier. Plus, knowing something like this can help your future career.
score: 0

http://stackoverflow.com/comment/35196014
type: QuestionComment
comment on: http://stackoverflow.com/q/23036714
has text: Not completely sure, but could you try using `"from users"` instead of `"from Users"` (check the `u` vs `U`)?
score: 0
type: Comment

http://stackoverflow.com/q/23104964
has comment: http://stackoverflow.com/comment/35317848
score: 0
has title: Android how to hide the table lyout
has answer: http://stackoverflow.com/a/23110078
answer count: 1
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35317652
has body: In my android application a love compatibility test is doing.. where first the details of boys and then details of girls are entered in the same page..one after another. and separate save button for saving boy details and girl details and these data is saved in separate databases. and there is a recall button also there for both boys and girls. When this recall button is pressed the database will opened and from that user can select the name to be checked. When he press the corresponding data has to be entered into the corresponding edittexts. In my case I don't know how to close this tablerow. that mean the database opened.then only the data will go to the corresponding edittext box. I am giving my code below MainActivity btn4.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Cursor c = dbb.rawQuery("SELECT * from Data3", null); int count = c.getCount(); c.moveToFirst(); TableLayout tableLayout = new TableLayout(getApplicationContext()); tableLayout.setVerticalScrollBarEnabled(true); TableRow tableRow; TextView textView1, textView2,textView3, textView4, textView5, textView6, textView7, textView8 ; tableRow = new TableRow(getApplicationContext()); textView1 = new TextView(getApplicationContext()); textView1.setText("First Name"); textView1.setTextColor(Color.BLACK); textView1.setTypeface(null, Typeface.BOLD); textView1.setPadding(20, 20, 20, 20); tableRow.addView(textView1); textView2 = new TextView(getApplicationContext()); textView2.setText("Last Name"); textView2.setTextColor(Color.RED); textView2.setTypeface(null, Typeface.BOLD); textView2.setPadding(10, 10, 10, 10); tableRow.addView(textView2); tableLayout.addView(tableRow); for(Integer j=0; j&lt;count; j++) { tableRow = new TableRow(getApplicationContext()); textView3= new TextView(getApplicationContext()); textView3.setText(c.getString(c.getColumnIndex("ffirstname"))); textView3.setClickable(true); ett1=textView3.getText().toString(); te…
tagged with: tablerow
has comment: http://stackoverflow.com/comment/35317747
has comment: http://stackoverflow.com/comment/35318270
has comment: http://stackoverflow.com/comment/35318029
type: Question
tagged with: java

http://stackoverflow.com/comment/35367034
type: AnswerComment
comment on: http://stackoverflow.com/a/23112445
type: Comment
score: 1
has text: Yes this is what I wanted to achieve, did it using Expressions as criteria.add(Expression.sql("{alias}.is_req = '0'"))

http://stackoverflow.com/comment/35123303
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22997096
has text: With your latest edit, the two declarations have identical effect. Why do you think the first one is wrong? (See the [Java Language Specification](http://docs.oracle.com/javase/specs/jls/se7/html/jls-10.html#jls-10.2) for an explanation of why they're the same.)
type: AnswerComment

http://stackoverflow.com/comment/35131709
score: 0
type: Comment
type: QuestionComment
has text: Are you running a `main` method inside `Spash` ?
comment on: http://stackoverflow.com/q/23001856

http://stackoverflow.com/a/23004124
score: 4
type: Answer
accepted answer of: http://stackoverflow.com/q/23004079
answers question: http://stackoverflow.com/q/23004079
has body: Use a JDialog for this, not a JFrame since an application should only have a single JFrame. Then you can use: dialog.setFocusableWindowState( false );
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38397283

http://stackoverflow.com/a/23035385
has comment: http://stackoverflow.com/comment/35192649
has comment: http://stackoverflow.com/comment/35192949
has comment: http://stackoverflow.com/comment/35193050
has comment: http://stackoverflow.com/comment/35193153
type: Answer
has comment: http://stackoverflow.com/comment/35193220
has comment: http://stackoverflow.com/comment/35192678
accepted answer of: http://stackoverflow.com/q/23035318
downvote count: 1
has comment: http://stackoverflow.com/comment/35192688
has comment: http://stackoverflow.com/comment/35192906
answers question: http://stackoverflow.com/q/23035318
has comment: http://stackoverflow.com/comment/35193556
has comment: http://stackoverflow.com/comment/35193281
has body: Setting class instances as public is wrong, because: Everything that is public must be tested. It breaks encapsulation There are better ways to do it What you need to do is add a wrapper method. For example in class C: public class C { private B b; void method2(){ b = new B(); b.setname("BBB"); } public void setName(String newName) { b.setname(newName); } public String getName() { return b.getName(); } } Public instance way: public class C { public B b = new B(); void method2(){ b.setname("BBB"); } } public class A { public C c = new C(); public B b =new B(); void method1(){ b.setname("AAA"); System.out.println(b.getname()); } } public class Testcase { public static void main(String[] args) { A a=new A(); a.c.b.setname("tralala"); } }
score: -1
has comment: http://stackoverflow.com/comment/35192606
has comment: http://stackoverflow.com/comment/35192646
has comment: http://stackoverflow.com/comment/35193083
upvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35192790
has comment: http://stackoverflow.com/comment/35193434

http://stackoverflow.com/q/22978561
has comment: http://stackoverflow.com/comment/35089856
upvote count: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22978588
tagged with: java
tagged with: methods
tagged with: eclipse
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35089601
has body: i'm new to this forum, first of all i would like to say thanks for reviewing my question. I'm receiving this message: The method CreandoFunciones() is undefined for the type CreandoFunciones. I'm new @ Java, i try a few things, but nothing. Any help would be appreciated. Thanks package funciones; import java.util.Scanner; public class Funciones1 { private static Scanner scan; public static void main(String[] args) { CreandoFunciones link = new CreandoFunciones(); { int menu; scan = new Scanner(System.in); System.out.println("Opción: "); menu = scan.nextInt(); switch(menu) { case 1: link.CreandoFunciones(); break; case 2: System.out.println("C'est la vie!"); break; case 3: System.out.println("Alors on danse!"); break; default: System.out.println("Owned."); } } } } package funciones; public class CreandoFunciones { public CreandoFunciones() { System.out.println("Testing"); } }
has comment: http://stackoverflow.com/comment/35089600
has answer: http://stackoverflow.com/a/22978588
has title: The method ***** is undefined for the type *******
answer count: 1
score: 1
tagged with: undefined
favorite count: 0

hibernate
tags question: http://stackoverflow.com/q/23077788
tags question: http://stackoverflow.com/q/23007504
tags question: http://stackoverflow.com/q/22972840
tags question: http://stackoverflow.com/q/23103901
tags question: http://stackoverflow.com/q/23119454
tags question: http://stackoverflow.com/q/23079364
tags question: http://stackoverflow.com/q/23085139
tags question: http://stackoverflow.com/q/23123118
tags question: http://stackoverflow.com/q/23011672
tags question: http://stackoverflow.com/q/22972947
tags question: http://stackoverflow.com/q/23108597
tags question: http://stackoverflow.com/q/23078603
tags question: http://stackoverflow.com/q/23108904
tags question: http://stackoverflow.com/q/23055964
tags question: http://stackoverflow.com/q/23056329
tags question: http://stackoverflow.com/q/22976852
tags question: http://stackoverflow.com/q/23051880
tags question: http://stackoverflow.com/q/22968520
tags question: http://stackoverflow.com/q/23113144
tags question: http://stackoverflow.com/q/22972548
tags question: http://stackoverflow.com/q/23036714
tags question: http://stackoverflow.com/q/23090116
tags question: http://stackoverflow.com/q/23019775
tags question: http://stackoverflow.com/q/22996291
tags question: http://stackoverflow.com/q/23082520
tags question: http://stackoverflow.com/q/23103278
tags question: http://stackoverflow.com/q/23051132
tags question: http://stackoverflow.com/q/23055437
tags question: http://stackoverflow.com/q/23061435
tags question: http://stackoverflow.com/q/23026973
tags question: http://stackoverflow.com/q/23079792
tags question: http://stackoverflow.com/q/23078747
tags question: http://stackoverflow.com/q/23123710
tags question: http://stackoverflow.com/q/23081178
tags question: http://stackoverflow.com/q/23091183
tags question: http://stackoverflow.com/q/23000536
tags question: http://stackoverflow.com/q/23074809
tags question: http://stackoverflow.com/q/23073513
tags question: http://stackoverflow.com/q/23018836
tags question: http://stackoverflow.com/q/23036640
tags question: http://stackoverflow.com/q/23038940
tags question: http://stackoverflow.com/q/23009956
tags question: http://stackoverflow.com/q/22987392
tag name: hibernate
tags question: http://stackoverflow.com/q/23116081
tags question: http://stackoverflow.com/q/23010131
tags question: http://stackoverflow.com/q/23015554
tags question: http://stackoverflow.com/q/23107586
tags question: http://stackoverflow.com/q/23005593
tags question: http://stackoverflow.com/q/22976563
tags question: http://stackoverflow.com/q/23108644
tags question: http://stackoverflow.com/q/23028512
tags question: http://stackoverflow.com/q/22974901
tags question: http://stackoverflow.com/q/23095610
tags question: http://stackoverflow.com/q/23029722
tags question: http://stackoverflow.com/q/23011589
tags question: http://stackoverflow.com/q/23018179
tags question: http://stackoverflow.com/q/23014644
tags question: http://stackoverflow.com/q/23117149
tags question: http://stackoverflow.com/q/23083479
tags question: http://stackoverflow.com/q/23127603
tags question: http://stackoverflow.com/q/23087230
tags question: http://stackoverflow.com/q/22974970
tags question: http://stackoverflow.com/q/23012961
tags question: http://stackoverflow.com/q/23039965
tags question: http://stackoverflow.com/q/23082445
tags question: http://stackoverflow.com/q/22972241
tags question: http://stackoverflow.com/q/23095989
tags question: http://stackoverflow.com/q/22984851
tags question: http://stackoverflow.com/q/23049498
tags question: http://stackoverflow.com/q/23071841
tags question: http://stackoverflow.com/q/23007356
tags question: http://stackoverflow.com/q/23019052
tags question: http://stackoverflow.com/q/23066779
tags question: http://stackoverflow.com/q/23121805
tags question: http://stackoverflow.com/q/23006172
tags question: http://stackoverflow.com/q/23046399
tags question: http://stackoverflow.com/q/23042575
tags question: http://stackoverflow.com/q/23087136
tags question: http://stackoverflow.com/q/23111813

http://stackoverflow.com/comment/35222423
type: AnswerComment
has text: Thank you this was really helpful. I thought that mouseListener would have access to my color variables and thus be able to change them and calling repaint would display the new tone.
type: Comment
comment on: http://stackoverflow.com/a/23051724
score: 0

http://stackoverflow.com/q/23057708
tagged with: servlets
has comment: http://stackoverflow.com/comment/35243320
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35233031
score: 1
has comment: http://stackoverflow.com/comment/35234514
favorite count: 0
has answer: http://stackoverflow.com/a/23057920
upvote count: 1
type: AnsweredQuestion
tagged with: java
has body: I have a application which is deployed on tomcat with servlet version 2.4, and its working nicely. When i tried to deploy the same application on websphere, deployment failed. I found that multiple url-patterns causing the issue. example code:- ABCD com.x.y.filters.ABCD ABCD /A/* /B/* /C/* *.jsp So my question is that why servlet version 2.4 is not working with websphere (NOTE: if i use 3.0 its working). In my understanding servlet version specific to what we are deploying. I am using websphere 8 which supports 3.0 and lower servlet versions. Please help me to understand better.
has title: deployment issue with multiple url-patterns?
tagged with: tomcat6
type: Question
accepted answer: http://stackoverflow.com/a/23057920
tagged with: websphere-8

http://stackoverflow.com/a/23078018
has comment: http://stackoverflow.com/comment/35270493
answers question: http://stackoverflow.com/q/23060120
type: AcceptedAnswer
score: 0
type: Answer
has body: If you want to return only JSON (do not support XML), then simply remove all JAXB annotations from MyData and you will get a pretty good structure, but without the wrapping "MyData" element (which seems redundant to me). You could e.g use core Jackson annotations, like @JsonIgnore (instead of JAXB's). If you want to add the root wrapping element, you could set the WRAP_ROOT_VALUE to true.
accepted answer of: http://stackoverflow.com/q/23060120

http://stackoverflow.com/q/23070892
has title: http multipart post request with json and an image with koush/ion library
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/23126838
tagged with: ruby
upvote count: 2
has body: I'm trying to post a multipart data consisting of image and json object parameter "status" from Android OS to Ruby rails server. I'm doing an android version of a completed iOS app so the server side works. But I can't seem to get it to work on android with or without any libraries. On the server side, this has to be received for it to work. &gt;&gt;&gt;&gt; params: {"status"=&gt;{"body"=&gt;"Make love, not Warcraft. "}, "photo"=&gt;#&lt;ActionDispatch::Http::UploadedFile:0x007f36a89e5738 @tempfile=#&lt;Tempfile:/tmp/RackMultipart20140414-29241-gy4qeo&gt;, @original_filename="iUEb2W9cnxG6", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"photo\"; filename=\"iUEb2W9cnxG6\"\r\nContent-Type: image/jpeg\r\n"&gt;, "format"=&gt;"json", "action"=&gt;"create", "controller"=&gt;"api/statuses", "version"=&gt;"1"} But when I do this, it doesn't work. JsonParser jp = new JsonParser(); JsonObject postbody = (JsonObject)jp.parse("{\"status\": { \"body\": \""+ text.getText().toString() +"\", \"venue\": null}}"); System.out.println("Start uploading image using Ion Library"); Ion.with(it, The.url("/1/statuses")) .setHeader("uuid", The.uuid(it).toString()) .setHeader("Content-Type","application/json") .setMultipartParameter("status", postbody.toString()) .setMultipartFile("image", "image/jpeg", selectedFile) .asJsonObject() .setCallback(new FutureCallback&lt;JsonObject&gt;() { @Override public void onCompleted(Exception e, JsonObject result) { System.out.println("Posted result "+ e + " " + result+ The.url("/1/statuses")); }}); } } What I get from the server is basically parsing error. I, [2014-04-14T17:21:01.411626 #29241] INFO -- : Started POST "/1/statuses" for 64.179.216.50 at 2014-04-14 17:21:01 -0400 D, [2014-04-14T17:21:01.415493 #29241] DEBUG -- : Error occurred while parsing request parameters. Contents: ------------------------------806fe35005b7480e81c10fc5c7ce33ef Content-Disposition: form-data; name="status" {"body":"i h8 u","venue":null} -----…
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/36326961
tagged with: http
has answer: http://stackoverflow.com/a/23126838
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/36326961

http://stackoverflow.com/comment/35336855
type: Comment
has text: @PabloGlez Did you specify the proper DB_URL, USER and PASS? In the DB_URL you specify you database, then pass your username and Password.
comment on: http://stackoverflow.com/a/23115628
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35300552
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23093748
has text: Have you tried declaring `time` as `volatile`?
score: 0

http://stackoverflow.com/q/23088597
tagged with: spring-mvc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23204790
tagged with: java
has body: I know this seems to be a weird requirement, but when customer want it means we are left with no other choice. I am working on a web application (E-Commerce), and need to register a new customer, till now everything is working perfectly. However there is requirement with following cases If customer register with certain email-id they will be approved instantly and will be allowed to browse, see everything and will be allowed to perform any transactions. For other set of customers, they are allowed to log in, but they have read only access to there profile section as well can not see prices (discounted one) for products as well not allowed to do any transactions. Since these use cases does not apply to certain category, but to entire web application, I am not sure how best we can achieve this. Few options coming to my mind Add a new role under spring security, and for those who have read only access should have this new role. create some kind of HandlerInterceptor which will check for customer role before executing actual request. But not sure if I am thinking in right direction and how exactly we should enforce read only access to such type of customers.Since We have to stop such customer from Update his/ her profile Update password. Any other updation in there profile Not allow customer to checkout Actual discounted prices should not be visible
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/23204790
has answer: http://stackoverflow.com/a/23201828
downvote count: 0
has answer: http://stackoverflow.com/a/23139292
has title: Read only access to certain logged in customer | Spring-MVC
favorite count: 0
answer count: 3
upvote count: 6
score: 6
possible better answer: http://stackoverflow.com/a/23139292
tagged with: spring

http://stackoverflow.com/q/23088466
answer count: 1
has answer: http://stackoverflow.com/a/23601159
favorite count: 0
upvote count: 3
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/38208617
has body: So I have the right implementation and it's getting called just fine, but there is no method LoggerFactory#getContext(String name) ..so how can it make any decisions if I can't pass anything in on which to make decisions upon? There is a ContextSelector#getLoggerContext(String name) but I dont have access to it? So my point is: How can I make any sort of "selection" when I can't pass things into my selector or have any sort of access to the selector? I need to have multiple contexts (with different configurations loaded obviously) from which I select at runtime according to my own logic. I have found a solution to simply create LoggerContexts and configure them, but I just don't understand the point of this alternative mechanism then.
has title: What is the point of Logback's custom context selector?
score: 3
tagged with: java
type: Question
downvote count: 0
tagged with: logback

http://stackoverflow.com/q/22975117
has answer: http://stackoverflow.com/a/22975321
score: 6
type: Question
tagged with: eclipse
linked to: http://stackoverflow.com/q/16816405
has title: Is there a Java tool to reduce the visibility of methods
has answer: http://stackoverflow.com/a/42312621
answer count: 2
downvote count: 0
has body: I have a legacy code base that I want to refactor to reduce the visibility of methods to the minimum possible (private, protected, default) such that the code still works. Many of the methods in the codebase are unnecessarily public, and I'd like to change that to reduce the interface burden and simplify documentation as the code evolves in the future. Is there a tool that will analyze the codebase and generate a list of suggested methods whose visibility can be reduced? I can specify all the entry points into the code (just the main methods), and the codebase doesn't use reflection. An Eclipse plugin will be even better.
favorite count: 0
has comment: http://stackoverflow.com/comment/71779438
type: UnansweredQuestion
upvote count: 6
has comment: http://stackoverflow.com/comment/36914303
has comment: http://stackoverflow.com/comment/35083770
tagged with: java

http://stackoverflow.com/comment/35124059
type: QuestionComment
comment on: http://stackoverflow.com/q/22996407
has text: Ok, that's fine. I have been working in Java over these years and never did i question it. Will go through the online resources. Thanks for your efforts and time
score: 0
type: Comment

http://stackoverflow.com/a/23072191
has comment: http://stackoverflow.com/comment/35259856
score: 0
upvote count: 1
downvote count: 1
has body: Gradle requires that you define fragmentManager in your code.
has comment: http://stackoverflow.com/comment/35260047
type: Answer
answers question: http://stackoverflow.com/q/23072129

http://stackoverflow.com/comment/35134120
score: 0
type: Comment
type: QuestionComment
has text: I am not referencing any Android specific code from my desktop project.
comment on: http://stackoverflow.com/q/23002343

http://stackoverflow.com/q/23059749
has title: Printing calling class name in logs using logback
type: Question
has answer: http://stackoverflow.com/a/23066442
score: 0
answer count: 1
has body: I have a problem in logging class name of calling class. I have logging utility class written in logback. I created the logger Utility using singleton pattern for some performance reasons. But when I call a logging statement from other class i get to print utility's class name not the calling class. private static LogUtil logutil =null; public static LogUtil getInstance(){ if(logutil==null){ logutil = new LogUtil(); } return logutil; } protected static final Logger LOGGER = (Logger)LoggerFactory.getLogger("MyModule"); public void info(String Message){ if(LOGGER.isInfoEnabled()){ LOGGER.info(Message); } } Test class is something like public class LogUtilTest { public static void testforlogging(){ logutil.info(“Im Logging this message”); } } I’m getting output as below printing LogUtil instead of LogUtilTest, I need help on logging my calling class name 2014-04-14 16:47:21 INFO [main] MyModule [LogUtil.info:42] Class Name [com.commonutil.logging.LogUtil] - Method [testforlogging] - No of Person's data-100001
accepted answer: http://stackoverflow.com/a/23066442
tagged with: log4j
tagged with: logging
type: AnsweredQuestion
tagged with: java
tagged with: logback

http://stackoverflow.com/q/22996376
has body: I'm running across a similar issue to FragmentActivity can not be tested via ActivityInstrumentationTestCase2 The problem with the top solution there is that only applies to using the Eclipse build system. I'm using Gradle for my project. On my Nexus 5 running the ART runtime, my Espresso instrument tests run perfectly. When I use a Nexus 4 on the Dalvik runtime or an emulator, I run into an exception that doesn't occur when running the app outside of the testing framework. java.lang.NoClassDefFoundError: com.packagename.fragment.ProgressDialogFragment In the logs, I find these suspicious messages similar to the linked question: Class resolved by unexpected DEX: Landroid/support/v4/app/DialogFragment2;(0x41e969d8):0x76064000 ref [Landroid/support/v4/app/DialogFragment;] Landroid/support/v4/app/DialogFragment;(0x41e969d8):0x75883000 (Landroid/support/v4/app/DialogFragment2; had used a different Landroid/support/v4/app/DialogFragment; during pre-verification) Unable to resolve superclass of Landroid/support/v4/app/DialogFragment2; (271) Link of class 'Landroid/support/v4/app/DialogFragment2;' failed Unable to resolve superclass of Lcom/packagename/fragment/ProgressDialogFragment; (270) Link of class 'Lcom/packagename/fragment/ProgressDialogFragment;' failed Could not find method com.packagename.fragment.ProgressDialogFragment.newInstance, referenced from method com.packagename.activity.IntroActivity.doJoin VFY: unable to resolve static method 47365: Lcom/packagename/fragment/ProgressDialogFragment;.newInstance (I)Landroid/support/v4/app/DialogFragment2; VFY: replacing opcode 0x71 at 0x0063 ProgressDialogFragment is a subclass of DialogFragment2 which is a subclass of the Android support library's DialogFragment class Here are the dependencies in my Gradle file if that helps: compile 'com.android.support:support-v4:+' compile 'com.android.support:appcompat-v7:+' compile 'com.google.android.gms:play-services:+' compile 'com.google.code.findbugs:jsr305:+' compile 'com.fa…
has title: Issues running Espresso instrument tests on Dalvik runtime devices
type: AnsweredQuestion
tagged with: android-gradle-plugin
downvote count: 0
tagged with: java
tagged with: gradle
tagged with: android-espresso
type: Question
upvote count: 6
answer count: 1
linked to: http://stackoverflow.com/q/5561353
favorite count: 0
has answer: http://stackoverflow.com/a/23142751
accepted answer: http://stackoverflow.com/a/23142751
tagged with: android
score: 6

http://stackoverflow.com/q/23044557
type: Question
accepted answer: http://stackoverflow.com/a/23044731
upvote count: 1
linked to: http://stackoverflow.com/q/16485687
tagged with: java
has comment: http://stackoverflow.com/comment/35209403
has answer: http://stackoverflow.com/a/23044731
has comment: http://stackoverflow.com/comment/35208923
has answer: http://stackoverflow.com/a/23044832
answer count: 4
type: AnsweredQuestion
has title: Java String: split String
downvote count: 0
has body: I have this String: String string="NNP,PERSON,true,?,IN,O,false,pobj,NNP,ORGANIZATION,true,?,p"; How can I do to split it into an array every 4 commas? I would like something like this: String[] a=string.split("d{4}"); a[0]="NNP,PERSON,true,?"; a[1]="IN,O,false,pobj"; a[2]="NNP,ORGANIZATION,true,?"; a[3]="p";
tagged with: string
score: 1
has answer: http://stackoverflow.com/a/23044599
possible better answer: http://stackoverflow.com/a/23044945
favorite count: 0
has answer: http://stackoverflow.com/a/23044945

http://stackoverflow.com/comment/35356523
comment on: http://stackoverflow.com/q/23126450
score: 1
has text: check the [documentation](http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#random) and [source code](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/Math.java#Math.random%28%29)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23000536
has body: I was following a tutorial to get start with Hibernate, there a note given to add Hibernate artifact id as org.hibernate hibernate 3.2.3.ga and with it lot of other dependency like , dom4j, javax.transaction (JTA) etc.. but the latest hibernate version is "4.3.5.Final"(gathered from hibernate.org), and artifact id given there was : org.hibernate hibernate-core 4.3.5.Final with no extra dependencies to add in pom.xml of my sample When I compiled my project with tutorial way, in my .m2 directory org.hibernate got created and it has everything which is needed for sample to run. I deleted everything in repo and compiled only using hibenate-core (given on hibernate.org), all the necessary things were downloaded and sample ran successfully with this too. I tried to see the pom.xml of the hibernate-core in .m2, and noticed that dependencies for things like dom4j and transactions are added here. (hence may be no need to add in sample's pom.xml). Also noticed that the trasaction API are now used form Jboss.spec.javax. I am confused that, what is the correct way? Is hibernate-core is the latest way of doing things? and what are the differences with "hibernate" artifact? Why things like transaction API implementation is changed from java.transaction to org.jboss.spec.javax.transaction? Where can I find these things in details?
has title: Hibernate artifact id "hibernate-core" with version 4.3.5.Final and artifact id "hibernate" with version 3.2.3.ga
favorite count: 0
type: UnansweredQuestion
tagged with: spring
score: 2
has answer: http://stackoverflow.com/a/23001509
upvote count: 2
tagged with: java
tagged with: hibernate
tagged with: maven
type: Question
tagged with: jpa
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/35209584
type: Comment
type: QuestionComment
has text: I'm afraid that a manual loop over all the servers will sooner or later cause you serious headaches (related to a consistent state of these servers). What happens when a server is unreachable, are you going to be able to later execute all the statements it missed? There are replication solutions for MSSQL, look into these.
score: 0
comment on: http://stackoverflow.com/q/23044719

http://stackoverflow.com/q/23113918
accepted answer: http://stackoverflow.com/a/23113997
has body: I keep getting this error and I cannot figure out as to why it continues to happen. C:\Users\Clay\Desktop&gt;javac PartyOrder.java PartyOrder.java:276: error: cannot find symbol srtInfo+="\n Banners" + banners + " @ $2.00 = " + d1.format(ba nners * 2.00) + " * Discount Rate: " + discount('N') + " = " + subtotal('N'); ^ symbol: variable srtInfo location: class PartyOrder 1 error C:\Users\Clay\Desktop&gt; Here is the source code, I have tried rewriting the line several times, but that didn't help either. I looked on here for anything similar but i couldn't find it, thanks for the help in advance. import java.text.DecimalFormat; public class PartyOrder { int balloons; //number of balloons int candles; //number of candles int banners; //number of banners ordered char shippingOption; //either O,T,P DecimalFormat d1 = new DecimalFormat ( "$##0.00" ); public PartyOrder() { }//end PartyOrder() public PartyOrder(int balloons, int candles, int banners, char shipping) { balloons = this.balloons; candles = this.candles; banners = this.banners; shippingOption = shipping; }//end PartyOrder(int,int,int,char) public void setBalloons(int num) { if (num&gt;0) { balloons = num; } }//end setBalloons(int) public void setCandles(int num) { if (num&gt;0) { candles = num; } }//end setCandles(int) public void setBanners(int num) { if (num&gt;0) { banners = num; } }//end setBanners(int) public void setShipping(char option) { if(option == 'O' &amp;&amp; option == 'o') {; shippingOption = 'O'; } else if (option == 'T' &amp;&amp; option == 't') { shippingOption = 'T'; } else if (option == 'P' &amp;&amp; option == 'p') { shippingOption = 'P'; } else { shippingOption = 'N'; } }//end setShipping(int) public int getBalloons() { return balloons; }//end getBalloons() public int getCandles() { return candles; }//end getCandles() public int getBanners() { return banners; }//end getBanners() public int getShipping() { return shippingOption; }//end getShipping() public double shippingCost() { double dShi…
score: 0
answer count: 1
has title: Error: cannot find symbol for a "
has answer: http://stackoverflow.com/a/23113997
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/22979551
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/22979793
has title: Java code for creating SOAP request from wsdl
tagged with: wsdl
tagged with: soap
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: web-services
tagged with: java
has body: I have a requirement of creating SOAP request xml for one operation from wsdl(using wsdl url). I am getting a response from a web service call.I need to take some values from this response and add it to another web service Soap request and do a web service call again. So in order to add the new value to the soap request I need to get it's complete soap requst xml.So that's why I was asking how to get soap request xml from wsdl.I cannot use SoapUI since it's dynamic everytime, so I need to write a java code. I tried using something similar to below code: WsdlProject project = new WsdlProject(); WsdlInterface[] wsdls = WsdlImporter.importWsdl(project, "&lt;wsdl url&gt;"); WsdlInterface wsdl = wsdls[0]; for (Operation operation : wsdl.getOperationList()) { WsdlOperation op = (WsdlOperation) operation; System.out.println("OP:"+op.getName()); System.out.println(op.createRequest(true)); System.out.println("Response:"); System.out.println(op.createResponse(true)); } but I was getting exception java.lang.NoClassDefFoundError: org/fife/ui/rtextarea/RTextArea" in line "WsdlProject project = new WsdlProject(); I imported latest jars (soapui-xmlbeans-4.5.0,wsdl-xmlbeans-1.1,soapui-4.5.0) but still throwing exception. Could anybody"http://www.soapui.org/repository/eviware/" suggest how can I rectify it? Is there any other approach which I can take apart from this?
type: Question

http://stackoverflow.com/q/22994023
tagged with: batch-file
answer count: 1
has comment: http://stackoverflow.com/comment/35117815
tagged with: input
type: AnsweredQuestion
has body: I'm trying to provide input for simple batch file, that expecting two lines of input: @echo off set /p file1="Enter: " set /p file2="Enter: " echo "1" &gt; %file2% My code is: public static void main(String[] args) throws Exception { Process p = new ProcessBuilder("cmd.exe", "/c", "test.cmd").start(); try (BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()))) { bw.write("1"); bw.newLine(); bw.write("2"); bw.newLine(); } } And I'm expecting that file with name "2" will be created, but nothing happens. What's wrong with this code?
tagged with: java
has title: Writing several lines to batch process
tagged with: process
tagged with: output
has comment: http://stackoverflow.com/comment/35117534
has answer: http://stackoverflow.com/a/22994755
type: Question
accepted answer: http://stackoverflow.com/a/22994755
score: 0

http://stackoverflow.com/a/22971744
has comment: http://stackoverflow.com/comment/35077481
type: Answer
has comment: http://stackoverflow.com/comment/35077680
score: 2
has comment: http://stackoverflow.com/comment/35078730
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/35078287
has comment: http://stackoverflow.com/comment/35077321
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22971699
has comment: http://stackoverflow.com/comment/35077860
has comment: http://stackoverflow.com/comment/35078493
answers question: http://stackoverflow.com/q/22971699
has comment: http://stackoverflow.com/comment/35077619
has body: This might be a bug with the DBCP library, although I would have to look at the JDBC spec. Have you tried using native JDBC PreparedStatement for your driver? EDIT: Looking at the MySQL connector source code (available here) it looks like the implementation of Connection.close() actually closes all the statements associated with the connection. So when using the MySQL JDBC driver, PreparedStatement.isClosed() will return true if the connection was closed. I am not quite sure what the JDBC specification says about this though. In your case, I am not sure if the DBCP library is delegating the call to isClosed() to the underlying driver or not, that's why I recommend removing this extra layer and see what happens. If there is a bug in DBCP, I would report it. If there is a bug in the underlying driver you are using, I would report that too. Assuming this would be a bug indeed. EDIT 2: Per the comments, the JDBC 4.1 specification says (section 9.4.4.1): Connection.close An application calls the method Connection.close() to indicate that it has finished using a connection. All Statement objects created from a given Connection object will be closed when the close method for the Connection object is called. So I would expect the statement to be indeed closed. So there is a bug either in the DBCP library or the MS SQL Server driver in use.
has comment: http://stackoverflow.com/comment/35077293
has comment: http://stackoverflow.com/comment/35077823

http://stackoverflow.com/a/23124745
score: 3
has body: Remove the ; at the end of the for loop. By adding semi colon at the end, you are limiting the scope of the variable x for (int x = 0; x &lt; n; x++); // &lt;--- remove this semi colon
upvote count: 3
answers question: http://stackoverflow.com/q/23124721
downvote count: 0
type: Answer

http://stackoverflow.com/q/22972135
type: AnsweredQuestion
tagged with: android
tagged with: android-activity
has answer: http://stackoverflow.com/a/22972593
type: Question
score: 0
answer count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35078598
accepted answer: http://stackoverflow.com/a/22972593
has comment: http://stackoverflow.com/comment/35078554
possible better answer: http://stackoverflow.com/a/22972616
has answer: http://stackoverflow.com/a/22972616
has comment: http://stackoverflow.com/comment/35078426
has comment: http://stackoverflow.com/comment/35078512
has body: I have created an listview based app in which when I add data through another activity the data doesn't get updated in the listview where as it should get updated in the listview !! when I have created an onSave method on the save button in the activity but it doesnt seem to get updated in the list view. mainactivity.java package com.example.listviewdemo; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.ListView; public class MainActivity extends Activity { TimeTrackerAdapter timeTrackerAdapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ListView listView = (ListView) findViewById(R.id.times_list); timeTrackerAdapter = new TimeTrackerAdapter(); listView.setAdapter(timeTrackerAdapter); } public boolean onCreateOptionsMenu(Menu m) { super.onCreateOptionsMenu(m); MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.time_list_menu, m ); return true; } public static final int TIME_ENTRY_REQUEST_CODE = 1; public boolean onMenuItemSelected(int featureId, MenuItem item) { if (item.getItemId() == R.id.add_time_menu_item) { Intent intent = new Intent(this, AddTimeActivity.class); startActivityForResult(intent, TIME_ENTRY_REQUEST_CODE); return true; } return super.onOptionsItemSelected(item); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == TIME_ENTRY_REQUEST_CODE) { if (resultCode == RESULT_OK) { String notes = data.getStringExtra("notes"); String time = data.getStringExtra("time"); timeTrackerAdapter.addTimeRecord( new TimeRecord(time, notes)); timeTrackerAdapter.notifyDataSetChanged(); } } } } addtimeactivity.java package com.example.listviewdemo; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import…
has title: Cannot update listview through activity
tagged with: listview
has comment: http://stackoverflow.com/comment/35078649
has comment: http://stackoverflow.com/comment/35078857
tagged with: android-listview

http://stackoverflow.com/q/23032879
tagged with: java
type: Question
has title: how to add buttons and panels in frame in java awt
answer count: 2
downvote count: 0
tagged with: button
tagged with: awt
favorite count: 0
has answer: http://stackoverflow.com/a/23033087
has body: How to make java awt program in which first line contains text-field,next 5 lines contain 5 buttons each and next 4 lines contain 4 buttons each. And how to set the size of those buttons and space between them ? I have tried this using 3 panels but not working. (sample program made by me but is not showing anything) `import java.awt.*; class cal extends Frame { cal(){ Panel p1=new Panel(); Panel p2=new Panel(); Panel p3=new Panel(); p1.setLayout(new GridLayout(2,3)); p2.setLayout(new GridLayout(2,2)); TextField k=new TextField("0",20); Button a=new Button("HI"); Button b=new Button("HI"); Button c=new Button("HI"); Button d=new Button("HI"); Button e=new Button("HI"); Button l=new Button("Hello"); Button g=new Button("Hello"); Button h=new Button("Hello"); Button i=new Button("Hello"); p1.add(a); p1.add(b); p1.add(c); p1.add(d); p1.add(e); p2.add(l); p2.add(g); p2.add(h); p2.add(i); Frame f=new Frame(); f.setSize(500,500); f.add(p3); f.add(p1); f.add(p2); show(); } public static void main(String[] args){ new cal();} }`
has answer: http://stackoverflow.com/a/23032950
type: UnansweredQuestion
upvote count: 1
score: 1

http://stackoverflow.com/comment/35082310
type: Comment
comment on: http://stackoverflow.com/a/22972564
has text: Have you tried to open your Jar and see if the images is in the jar?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35351593
comment on: http://stackoverflow.com/q/23123118
type: Comment
has text: I'm marking this question as 'answered' because the responses you all gave got me past the original problem, and the errors I'm having to fix now are too different from that problem to keep this question active. Thanks!
score: 0
type: QuestionComment

http://stackoverflow.com/a/23104840
has comment: http://stackoverflow.com/comment/35319805
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35320384
accepted answer of: http://stackoverflow.com/q/23104363
answers question: http://stackoverflow.com/q/23104363
has body: You're basically implementing a part of JPA yourself. In JPA a class maps to a database table, and you think in terms of entities instead of database tables. You might want to explore that later on (unless you wish to do so now). If you just want to map database data into objects, you have a few reasonable choices. Do as you're doing now, make each database table have a related class (User is a lot better name for a class than UserFR17getset by the way), then you can manipulate the data as objects. A more higher level approach is to have the classes reference to other tables, so your User class would contain an Address reference (assuming there's a table Address), and when loading a User, it would also load the Address. This is similar to how JPA works, and then you would be able to do a single "load user 1" instead of "load user 1, load address for user 1". Of course you would be responsible for implementing the actual loading (unlike with JPA, where there's a lot of automation going on). Don't make the Connection object a part of your class though, it has no business being there. You should use the Connection object with your loading method, such as User u = loadUser(connection, userId);
score: 0

executorservice
type: Tag
tags question: http://stackoverflow.com/q/23119711
tags question: http://stackoverflow.com/q/23106824
tags question: http://stackoverflow.com/q/23051604
tags question: http://stackoverflow.com/q/23002090
tags question: http://stackoverflow.com/q/23054690
tag name: executorservice
tags question: http://stackoverflow.com/q/23014606

http://stackoverflow.com/q/23041875
tagged with: java
has comment: http://stackoverflow.com/comment/35204943
has comment: http://stackoverflow.com/comment/35206366
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35204399
has comment: http://stackoverflow.com/comment/35209065
score: 0
has comment: http://stackoverflow.com/comment/35204649
has comment: http://stackoverflow.com/comment/35204443
upvote count: 1
downvote count: 1
has title: Store data of an application?
favorite count: 0
has comment: http://stackoverflow.com/comment/35204425
has body: I am looking for a good possibility to store data online. I am programming with Java and Android. So there should be an interface to get access to these data. The most files are images. There is an increasing number of images. One image has a file size of nearly 200kb. What is a common way to store these data? I need a good performance. So there should be a fast response and unlimited traffic. Maybe you can show me some options for secure data storage. I have looked for webservers to store data. But many of these do not allow to store application data like images.
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23042477
has comment: http://stackoverflow.com/comment/35212662

http://stackoverflow.com/a/23096247
downvote count: 0
has comment: http://stackoverflow.com/comment/139603022
has body: Bug Report There's a bug report about this on Logback's JIRA page. There hasn't been much development since 24/Feb/10 3:57 PM. I've just voted to attract attention. You should too. I would provide my own date format that matches ISO 8601's. Insert "T" This should do the trick: %d{"yyyy-MM-dd'T'HH:mm:ss,SSS"} [%thread] %-5level %logger{35} - %msg %n The "" are needed to make the , work as described in the documentation. That element belongs in your Logback configuration setting. Here is an example logback.xml file: <?xml version="1.0" encoding="UTF-8"?> %date{"yyyy-MM-dd'T'HH:mm:ss,SSSXXX", UTC} [%thread] %-5level %logger{36} - %msg%n <logger name="com.example" level="TRACE"/> <appender-ref ref="STDOUT" /> Time Zone To be more fully ISO 8601 compliant, and for more helpful logging, you should include a time zone. EDIT (Michael-O, 2014-06-15): That is not true, timezone is absolute optional. To include a time zone, pass a second argument (see doc) to the %date. Pass the proper name of a time zone. Avoid the three or four letter time zone codes such as "EST" as they are neither unique nor standardized. For example, pass Australia/Perth. Generally for logging we want UTC (GMT) time, meaning without any offset. In that case, pass UTC. You can display the time zone offset as number of hours and minutes as part of the date-time in the log. Append an X to display the time zone offset as part of the date time value. This… %date{"yyyy-MM-dd'T'HH:mm:ss,SSSXXX", UTC} …produces… 2014-04-16T09:59:24,009Z The XXX works in Java 7 and 8. In earlier versions of Java, you may be able to use a Z in the format definition to generate an offset number that lacks a colon.
type: Answer
score: 74
upvote count: 74
accepted answer of: http://stackoverflow.com/q/23096129
answers question: http://stackoverflow.com/q/23096129
type: AcceptedAnswer

http://stackoverflow.com/q/22978487
has answer: http://stackoverflow.com/a/22980214
has body: I have configured two servers and one active mq server. One server will send a JMS message and the Other server will receive the JMS messages from the active mq server. Usually we will start active mq server and the servers one by one. Now one of the server get's started successfully where as the other throws bind exception with 1099 as port already bind. I have verified none of the process uses the port 1099. Need a workaround if solution is not possible. Exception stack trace [Apr 10 09:58:37] [/] WARN org.apache.activemq.broker.jmx.ManagementContext (JCLLoggerAdapter.java:359) - Failed to start jmx connector: Cannot bind to URL [rmi://localhost:1099/jmxrmi]: javax.naming.NameAlreadyBoundException: jmxrmi [Root exception is java.rmi.AlreadyBoundException: jmxrmi] [Apr 10 09:58:37] [/] WARN org.apache.activemq.broker.jmx.ManagementContext (JCLLoggerAdapter.java:359) - Failed to start jmx connector: Cannot bind to URL [rmi://localhost:1099/jmxrmi]: javax.naming.NameAlreadyBoundException: jmxrmi [Root exception is java.rmi.AlreadyBoundException: jmxrmi] [Apr 10 09:58:37] [/] DEBUG org.apache.activemq.broker.jmx.ManagementContext (JCLLoggerAdapter.java:245) - Reason for failed jms connector start java.io.IOException: Cannot bind to URL [rmi://localhost:1099/jmxrmi]: javax.naming.NameAlreadyBoundException: jmxrmi [Root exception is java.rmi.AlreadyBoundException: jmxrmi] at Thanks.
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: activemq-classic
score: 1
tagged with: java
has title: Two servers: bind exception 1099 when another is trying to start
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35090997

http://stackoverflow.com/comment/35299053
type: QuestionComment
has text: So if I wanted to change it's size, I would have to use imageView.setWidth() imageView.setHeight()?
comment on: http://stackoverflow.com/q/23092178
score: 0
type: Comment

http://stackoverflow.com/q/23109331
has answer: http://stackoverflow.com/a/23109429
tagged with: java
has comment: http://stackoverflow.com/comment/35326009
tagged with: sleep
type: Question
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/35325039
has comment: http://stackoverflow.com/comment/35324885
score: -1
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has title: Change button color and sleep for 1 sec java
has body: How can i change the background of a button to green when i press it , wait for one second and then return to default color background ? thanks
upvote count: 0

http://stackoverflow.com/q/23089372
tagged with: datatable
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23135369
tagged with: java
has title: h:dataTable unable to display distinct rows. It is showing the same rows even with a List of values passed to it
type: Question
tagged with: http://stackoverflow.com/tag/xhtml
tagged with: jsf-2
score: 0
accepted answer: http://stackoverflow.com/a/23135369
tagged with: sql
answer count: 1
has body: I have a dataTable which extracts data from the database. When I have to extract a single row of data, my method works fine. But when I have a number of rows, my method doesn't work. It prints the same rows again and again. Here is my IssuanceBean.java code: public class IssuanceBean { public IssuanceBean() { issueTasks(); } private List&lt;EmployeeDutySchedule&gt; issuanceList=new ArrayList&lt;EmployeeDutySchedule&gt;(); TaskServices ts=new TaskServices(); public List issueTasks() { System.out.println("issueTasks() called"); setIssuanceList(ts.IssuanceTask()); return issuanceList; } EmployeeDutySchedule simply plays as an intermediate with getter and setter of certain strings like emp ID, first_name, last_name etc. My Taskservices.java is the java file where i perform my query and this is the method: public List&lt;EmployeeDutySchedule&gt; IssuanceTask() { List&lt;EmployeeDutySchedule&gt; empDutyList=new ArrayList&lt;EmployeeDutySchedule&gt;(); EmployeeDutySchedule empDuty=new EmployeeDutySchedule(); ResultSet rs=null; String query="Select employee_duty_schedule.emp_id, first_name, last_name, emp_designation, description, task_allocated_id \n" + "From\n" + " transport_department_schema.employee_duty_schedule, \n" + "transport_department_schema.m_subtasks, transport_department_schema.employees_information WHERE\n" + " employees_information.emp_id=employee_duty_schedule.emp_id AND\n" + "employee_duty_schedule.task_allocated_id=m_subtasks.subtask_id\n" + "AND employee_duty_schedule.task_allocated_id LIKE 'L001%'; "; System.out.println(query); rs=MyQueryExe.executeQuery(query); System.out.println("rs "+rs); try { while(rs.next()) { empDuty.setEmpID(rs.getString("emp_id")); empDuty.setFirstName(rs.getString("first_name")); empDuty.setLastName(rs.getString("last_name")); empDuty.setSubTaskID(rs.getString("emp_id")); empDuty.setTaskDescription(rs.getString("emp_id")); empDuty.setDesignation(rs.getString("emp_designation")); empDutyList.add(empDuty); System.out.println("si…

http://stackoverflow.com/q/23011284
tagged with: java
has comment: http://stackoverflow.com/comment/35164784
type: Question
tagged with: eclipse-rcp
tagged with: runtime-error
score: 0
has title: InvocationTargetException caused by SWTError ("no more handles")?
has comment: http://stackoverflow.com/comment/35164538
has comment: http://stackoverflow.com/comment/35165895
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35150443
tagged with: swt
has body: I am experiencing a strange error. I have an Eclipse 3.7.2-based RCP application. When starting it from my run configuration, it throws an InvocationTargetException which is caused by an SWTError (stacktrace below). In the stacktrace there is the message "Could not instantiate splash", however, the splash is shown without any problems. The only line of code from my own code base in the stacktrace is from the Application.class: int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); It is true, in ApplicationWorkbenchAdvisor I have some dubious SWT-based code calling, e.g., the internal (evil!) IDEWorkbenchPlugin: @Override public void initialize(IWorkbenchConfigurer configurer) { super.initialize(configurer); IDE.registerAdapters(); final String ICONS_PATH = "icons/full/"; final String PATH_OBJECT = ICONS_PATH + "obj16/"; Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH); declareWorkbenchImage(configurer, ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT, PATH_OBJECT + "prj_obj.gif", true); declareWorkbenchImage(configurer, ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT + "cprj_obj.gif", true); } public IAdaptable getDefaultPageInput() { IWorkspace workspace = ResourcesPlugin.getWorkspace(); return workspace.getRoot(); } public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { return new ApplicationWorkbenchWindowAdvisor(configurer); } public String getInitialWindowPerspectiveId() { return PERSPECTIVE_ID; } private void declareWorkbenchImage(IWorkbenchConfigurer configurer_p, Bundle ideBundle, String symbolicName, String path, boolean shared) { URL url = ideBundle.getEntry(path); ImageDescriptor desc = ImageDescriptor.createFromURL(url); configurer_p.declareImage(symbolicName, desc, shared); } However, even when I comment out that code and leave the initialize() method with only the call super.initialize(configurer);, the application starts just fine, b…
tagged with: handle

copy
tags question: http://stackoverflow.com/q/23010727
tags question: http://stackoverflow.com/q/23029494
tags question: http://stackoverflow.com/q/23045433
type: Tag
tags question: http://stackoverflow.com/q/22972307
tags question: http://stackoverflow.com/q/23085234
tags question: http://stackoverflow.com/q/23049795
tag name: copy

http://stackoverflow.com/q/23049842
tagged with: java
tagged with: multithreading
type: Question
linked to: http://stackoverflow.com/q/1252190
tagged with: android-fragments
score: 0
has title: How do I stop a subroutine from ending before all contained threads are finished?
has comment: http://stackoverflow.com/comment/35222448
has comment: http://stackoverflow.com/comment/35219047
answer count: 1
has body: Basically, I have several threads each completing tasks. Although I have multithreaded the tasks within this subroutine to speed up overall program speed. I need this subroutine to only close when all threads within it are finished, as after this subroutine is complete the information generated is required by the next subroutine to run in the program. In contrast to what happens now, which is allowing the subroutine to close and leaving contained threads to run in their own time, in the background. Which forces the next subroutine to run, to only act on partial data. How do I do this? Code: public void MainSetupTasks() throws ClientProtocolException, IOException { new Thread(new Runnable() { @Override public void run() { // Tasks to be complete } }).start(); new Thread(new Runnable() { @Override public void run() { // Tasks to be complete } }).start(); new Thread(new Runnable() { @Override public void run() { // Tasks to be complete } }).start(); new Thread(new Runnable() { @Override public void run() { // Tasks to be complete } }).start(); new Thread(new Runnable() { @Override public void run() { // Tasks to be complete } }).start(); new Thread(new Runnable() { @Override public void run() { // Tasks to be complete } }).start(); new Thread(new Runnable() { @Override public void run() { // Tasks to be complete } }).start(); new Thread(new Runnable() { @Override public void run() { // Tasks to be complete } }).start(); }
has answer: http://stackoverflow.com/a/23050152
has comment: http://stackoverflow.com/comment/35218950
has comment: http://stackoverflow.com/comment/35219139
tagged with: android
tagged with: android-activity
has comment: http://stackoverflow.com/comment/35218924
type: UnansweredQuestion

http://stackoverflow.com/q/22972022
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/22972181
has answer: http://stackoverflow.com/a/22972181
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/71338011
type: AnsweredQuestion
tagged with: java
has title: Why does calling getWidth() on a View in onResume() return 0?
linked to: http://stackoverflow.com/q/3591784
type: Question
tagged with: android-layout
has answer: http://stackoverflow.com/a/22972145
upvote count: 9
tagged with: activity-lifecycle
has body: Everything I've read says you can't call getWidth() or getHeight() on a View in a constructor, but I'm calling them in onResume(). Shouldn't the screen's layout have been drawn by then? @Override protected void onResume() { super.onResume(); populateData(); } private void populateData() { LinearLayout test = (LinearLayout) findViewById(R.id.myview); double widthpx = test.getWidth(); }
accepted answer: http://stackoverflow.com/a/22972145
score: 9

http://stackoverflow.com/a/23074318
downvote count: 0
has comment: http://stackoverflow.com/comment/35266841
accepted answer of: http://stackoverflow.com/q/23072907
type: Answer
answers question: http://stackoverflow.com/q/23072907
upvote count: 1
has body: Don't try to find checkboxes on a different activity. Instead, send the information needed in the Intent used to start the next activity.
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/22979543
type: Answer
answers question: http://stackoverflow.com/q/22979334
score: 0
has body: This will work. Setup the commands and then create runtime and execute command there. String command[] = new String[4]; command[0] = "cmd"; command[1] = "/k start cmd /k"; command[2] = "java"; command[3] = path; Process p = Runtime.getRuntime().exec(command); BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); //This will allow you to supply with input BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); //This will provide you access to the errors. pw = new PrintWriter(p.getOutputStream()); pw.println("next commands"); The PrintWriter object will allow you to execute more commands.

http://stackoverflow.com/a/23001064
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22998153
type: Answer
has body: GOT IT. Turns out it was a basic wait-notify problem. Here's my final code for the ChessPanel's "mouseClicked" method: public void mouseClicked(MouseEvent e) { Position clickPosition = getSquare(e.getX(), e.getY()); if(this.selectedPiece.getType() == PieceType.NONE) { // Attempts to select the piece that was just clicked Piece piece = b.getPiece(clickPosition); if(piece.getType() != PieceType.NONE) { this.selectedPiece = b.getPiece(clickPosition); this.selectedPiecePosition = clickPosition; } } else { // Attempts to move the selected piece try { this.playerMove = b.getMove(selectedPiecePosition, clickPosition); synchronized(this) { this.notify(); } } catch(InvalidMoveException ex) { } this.selectedPiece = new NonePiece(); this.selectedPiecePosition = new Position(0, 0); updateCurrentHover(e.getX(), e.getY()); } repaint(); } And for the GUI itself: while(cp.getMove() == null) { try { synchronized(cp) { cp.wait(); } } catch (InterruptedException e) {} } This solved it.
accepted answer of: http://stackoverflow.com/q/22998153

http://stackoverflow.com/comment/35159711
score: 2
type: Comment
has text: Your problem is that your code is incorrectly formatted (seriously). Reformat it and things will be much clearer.
type: QuestionComment
comment on: http://stackoverflow.com/q/23017206

http://stackoverflow.com/comment/35180041
type: Comment
comment on: http://stackoverflow.com/q/23027535
has text: That's very odd - I'd expect the *import* to fail if it couldn't find the type. Are you sure you've got those imports within the same file that's failing?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35141368
type: Comment
has text: Regarding your specific example code, declaring a variable (`int counter;`) mid-way through a `switch` statement is not valid. Move that variable declaration to the first line of your method and you'll be fine.
comment on: http://stackoverflow.com/q/23007251
type: QuestionComment
score: 0

http://stackoverflow.com/q/23032245
downvote count: 0
has title: 4x4 transform matrix decomposition
favorite count: 0
answer count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/78067687
type: UnansweredQuestion
score: 3
tagged with: java
tagged with: matrix-decomposition
has body: I'm trying to decompose a homogeneous coordinates transform matrix which is the result of these transformations matrices (applied in their writing order): non-uniform Scale -> Rotate -> Translate I haven't any problem in extracting the translation coordinates from the resulting 4x4 transfor matrix (the first three values of the last column) but I couldn't find a way to extract the rotation and scaling matrices. I found the following matrix decomposition algorithm on the web: Compute the scaling factors as the magnitudes of the first three basis vectors (columns or rows) of the matrix Divide the first three basis vectors by these values (thus normalizing them) The upper-left 3x3 part of the matrix now represents the rotation (you can use this as is, or convert it to quaternion form) The translation is the fourth basis vector of the matrix (in homogeneous coordinates - it'll be the first three elements that you're interested in) Here comes my java implementation public void decompose(Vec3 translation, Vec4 rotationAxisAndAngle, Vec3 scale) { translation = this.getTranslation(); Vec3 c0 = new Vec3(values[ 0], values[ 1], values[ 2]); Vec3 c1 = new Vec3(values[ 4], values[ 5], values[ 6]); Vec3 c2 = new Vec3(values[ 8], values[ 9], values[10]); scale.x = Vec3.len(c0.x, c0.y, c0.z); scale.y = Vec3.len(c1.x, c1.y, c1.z); scale.z = Vec3.len(c2.x, c2.y, c2.z); Matrix4 mat = new Matrix4(); mat.values[ 0] = c0.x / scale.x; mat.values[ 4] = c1.x / scale.y; mat.values[ 8] = c2.x / scale.z; mat.values[12] = 0; mat.values[ 1] = c0.y / scale.x; mat.values[ 5] = c1.y / scale.y; mat.values[ 9] = c2.y / scale.z; mat.values[13] = 0; mat.values[ 2] = c0.z / scale.x; mat.values[ 6] = c1.z / scale.y; mat.values[10] = c2.z / scale.z; mat.values[14] = 0; mat.values[ 3] = 0; mat.values[ 7] = 0; mat.values[11] = 0; mat.values[15] = 1; rotationAxisAndAngle = mat.toAxisAngle(); System.out.println("&lt;Transform translation=\"" + translation.x + " " + translation.y + " " + translation.z + "\"&g…
type: Question

http://stackoverflow.com/comment/35152463
has text: why is the w: 85 and h:85 because its create a 85x85 size image.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23012825
type: Comment

http://stackoverflow.com/a/23318927
has body: I have got the things done on following manner. EmbeddedId class @Embeddable public class WorkflowPK implements Serializable { @Basic(optional = false) @Column(name = "SEQ_NO") private int seqNo; @JoinColumn(name = "T_ID", referencedColumnName = "ID", nullable = false) @ManyToOne private Template template; } Workflow Entity (with EmbeddedId) @Entity @Table(name = "workflow") public class Workflow implements Serializable { @EmbeddedId private WorkflowPK id; @Basic(optional = false) @Column(name = "NAME") private String name; } Template entity with bidirectional relation @Entity @Table(name = "template") public class Template implements Serializable { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) @SequenceGenerator(name="template_se", sequenceName="TEMPLATE_SE", allocationSize=1, initialValue=1) @Basic(optional = false) @Column(name = "ID") private Integer id; @Basic(optional = false) @Column(name = "NAME", unique = true) private String name; // Refer the filed "template" inside the Composite key of Workflow entity @OneToMany(cascade = CascadeType.REMOVE, mappedBy = "id.template") @LazyCollection(LazyCollectionOption.FALSE) @OrderBy(value = "id.stepSeqNo") private List&lt;Workflow&gt; workflowList; } Command entity with JoinColumn reference @Entity @Table(name = "command") public class Command implements Serializable { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) @SequenceGenerator(name="command_se", sequenceName="COMMAND_SE", allocationSize=1, initialValue=1) @Basic(optional = false) @Column(name = "ID") private Integer id; // Refer the Composite key of Workflow entity @ManyToOne(optional = false) @JoinColumns ({ @JoinColumn(name="WORKFLOW_SEQ_NO_ID", referencedColumnName = "SEQ_NO"), @JoinColumn(name="WORKFLOW_T_ID", referencedColumnName = "T_ID"), }) private WorkflowStep workflow; }
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23066432
answers question: http://stackoverflow.com/q/23066432
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/23092684
answer count: 2
possible better answer: http://stackoverflow.com/a/23092779
has comment: http://stackoverflow.com/comment/35296609
has answer: http://stackoverflow.com/a/23092779
tagged with: variables
score: 0
duplicate of: http://stackoverflow.com/q/8660691
has comment: http://stackoverflow.com/comment/35296880
has answer: http://stackoverflow.com/a/23092721
favorite count: 0
has body: I was wondering what the difference between the variable type 'int' and the variable type 'Integer' and what the uses of using both is. Thanks!
has title: Difference between 'int' and 'Integer' types
upvote count: 1
linked to: http://stackoverflow.com/q/8660691
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23092721
downvote count: 1
type: Question

http://stackoverflow.com/a/23027369
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23027268
has body: Wat does it mean my indirect instanciation of abstract class ? how do we achieve this ? I'd need to see the context in which that phrase is used, but I expect that "indirect instantiation" means instantiation of a non-abstract class that extends your abstract class. For example public abstract class A { private int a; public A(int a) { this.a = a; } ... } public B extends A { public B() { super(42); } ... } B b = new B(); // This is an indirect instantiation of A // (sort of ....) A a = new A(99); // This is a compilation error. You cannot // instantiate an abstract class directly.
type: Answer
score: 2

http://stackoverflow.com/comment/35342637
has text: Better to assign it to a new variable. After you've taken the square root, it's not the radicand any more.
type: Comment
comment on: http://stackoverflow.com/a/23118788
score: 2
type: AnswerComment

http://stackoverflow.com/comment/35362190
has text: Yes, it is a floating-point.
comment on: http://stackoverflow.com/q/23129754
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23021905
answers question: http://stackoverflow.com/q/23021791
has body: The problem is that you're reading the file byte by byte. This can take ton of time. Instead, read the file in bigger piece of chunks, like 4 or 8 KBs: int file_chunk_size = 1024 * 4; //4KBs, written like this to easily change it to 8 byte[] buffer = new byte[file_chunk_size]; int bytesRead = 0; while ( (bytesRead = read(buffer)) &gt; 0 ) { fileOutputStream.write(buffer, 0, bytesRead); }
has comment: http://stackoverflow.com/comment/35169208
score: 0
has comment: http://stackoverflow.com/comment/35170359
has comment: http://stackoverflow.com/comment/35168880
type: Answer

http://stackoverflow.com/comment/35253140
comment on: http://stackoverflow.com/q/23068041
type: Comment
type: QuestionComment
has text: Then can you post the log before the exception where my code run?
score: 1

http://stackoverflow.com/comment/35378203
has text: i've posted some more detail, I think the mapping i proposed gives you the meaning you need
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23121034

http://stackoverflow.com/q/22970337
has comment: http://stackoverflow.com/comment/35074759
tagged with: java
has comment: http://stackoverflow.com/comment/35074644
type: Question
has body: Is there any way to have a JOptionPane.showMessageDialog pop up when you end the program? I am wanting to display a log of users who have logged into my program during that specific run. I have the code completed for displaying the message, just am not sure as to how to get it to display when the program ends. Thanks
has answer: http://stackoverflow.com/a/22970397
score: 0
has title: Message pop up when program ends
answer count: 1
has comment: http://stackoverflow.com/comment/35074692
accepted answer: http://stackoverflow.com/a/22970397
tagged with: joptionpane
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/15198549

http://stackoverflow.com/comment/35083770
comment on: http://stackoverflow.com/q/22975117
type: Comment
has text: Related: http://stackoverflow.com/questions/16816405/is-there-a-tool-in-eclipse-a-plugin-for-eclipse-or-an-external-program-that-ca
type: QuestionComment
score: 2

http://stackoverflow.com/a/23091656
has comment: http://stackoverflow.com/comment/35343680
has body: Please study about Java coding formats first.Then start coding the APP. Each and every variable in java must want to start with a small letter. Only class will start with a Capital letter. Just change this. JPanel Graphic = new JPanel(); Graphic g = new Graphic(stationNo); Graphic.add(g); station.add(Graphic, BorderLayout.NORTH); TO JPanel graphic = new JPanel(); Graphic g = new Graphic(stationNo); graphic.add(g); station.add(graphic, BorderLayout.NORTH); Then you can use repaint() method in a while loop. When the repaint() method is called the paintComponent(Graphics g) method will be fired and the code in it will be executed.
answers question: http://stackoverflow.com/q/23091386
score: 0
type: Answer

phone-state-listener
type: Tag
tag name: phone-state-listener
tags question: http://stackoverflow.com/q/23118000

http://stackoverflow.com/comment/35188183
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23032706
score: 0
has text: @Frazz i don't understand what you are saying when you say prepare two parametrized SQL statements.. can you give me a example.

http://stackoverflow.com/comment/35277781
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23081003
has text: create public static ArrayList<String> addAList=new ArrayList<String>(); variable in the top of your onCreate() method

http://stackoverflow.com/q/23083124
has comment: http://stackoverflow.com/comment/35279292
has comment: http://stackoverflow.com/comment/35281765
has comment: http://stackoverflow.com/comment/35279212
downvote count: 4
answer count: 2
accepted answer: http://stackoverflow.com/a/23086609
favorite count: 0
has comment: http://stackoverflow.com/comment/35279097
has comment: http://stackoverflow.com/comment/35279021
has comment: http://stackoverflow.com/comment/35278874
possible better answer: http://stackoverflow.com/a/23152707
has comment: http://stackoverflow.com/comment/35278828
has comment: http://stackoverflow.com/comment/35278961
has comment: http://stackoverflow.com/comment/35278808
has answer: http://stackoverflow.com/a/23152707
has comment: http://stackoverflow.com/comment/35279363
has comment: http://stackoverflow.com/comment/35281112
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35279024
has body: I need information about where each java class is located. There can be multiple classes in a java file. Therefore, getting java file name is not correct way... One possible way that I can come up with is using Eclipse AST library. But I'm wondering that there is an easier way because I'm not familiar with Eclipse AST... If I should use Eclipse AST, please give me some code snippet that help me search for related information. Update: Input: a location of java project Output: mapping information between java file and java classes declared in the java file. e.g. In A.java, public class A { System.out.println("A class"); class InnerA{ System.out.println("A inner class"); } } class B { System.out.println("B class"); } A.java file links to A.class, A$InnerA.class and B.class
score: -3
has answer: http://stackoverflow.com/a/23086609
upvote count: 1
type: Question
has title: Getting Java Class Names from a Java File
has comment: http://stackoverflow.com/comment/35279147
tagged with: java

http://stackoverflow.com/q/23081544
type: Question
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I need to get the height of my web view so I can programatically work out the top margin. I'm using the AddOnPreDraw method which works fine on phones, but as soon as I use it on a tablet it returns null. ViewTreeObserver viewTreeObserver = topContent.getViewTreeObserver(); viewTreeObserver.addOnPreDrawListener(new OnPreDrawListener() { @Override public boolean onPreDraw() { int height = topContent.getMeasuredHeight(); if (height != 0) { Log.d("Web View Height", "Continue Height: " + height); RelativeLayout instructions = (RelativeLayout) findViewById(R.id.info_layout); instructions.post(mAddTabletMargin); } topContent.getViewTreeObserver().removeOnPreDrawListener( this); return false; } }); So quesiton one is why does it work on phones but not tablets? and question 2 is there any other methods I could use to get the height of the webvie wonce it's been drawn? Thanks in advance.
has title: Android get height of web view
score: 3
tagged with: view
has answer: http://stackoverflow.com/a/23083323
upvote count: 3
tagged with: java
tagged with: webview

http://stackoverflow.com/a/23008814
has comment: http://stackoverflow.com/comment/35144263
has comment: http://stackoverflow.com/comment/35144199
type: Answer
answers question: http://stackoverflow.com/q/23008776
score: 0
has comment: http://stackoverflow.com/comment/35144544
has comment: http://stackoverflow.com/comment/35144606
has comment: http://stackoverflow.com/comment/35143767
has body: use chmod chmod('/path/to/folder/, 0755); if you want to change the ownership use: $path = "/path/to/folder" ; $user_name = "root"; // Set the user chown($path, $user_name);

http://stackoverflow.com/comment/35169210
score: 0
has text: no I mean when I have file_1 and file_2 on the server, I need to display to the user - file_1 \n -file_2 so that when he click he can get the files. I know how to implemented using DB but I don't want to use DB. thank you
type: Comment
comment on: http://stackoverflow.com/a/23021693
type: AnswerComment

http://stackoverflow.com/a/23406534
has body: The gwt-comet-1.2.3.jar is not compatible with GWT 2.5.0-rc1 (or higher). so you need to upgrade the gwt-comet version to 1.2.5. link : https://gwt-comet.googlecode.com/issues/attachment?aid=330005000&amp;name=gwt-comet-1.2.5.jar&amp;token=St1Wda3HoyBJfRyZZ-Vq3zQibKo%3A1398940143165
answers question: http://stackoverflow.com/q/23019267
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23019267

http://stackoverflow.com/comment/35269287
score: 0
has text: Show your code, especially main method like people ask you
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23077064

http://stackoverflow.com/q/23016936
has title: create ArrayList with method and parameter is ArrayList's name
has answer: http://stackoverflow.com/a/23017168
type: Question
accepted answer: http://stackoverflow.com/a/23017168
has body: my question is simple, but haven't found answer anywhere, how can I create array like this: public ArrayList&lt;ArrayList&lt;String&gt;&gt; result_of_query_into_array( ArrayList&lt;String&gt; nameofArray) { nameofArray = new ArrayList&lt;String&gt;(); try { while (result.next()) { nameofArray.add(result.getString("nombre_estadio")); nameofArray.add(result.getString("ciudad")); nameofArray.add(result.getString("capacidad")); nameofArray.add(result.getString("temperatura")); nameofArray.add(result.getString("equipos")); } } catch (SQLException e) { JOptionPane.showMessageDialog(null, "Error en result.next().print..: " + e); } ARRAY_PRINCIPAL_MULTIDIMENSIONAL.add(nameofArray); JOptionPane.showMessageDialog(null, "got all rows from table "); return ARRAY_PRINCIPAL_MULTIDIMENSIONAL; } so when i use this method i have to do this : ArrayList&lt;String&gt; myArray = new ArrayList&lt;String&gt;(); obj.result_ofquery_into_array(myArray); is it posible to just do something like : obj.result_of_query_into_array(myarrayWithoutInstantiatingOutside); when i put just the name of the array i get an error : myarrayWithoutInstantiatingOutside cannot be resolved to a variable please help, thanks
tagged with: arraylist
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35159167
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/23022966
has body: The problem is that you're working with the wrong object. public String toString(){ Mortgage call = new Mortgage(); double mPayment = call.calcMonthlyPayment(); String stats = ("Account number: " + rng +"\nThe monthly payment is $" + mPayment); return stats; } The code in main creates a new Mortgage, and makes method calls that set up the fields. But in the above code, instead of using the fields from this object, you're creating a new Mortgage object, which will then have 0's in all the fields; then you call calcMonthlyPayment on that new object, which returns NaN because it will use the fields in call, which are still 0, instead of the fields in this object, whose fields have the correct data. There's no reason for toString to create a new object: //Mortgage call = new Mortgage(); double mPayment = calcMonthlyPayment();
answers question: http://stackoverflow.com/q/23020099
score: 0
type: Answer

http://stackoverflow.com/q/23023732
tagged with: java
has body: I want to run the following sample code in Eclipse EE, NOT STS. The guide is ehre: https://spring.io/guides/gs/rest-service/ Direct link to code is ehre: https://github.com/spring-guides/gs-rest-service/archive/master.zip The following are the steps I am taking: 1) Extract gs-rest-service-master and copy the directory named "complete" into the worspace directory. 2) Using eclipse, "Import Existing Maven Projects" and select the "complete" directory. The project looks messed up as there is no "Maven Dependencies" despite right clicking and doing a "Maven Install" results in success... 3) I try making it into a faceted Dynamic Web Project 3.0 with Java 1.7. There are errors with Application.java and GreetingController.java, The import org.springframework cannot be resolved Ideally I want to be able to run this in Tomcat, but I have no idea whats causing these errors. In "STS" it is very straightforward to get going, but I want to run in standard eclipse (EE) and not use STS. What is the proper steps to take? I have been trying out enabling and disabling things but they all appear to have no effect. I dont understand why even the "Maven Dependencies" that are supposedly downloaded dont even show up. How to have this project work with Tomcat?
tagged with: eclipse
has answer: http://stackoverflow.com/a/23114119
type: Question
possible better answer: http://stackoverflow.com/a/23100971
score: 0
answer count: 3
has title: How to run Spring 4 sample code in eclipse kepler?
has answer: http://stackoverflow.com/a/23100971
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23088210
accepted answer: http://stackoverflow.com/a/23088210

http://stackoverflow.com/a/23546050
upvote count: 3
score: 3
has body: The problem you are facing is that the maven-license-plugin by default looks in your local repository for the child artifacts. I suppose, your plugin configuration in the parent pom.xml looks like the following: org.codehaus.mojo license-maven-plugin 1.6 You have to install your multi-module project to your local Maven repository using mvn install After that, you run mvn license:aggregate-add-third-party again and the build will succeed. If you configured an <execution> in your plugin, this will fail, since the maven-license-plugin by default binds to the generate-resources phase [1] and this is always executed prior to install [2]. Cheers, PK
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23038269
answers question: http://stackoverflow.com/q/23038269

http://stackoverflow.com/comment/68377858
type: QuestionComment
has text: @bgth Eh? It is not adding it as a String. It is adding it as an `ArrayList`. Not what the OP probably wants, but certainly not what you claim.
type: Comment
comment on: http://stackoverflow.com/q/23044159
score: 0

http://stackoverflow.com/q/22995743
answer count: 1
has body: How can I put a button in the right place ? My code: import java.applet.*; import java.awt.*; public class Banner extends Applet { int x, y; Button button1 = new Button("Try!"); public void init() { setSize(1200, 500); setLayout(new BorderLayout()); //also I tried FlowLayout.. //button1.setBounds(500, 250, 25, 50); // not worked.. add("East", button1); button1.addActionListener(this); } public void start() { } public void paint(Graphics g) { } } For example I have few labels and images in my Applet. And I want put the button somewhere.. And also I want to set size the button, but method setSize() and method setBounds() isn't worked..
tagged with: button
tagged with: applet
has comment: http://stackoverflow.com/comment/35120806
has comment: http://stackoverflow.com/comment/35120905
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35134827
accepted answer: http://stackoverflow.com/a/22996009
type: Question
has comment: http://stackoverflow.com/comment/35120921
has title: Do button have a placement in Applet java?
tagged with: layout
has answer: http://stackoverflow.com/a/22996009
tagged with: awt
score: 0

weka
tags question: http://stackoverflow.com/q/23007108
tags question: http://stackoverflow.com/q/23031261
tags question: http://stackoverflow.com/q/23101475
tag name: weka
type: Tag

http://stackoverflow.com/comment/35167812
score: 0
type: Comment
type: QuestionComment
has text: where are you getting the exception
comment on: http://stackoverflow.com/q/23021425

http://stackoverflow.com/comment/35253039
has text: You'll only occupy all possible values in a 1-dimensional 1000 unit area with 10 divisions (lines). 2 dimensions would need 100 divisions (squares/planes) and 3 dimensions needs 1000 divisions (cubes) to fill the entire space. For example, where does 0, 0, 101 end up? and 0, 0, 201? And 100, 0, 201? etc.
comment on: http://stackoverflow.com/q/23068475
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/23055098
has comment: http://stackoverflow.com/comment/35233809
has comment: http://stackoverflow.com/comment/35264326
type: Answer
has body: I did install jdk 1.6 on centos. You can try same steps for jdk 1.7 : 1) Download JDK version 1.6.0_45 file (jdk-6u45-linux-x64.bin) for 64 bit machine from below link : http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR 2) From terminal, go to the path where you have download these files : cd /path 3) Change the mode of jdk bin file to executable using below cmd : chmod a+x jdk-6u45-linux-x64.bin 4) Also change the mode of jre bin file to executable using below cmd : chmod a+x jre-6u45-linux-x64.bin 5) Execute the bin files using ./jdk-6u45-linux-x64.bin ./jre-6u45-linux-x64.bin This will create folders by jdk and jre names 6) Check default java configured on your machine using command : alternatives --config java Select the current selected version by '+' sign. 7) Run below command to remove the java. alternatives --remove java /path given in the config command 8) Repeat above command until there is no output for config command. Repeat steps 7 to 10 for javac, javaws and libjavaplugin. Now move local folders jdk1.6.0_45 and jre1.6.0_45 to /usr/java directory. 9) Install Sun/Oracle JDK java, javaws, libjavaplugin.so (for Firefox/Mozilla) and javac with alternatives –install command : java alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_45/jre/bin/java 20000 javaws alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.6.0_45/jre/bin/javaws 20000 Java Browser (Mozilla) Plugin 32-bit alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jdk1.6.0_45/jre/lib/i386/libnpjp2.so 20000 Java Browser (Mozilla) Plugin 64-bit alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jdk1.6.0_45/jre/lib/amd64/libnpjp2.so 20000 Install javac only if you installed JDK (Java Development Kit) package alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_45/bin/javac 20000 alternatives --install /usr/bin/…
has comment: http://stackoverflow.com/comment/35259488
answers question: http://stackoverflow.com/q/23053240
score: 0

http://stackoverflow.com/comment/35127301
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22999220
has text: the points are generated first and then you find the longest distance
score: 0

http://stackoverflow.com/comment/35147708
has text: Yeah!!.. I know that ajax calls will do, but they will not make server push. With this every time I have to make a request to get a response. But I need that whenever any changes are made to database, they should be pushed by server to my web page without making a request.
comment on: http://stackoverflow.com/q/23010838
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35102180
type: Comment
comment on: http://stackoverflow.com/a/22981777
type: AnswerComment
has text: Have tried just displaying the progress bar frame in isolation to make sure it's working...
score: 0

http://stackoverflow.com/comment/35194369
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23034679
has text: so you want to delete from 3,5,3. right?
score: 0

http://stackoverflow.com/comment/35234241
score: 0
type: AnswerComment
has text: Why I would like to have in Date format is because I am returning from database as date, thus it would be better to keep it same format for all future process with date.
type: Comment
comment on: http://stackoverflow.com/a/23058446

http://stackoverflow.com/q/23087212
has body: I'm having a bunch of classes that I can not change; all these classes have a common ancestor (other than Object) that declares and implements the majority of their properties and methods. Let's say, we have an inheritance tree like this (for illustration only): class Vehicle class Bicycle extends Vehicle class Skateboard extends Vehicle class Boat extends Vehicle class Car extends Vehicle class Aircraft extends Vehicle class Jetplane extends Aircraft class Helicopter extends Aircraft ... class Truck extends Vehicle ... While class Vehicle is actually more like an abstract class (it is not really, but it is never instantiated on its own behalf), objects of class Aircraft are created occasionally. Now the point: the objects can have interrelationships that are not reflected by the classes. Since it is quite a bouquet of classes and the collection is subject to change every once in a while, it is not practical to maintain a subclass for each of the classes that implement the missing behavior. My approach is therefore to have one class that serves as a wrapper for the above classes. The constructor takes as a parameter the class of the respective object, which is then instantiated using reflection. class VehicleW { // fields public boolean isInitialized=false; private Vehicle fVehicle; ... // constructors public VehicleW(Class aClass, ...) { Class VehicleClass = Vehicle.class; if (!VehicleClass.isAssignableFrom(aClass)) return; // &lt;the reflection magic here&gt; ... // and on success mark this object as usable isInitialized=true; } } A constructor without arguments doesn't really make sense here. But now class Aircraft and its subclasses want some extra properties, so I thought I could establish a class AircraftW extends VehicleW that takes care of them. The modification then looks like this: // fields private Aircraft fAircraft; // constructors public AircraftW(Class aClass, ...) { Class AircraftClass = AirCraft.class; if (!AircraftClass.isAssignableFrom(aClass)) re…
type: AnsweredQuestion
tagged with: reflection
has title: java inheritance with incompatible constructors
downvote count: 2
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23087409
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/35287123
answer count: 2
has answer: http://stackoverflow.com/a/23087403
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/23087409
favorite count: 0
has comment: http://stackoverflow.com/comment/35292929
possible better answer: http://stackoverflow.com/a/23087403

http://stackoverflow.com/q/23113668
tagged with: android
has comment: http://stackoverflow.com/comment/35333604
tagged with: android-studio
has comment: http://stackoverflow.com/comment/35333444
has comment: http://stackoverflow.com/comment/35333333
has comment: http://stackoverflow.com/comment/35333370
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35333050
upvote count: 1
tagged with: android-manifest
type: Question
has comment: http://stackoverflow.com/comment/35333101
has title: Android studio - error : requires API level 14
has comment: http://stackoverflow.com/comment/35333597
has comment: http://stackoverflow.com/comment/35333288
has body: Android keeps complaining I made sure my manifest settings are set to 14 <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> gradle apply plugin: 'android' android { compileSdkVersion 19 buildToolsVersion "19.0.3" defaultConfig { minSdkVersion 14 targetSdkVersion 17 } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.android.support:support-v4:+' }
has comment: http://stackoverflow.com/comment/35333523
downvote count: 0
has comment: http://stackoverflow.com/comment/35333575
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/22969157
downvote count: 0
answers question: http://stackoverflow.com/q/22969067
has comment: http://stackoverflow.com/comment/35075040
has comment: http://stackoverflow.com/comment/35074989
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/35075108
score: 2
has body: post is an instance of the object Post. What you are doing in post.setTitle(...) is modifying post and storing a reference to it in the list. All the elements in the list are references to the same Post object, so if you modify it, all the elements in the list will change. If you want to store diferent Post items, you need to create different Post items each time.
has comment: http://stackoverflow.com/comment/35075273

http://stackoverflow.com/comment/35146128
type: AnswerComment
comment on: http://stackoverflow.com/a/23008059
has text: But if you still get the error then maybe converter is not found by other component? Can you paste the whole jsf page?
type: Comment
score: 1

http://stackoverflow.com/comment/35119500
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22995138
has text: You welcome. The API for regex in java is not ideal but it does the job. Also check [this tutorial](http://docs.oracle.com/javase/tutorial/essential/regex/).
type: Comment

http://stackoverflow.com/comment/35201400
has text: @HarisMehmood that's a strange thing to say.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23040238

http://stackoverflow.com/comment/35084441
score: 0
has text: @developerwjk: I'd be delighted to use it if I can get it to work (see my question--it gives me an error: `Unable to find contextual data of type: javax.servlet.http.HttpServletRequest`. Do you knkow how I could fix that problem? Also, on that link, @marcus says it is not clear if the method shown, using the `.getRequestDispatcher()` is a supported method. Thanks for your interest!
comment on: http://stackoverflow.com/q/22970677
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35088844
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22977871
has text: check my answer here http://stackoverflow.com/questions/22619602/files-encryption-java/22620403#22620403
type: Comment

http://stackoverflow.com/comment/35334693
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23114050
has text: @AngeloImmediata The `Filter` is used through a `DelegatingFilterProxy` which retrieves it from the context. (Assuming it's used correctly.)
score: 0

http://stackoverflow.com/comment/35249541
type: AnswerComment
has text: i tried to use another inputstream but its still cant read the same file, the result is still [BLOB - 0 B]
type: Comment
comment on: http://stackoverflow.com/a/23066263
score: 0

http://stackoverflow.com/comment/35339683
score: 1
comment on: http://stackoverflow.com/q/23117108
type: Comment
type: QuestionComment
has text: True up until java 8, with java 8 you can have implementation in interface as well - checkout [default method java 8](http://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html)

http://stackoverflow.com/q/23088174
has comment: http://stackoverflow.com/comment/35288000
tagged with: java
has title: How to obtain Declared Methods in any given java class
has answer: http://stackoverflow.com/a/23088219
has comment: http://stackoverflow.com/comment/35287988
has comment: http://stackoverflow.com/comment/35287975
has comment: http://stackoverflow.com/comment/35287882
answer count: 1
has comment: http://stackoverflow.com/comment/35287947
accepted answer: http://stackoverflow.com/a/23088219
has body: I understand that the following exists: Class clazz = Class.forName("SomeClassWithinSameDirectory); Method methods[] = clazz.getDeclaredMethods(); but, from what I've tried, this only works given that the class I'm using is within the same directory as the class that has my main method. Does Java have a simple way of working around this problem? I've been googling a bit but have come up with nothing. Someone guide me in the right direction? Thanks in advance.
type: AnsweredQuestion
tagged with: reflection
score: 0
type: Question

http://stackoverflow.com/a/23016143
has body: For a Java EE application you will need JSP or JSF (Facelets). Both technolgies use HTML and Javacript for the frontend. This Answer show a clear difference between JSF and JSP. Regarding your requirement to have a cross-platform webpage, I would recommend you to use Bootstrap as frontend-framework. Bootstrap is in my opinion the best frontend-framework for cross-platform. However, you will need JSF or JSP in your backend.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23015210
downvote count: 0
type: Answer

http://stackoverflow.com/q/23082392
has answer: http://stackoverflow.com/a/23082995
has body: Hey for some reason my sql statement will not work, im trying to delete a product by its id but it just wont happen, any suggestion? the id is an integer and i think its not working because my input type is text and i have it stored as String n. import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Admin extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String n = request.getParameter("productid"); try { Class.forName("org.apache.derby.jdbc.ClientDriver"); Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/contact","nbuser", "nbuser"); String query = "delete from product where id = " + n +""; PreparedStatement stmt; stmt = con.prepareStatement(query); stmt.setString(1, n); int i = stmt.executeUpdate(); if (i &gt; 0) { response.sendRedirect("index.html"); }else{ response.sendRedirect("Admin.jsp"); } } catch (ClassNotFoundException | SQLException ey) { System.out.println(ey); } out.close(); }
upvote count: 0
favorite count: 0
answer count: 5
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
score: -1
has answer: http://stackoverflow.com/a/23082602
has answer: http://stackoverflow.com/a/23082420
tagged with: java
has answer: http://stackoverflow.com/a/23082702
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23082467
has title: Servlet is not working

http://stackoverflow.com/a/23064644
has body: You need for sure make one change. Easier will be to add as the first instruction in your child class this: super(false); or: super(true); depending in what makes sense for you. By the way, in your parent's constructor you have this: r = right; but it should be: right = r; Otherwise, you are discarding the value passed in the constructor.
type: Answer
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23064558

http://stackoverflow.com/q/23052649
has answer: http://stackoverflow.com/a/23052678
has title: Exception in thread "main" java.lang.NullPointerException
possible better answer: http://stackoverflow.com/a/23052666
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35223760
has comment: http://stackoverflow.com/comment/35224073
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/35223745
has answer: http://stackoverflow.com/a/23052666
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23052702
tagged with: java
accepted answer: http://stackoverflow.com/a/23052678
type: Question
has body: Getting this exception while running following program Exception in thread "main" java.lang.NullPointerException at pojo.Bill.main(Bill.java:20) Java Result: 1 Bill.java public class Bill { public static void main(String s[]){ Bill b=new Bill(); b.getBillDetails().setBillNo(444);// line 20 System.out.println("bill no "+ b.getBillDetails().getBillNo()); } private BillAction billDetails; public BillAction getBillDetails() { return billDetails; } public void setBillDetails(BillAction billDetails) { this.billDetails = billDetails; } In BillAction there is getter and setter of billNo How to resolve this.
linked to: http://stackoverflow.com/q/218384

http://stackoverflow.com/comment/35147328
comment on: http://stackoverflow.com/q/23010768
type: Comment
has text: have you looked at gson? https://code.google.com/p/google-gson/
score: 0
type: QuestionComment

http://stackoverflow.com/q/23072732
tagged with: google-app-engine
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35278528
accepted answer: http://stackoverflow.com/a/23072780
has body: What is the most efficient way of storing private user-specific data, such as their documents and images, using Objectify in Data Store? I'm using Google's UserFactory to get the currently logged in user. By default, the user only needs to see the most recent entries (say 30 entries), presented on the first page. They can see older entries by moving through pages. The number of entries is theoretically unbounded. This seems to be a common scenario, but I'm a bit confused as to what's the best way to go about solving this in terms of designing the entities, so I can minimise data store operations. So, here are the entities I came up with initially: SubclassedUser (extends User, stored as entity) UserDocuments - @Parent SubclassedUser author - String messageText - @Index DateTime updatedDate - DateTime createddDate UserImages - @Parent SubclassedUser uploader - String imageUrl - @Index DateTime createdDate But here are my questions: Is subclassing User an appropriate way of storing the User? The index is for sorting, so I can get the most recent entries. The idea is to do a descending ORDER BY on the date with a LIMIT to display each page. Is there a more efficient way of doing this so I can avoid performing an index query, given that most of the time the user only wants to see the most recent data? Would there be a performance issue with the query if the number of UserDocuments and UserImages continue to increase? What's the best way of mangaging this? Thank you so much in advance!
type: Question
has answer: http://stackoverflow.com/a/23072780
tagged with: java
has title: Google App Engine Objectify Data Store - entities and queries for recent private user data?
score: 0
tagged with: google-cloud-datastore
answer count: 1
tagged with: objectify

http://stackoverflow.com/q/23020676
tagged with: android
has body: Is there anyway possible to print out the name, and type of every field in a class? Right now I have the following code try { for (Field field : obj.getClass().getDeclaredFields()) { System.out.println("User Preferences " + field.getName() + " - " + field.getType()); } }catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } Which displays: User Preferences customer - class java.lang.String User Preferences token - class java.lang.String User Preferences class1 - class com.activity.webservice.Login$Class1 That is what I want to get (almost). The issue is getting it to go into the custom class Class1. The Class1 class can have multiple classes within it or no classes. The Class1 class can have multiple fields or no fields. I want something like this to print out User Preferences customer - class java.lang.String User Preferences token - class java.lang.String User Preferences class1 - class com.activity.webservice.Login$Class1 User Preferences string1 - class java.lang.String User Preferences class2 - class com.activity.webservice.Login$Class2 User Preferences string2 - class java.lang.String User Preferences string3 - class java.lang.String How can I iterate through an unknown number of fields and classes? Thanks for any help EDIT Here is how my Login class is structured public class Login { public String token; public String customerid; public Class1 class1; public class Class1 { public Class2 class2; public String string1; public class Class2 { public int int1; public String string2; public String string3; } } }
has comment: http://stackoverflow.com/comment/35166646
has comment: http://stackoverflow.com/comment/35166587
has answer: http://stackoverflow.com/a/23021442
has comment: http://stackoverflow.com/comment/35166310
score: 2
type: AnsweredQuestion
tagged with: reflection
accepted answer: http://stackoverflow.com/a/23020953
tagged with: java
has comment: http://stackoverflow.com/comment/35166241
has comment: http://stackoverflow.com/comment/35166635
type: Question
has title: Iterate through generic class
has comment: http://stackoverflow.com/comment/35166427
has comment: http://stackoverflow.com/comment/35166325
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23020953
favorite count: 0
tagged with: iteration
has comment: http://stackoverflow.com/comment/35167036
upvote count: 2
possible better answer: http://stackoverflow.com/a/23021442

http://stackoverflow.com/a/23124889
has body: You can't do that from the client code, ie. the code calling the method. You can only do it within the sub class method super.method1(); and only for one level up the hierarchy.
answers question: http://stackoverflow.com/q/23124861
score: 0
type: Answer

http://stackoverflow.com/q/23115924
has comment: http://stackoverflow.com/comment/35338747
tagged with: android
accepted answer: http://stackoverflow.com/a/23116711
has body: I have a application which is something like a test. There are a lots of radio buttons and radio groups. During rotation I'm saving actual test obejct in onSaveInstanceState(...) and then in onCreateView(...) restoring this object. Everything works perfectly fine there.. After rotation everything is set up OK and works fine. Sample: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ... if(savedInstanceState != null) mTest = (Test)savedInstanceState.getSerializable(TEST_SAVED); else{ String userId = ""; if (getArguments() != null) { userId = getArguments().getString(PACIENT_ID); } mTest = new Test(userId, "..."); } ... } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putSerializable(TEST_SAVED, mTest); } I'm handling the radio button onClick directly in XML &lt;RadioButton android:id="@+id/radioButtonOt1Btn1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="8" android:onClick="onRadioButtonClicked" // HERE android:text="10" /&gt; But.. When I click on any radio button after rotation, everything is set to NULL (loaded TextViews, EditTexts.. and of course my Test object). So the problem is obviously in XML onClick method where goes something wrong. Anybody has suggestion what is going on? :-) Thank you
type: AnsweredQuestion
tagged with: android-fragments
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35337511
type: Question
tagged with: android-layout
has answer: http://stackoverflow.com/a/23116711
has comment: http://stackoverflow.com/comment/35338313
answer count: 1
has title: Android handling fragment rotation with RadioButtons onClick methods

http://stackoverflow.com/comment/35293902
has text: @Rogue, I don't know what "testingStringBuilder#" means. In any case, I'm just comparing different ways of concatenating strings, not specifically the StringBuilder class.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23091007

http://stackoverflow.com/q/23004614
has comment: http://stackoverflow.com/comment/35136599
has body: Im new at Object-Oriented Programming, I need to make a code that reads a list of N nonzero numbers and store it in a vector. After filling, it should print data read. This is the code import java.io.*; import java.util.*; class Programa1Vectores_Objetos{ int n,nal; int Vector[]= new int[n]; void setvector(int xvector[]){ Random Aleatorio =new Random(); int nal; for(int i=0; i&lt;xvector.length; i++){ nal=Aleatorio.nextInt(10); if (nal==0){ i--; continue; } xvector[i]=nal; } } int getvector(){ return Vector[n]; } } class EjecutaPrograma1{ public static void main (String[] args) throws java.io.IOException { int n=0; int Vector[]= new int[n]; Programa1Vectores_Objetos Programa1 = new Programa1Vectores_Objetos(); n=Lectura_NumeroVector(""); Programa1.setvector(Vector); Programa1.getvector(); } public static int Lectura_NumeroVector (String TxtMsg) throws java.io.IOException{ int X=0; String teclado; DataInputStream cadena= new DataInputStream(System.in); do{ System.out.print("Longitud del Vector: "); teclado=cadena.readLine(); try{ X=Integer.parseInt(teclado); if(X&lt;1){ System.out.println("Tienes que escribir un numero mayor a cero"); continue; } return X; }catch(NumberFormatException e){ System.out.println("Escribe un numero"); } }while(true); } } When im trying to run and I give the number of the length of the vector it it appears something like "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at Programa1Vectores_Objetos.getVector(Programa1Vectores_Objetos.java:25) at EjecutaPrograma1.main(Programa1Vectores_Objetos.java:47) Line 25 int getvector(){ return Vector[n]; //Line 25 } Line 47 Programa1.getvector(); Sorry for my bad english. Thanks!
has answer: http://stackoverflow.com/a/23019191
has comment: http://stackoverflow.com/comment/35137007
downvote count: 1
has title: Array object in java
possible better answer: http://stackoverflow.com/a/23004656
tagged with: java
has answer: http://stackoverflow.com/a/23004656
tagged with: vector
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23019191
upvote count: 0
tagged with: arrays
favorite count: 0
answer count: 3
type: Question
has comment: http://stackoverflow.com/comment/35136699
score: -1
has answer: http://stackoverflow.com/a/23004926

http://stackoverflow.com/comment/35317295
comment on: http://stackoverflow.com/q/23104184
type: Comment
type: QuestionComment
has text: @The_CoA: You can [answer your own question](http://meta.stackexchange.com/q/17463/163188).
score: 0

http://stackoverflow.com/comment/35224969
type: Comment
has text: Possible duplicate: http://stackoverflow.com/questions/2785485/is-there-a-unique-android-device-id
type: QuestionComment
comment on: http://stackoverflow.com/q/23053041
score: 0

http://stackoverflow.com/a/23082459
type: Answer
score: 3
has body: There is optional parameters with Java 5.0. Just declare your function like this: public void doSomething(boolean...optionalFlag) { ... } you could call with doSomething() or doSomething(true) now. This is "new" in Java 1.5 and beyond (not supported in Java 1.4 or earlier).
downvote count: 1
upvote count: 4
answers question: http://stackoverflow.com/q/23082358

http://stackoverflow.com/comment/35190840
type: QuestionComment
comment on: http://stackoverflow.com/q/23034174
score: 0
has text: jdk-8-windows-x64.exe this is the name of the file
type: Comment

http://stackoverflow.com/comment/35332724
type: AnswerComment
type: Comment
has text: i would assume the last statement would cause an error, since `new Acceptor<?>(...)` is not allowed in either version. if anything its a bug in the type inferencing of java7
comment on: http://stackoverflow.com/a/23069490
score: 0

junit
tags question: http://stackoverflow.com/q/22988070
type: Tag
tags question: http://stackoverflow.com/q/22985865
tags question: http://stackoverflow.com/q/23028446
tags question: http://stackoverflow.com/q/23093448
tags question: http://stackoverflow.com/q/23003027
tags question: http://stackoverflow.com/q/23009122
tags question: http://stackoverflow.com/q/22976404
tags question: http://stackoverflow.com/q/23074480
tags question: http://stackoverflow.com/q/22984983
tags question: http://stackoverflow.com/q/22991149
tags question: http://stackoverflow.com/q/22972674
tags question: http://stackoverflow.com/q/23021223
tags question: http://stackoverflow.com/q/23119626
tags question: http://stackoverflow.com/q/22996846
tag name: junit
tags question: http://stackoverflow.com/q/22974985
tags question: http://stackoverflow.com/q/22984129
tags question: http://stackoverflow.com/q/22974901
tags question: http://stackoverflow.com/q/23077691
tags question: http://stackoverflow.com/q/23103665
tags question: http://stackoverflow.com/q/23123766
tags question: http://stackoverflow.com/q/22969946
tags question: http://stackoverflow.com/q/23071529
tags question: http://stackoverflow.com/q/23035465
tags question: http://stackoverflow.com/q/23095354
tags question: http://stackoverflow.com/q/23064396
tags question: http://stackoverflow.com/q/23119230
tags question: http://stackoverflow.com/q/23049991
tags question: http://stackoverflow.com/q/23021648
tags question: http://stackoverflow.com/q/23100211
tags question: http://stackoverflow.com/q/23022331
tags question: http://stackoverflow.com/q/23096026
tags question: http://stackoverflow.com/q/23044518
tags question: http://stackoverflow.com/q/23020817
tags question: http://stackoverflow.com/q/22988147
tags question: http://stackoverflow.com/q/22982360
tags question: http://stackoverflow.com/q/22996165
tags question: http://stackoverflow.com/q/23058397
tags question: http://stackoverflow.com/q/22972938
tags question: http://stackoverflow.com/q/23109360
tags question: http://stackoverflow.com/q/23060292
tags question: http://stackoverflow.com/q/22972840
tags question: http://stackoverflow.com/q/23036008

http://stackoverflow.com/a/30052784
score: 2
upvote count: 2
has body: There can be a difference between the column name in the table and the name you are giving to access that column in your code. So you should recheck the name, because in my case there was a spelling mistake :P
answers question: http://stackoverflow.com/q/23045396
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35203779
type: Comment
type: AnswerComment
has text: You could of course also use a separate field as "ident" if you don't want to couple ident and label text...
comment on: http://stackoverflow.com/a/23041775
score: 0

http://stackoverflow.com/q/22991806
downvote count: 1
answer count: 1
tagged with: pom.xml
favorite count: 0
has answer: http://stackoverflow.com/a/22992025
accepted answer: http://stackoverflow.com/a/22992025
tagged with: maven
has title: Multiple Module Maven Project - Scope
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: eclipse
type: Question
has body: If we have a multiple module project, Parent Project Model Module Services Module Web Module And the parent project pom.xml, lists the 3 modules in &lt;modules&gt;... And then Services pom.xml has a dependency on Model, and Web Module pom.xml has a dependency on Services...what does this mean? Does it mean I can't reference in my Web Module, any of the Model classes? i.e. does the dependency chain in Maven impact this type of scoping? So I cant in appContext.xml in my web module control any of the injection of beans outside of Services/Web Module? Many thanks (sorry for noob question) i
score: -1
has comment: http://stackoverflow.com/comment/35113482

http://stackoverflow.com/comment/35211522
score: 0
type: Comment
type: QuestionComment
has text: Sorry for the mess I'm new here, I've attached the class above.
comment on: http://stackoverflow.com/q/23045414

http://stackoverflow.com/a/23129428
has body: public static List&lt;String&gt; fromSDCard(Context mContext) { List&lt;String&gt; listChurchWall = new ArrayList&lt;String&gt;(); // listing Wallpaper using church names String string = "/mnt/sdcard/Church/Wallpaper/"; f = new File(string + name + "/"); if (f.exists()) { files = f.listFiles(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(mContext); int imageResource = android.R.drawable.stat_sys_warning; Drawable image = mContext.getResources().getDrawable(imageResource); builder.setTitle("title").setMessage("your Message").setIcon(image).setCancelable(false).setNeutralButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); AlertDialog alert = builder.create(); alert.setCancelable(false); alert.show(); } return listChurchWall; }
type: Answer
answers question: http://stackoverflow.com/q/23129293
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/35351816
type: AnswerComment
has text: Splendid! However, how do i then print it out? The count that and digit in main that is.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23123922

http://stackoverflow.com/comment/35349197
type: Comment
comment on: http://stackoverflow.com/q/23121585
has text: I updated the answer. Can you check with it.
score: 0
type: QuestionComment

http://stackoverflow.com/a/23119904
score: 8
has body: If you don't like the verbosity of Comparator classes, then use Java 8 and its lambda expressions: Comparator&lt;Person&gt; byName = Comparator.comparing(Person::getName); Comparator&lt;Person&gt; byBirthDate = Comparator.comparing(Person::getBirthDate);
downvote count: 0
has comment: http://stackoverflow.com/comment/35345107
upvote count: 8
answers question: http://stackoverflow.com/q/23119851
type: Answer
has comment: http://stackoverflow.com/comment/35344971

http://stackoverflow.com/comment/35252262
comment on: http://stackoverflow.com/q/23013316
has text: @EJP, I guess if you didn't put a try..catch in your servlet. But its more likely you would do that in a servlet than JSP since the compiler will require you to unless you add the proper Exception type to the throws list to get around it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35225561
has text: I added it as written but I am still seeing the error null pointer exception. But with adding your's I am now seeing a malformed URL exception.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23053385
type: AnswerComment

http://stackoverflow.com/q/23029694
has title: Attributes dont appear in eclipse in programming time
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23044586
has comment: http://stackoverflow.com/comment/35182413
has body: When, for instance declaring a new integer variable in java let's say int number=7; if I write in Eclipse a., it does not appear on the right all the possible attributes that could be used, as it should do. I have tryed installing a new version of Eclise but it does not make any difference. Does anyone know how to fix this? PS: I tried to look in google for an image of the event i'm talking about and is similar to the one provided bellow but in my case for java programming.
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35183017
has answer: http://stackoverflow.com/a/23044586

http://stackoverflow.com/comment/35243663
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23063416
has text: Before blindly posting SO question please atleast once in a while go through this [What types of questions should I avoid asking?](http://stackoverflow.com/help/dont-ask)

http://stackoverflow.com/comment/35283893
comment on: http://stackoverflow.com/a/23062939
score: 0
type: AnswerComment
type: Comment
has text: Wait, I'm a bit confused... do you want to get only "GMT" or "hh:mm GMT"?

http://stackoverflow.com/comment/45183053
type: Comment
comment on: http://stackoverflow.com/a/22999531
score: 0
has text: If while sending request we swap order of text/html and application/xhtml+xml in header then Which one of the resource will be invoked by Jersey?
type: AnswerComment

http://stackoverflow.com/comment/35359378
type: Comment
has text: yes, it helps! I don't want to take an arbitrary decision for my current project, so the more feedback I get, the better! Thank you for the time spent to answer!
comment on: http://stackoverflow.com/a/23120647
score: 0
type: AnswerComment

http://stackoverflow.com/q/23008081
has body: I have tried the following code to implement a translator app using Microsoft Translator API library found here. I have a working internet connection and I have generated the a valid client id and secret but whenever I try to run the code I get the java.net.UnknownHostException. My code: StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); Translate.setClientId("Screened for the question"); //Change this Translate.setClientSecret("I have screened the client secret to ask in SO"); //change final TextView text = (TextView) findViewById(R.id.textView1); Button Trans1 = (Button)findViewById(R.id.trans); Trans1.setOnClickListener(new View.OnClickListener(){ public void onClick(View view) { String word = "Hello"; try { translatedText = Translate.execute(word, Language.ENGLISH, Language.GERMAN); // text.setText(translatedText); } catch (Exception e) { e.printStackTrace(); } } }); My Stack trace: 04-11 14:19:41.711: W/System.err(3084): java.lang.Exception: [microsoft-translator-api] Error retrieving translation : Unable to resolve host "datamarket.accesscontrol.windows.net": No address associated with hostname 04-11 14:19:41.711: W/System.err(3084): at com.memetix.mst.MicrosoftTranslatorAPI.retrieveString(MicrosoftTranslatorAPI.java:202) 04-11 14:19:41.711: W/System.err(3084): at com.memetix.mst.translate.Translate.execute(Translate.java:61) 04-11 14:19:41.711: W/System.err(3084): at com.example.tanslator.TransActivity$1.onClick(TransActivity.java:45) 04-11 14:19:41.711: W/System.err(3084): at android.view.View.performClick(View.java:3571) 04-11 14:19:41.711: W/System.err(3084): at android.view.View$PerformClick.run(View.java:14247) 04-11 14:19:41.711: W/System.err(3084): at android.os.Handler.handleCallback(Handler.java:605) 04-11 14:19:41.711: W/System.err(3084): at android.os.Handler.dispatchMessage(Handler.java:92) 04-11 14:19:41.711: W/System.err(3084): at android.os.Looper.loop(Looper.java:137)…
type: Question
has answer: http://stackoverflow.com/a/23008610
tagged with: unknown-host
score: 1
tagged with: java
tagged with: microsoft-translator
has title: Microsoft Translate API for Android gives UnknownHostException
upvote count: 1
answer count: 1
favorite count: 0
tagged with: android
tagged with: language-translation
accepted answer: http://stackoverflow.com/a/23008610
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/22985805
answers question: http://stackoverflow.com/q/22985204
has body: The ip-address is already present in the Authentication object (not the UserDetails). You can call getDetails() on the Authentication object and in a web application and properly configured Spring Security environment this will give you an instance of WebAuthenticationDetails which has the ip-address inside it. You can call the getRemoteAddress method to obtain the address. (See the javadoc).. Authentication auth = SecurityContextHolder.getContext().getAuthentication(); WebAuthenticationDetails details = (WebAuthenticationDetails) auth.getDetails(); String ipAddress = details.getRemoteAddress(); Something along those lines, you could put this behind a utility method or something to obtain the ip-address. Apparently you want to log authentication attempts, this can be easily achieved by implementing an ApplicationListener and let that listen to AbstractAuthenticationEvents. Spring Security issues those for each authentication attempt, and also includes the Authentication (containing the IP-address) into it. public class AuthenticationAttemptLoggerListener implements ApplicationListener<AbstractAuthenticationEvent> { private final Logger logger = LoggerFactory.getLogger(AuthenticationAttemptLoggerListener.class); public void onApplicationEvent(AbstractAuthenticationEvent event) { Authentication auth = event.getAuthentication(); WebAuthenticationDetails details = (WebAuthenticationDetails) auth.getDetails(); String ipAddress = details.getRemoteAddress(); if (event instanceof AbstractAuthenticationFailureEvent) { logger.warn("Unsuccesful authentication attemped from: {}", ipAddress); } else { logger.info("Succesful authentication attemped from: {}", ipAddress); } } } Something like this should catch and log everything. You might want to take a look at all the available events.
type: Answer
has comment: http://stackoverflow.com/comment/35107376
has comment: http://stackoverflow.com/comment/35136464
score: 5
upvote count: 5
downvote count: 0

http://stackoverflow.com/q/23054640
has comment: http://stackoverflow.com/comment/35227293
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/13688555
tagged with: java
has title: Multiple Spring MVC applications on Tomcat
has answer: http://stackoverflow.com/a/23055110
has comment: http://stackoverflow.com/comment/35228731
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23055308
tagged with: tomcat
has comment: http://stackoverflow.com/comment/35227362
score: 0
has comment: http://stackoverflow.com/comment/35227523
type: UnansweredQuestion
has body: I have two different apps installed. First - ROOT.war and second one - sky.war The problem that sky's requests are handled by ROOT's... Where should I dig to? Thank you
has comment: http://stackoverflow.com/comment/35228675

http://stackoverflow.com/comment/35170988
score: 1
has text: Simple Answer:Don't sleep the EDT.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23023083

http://stackoverflow.com/q/23004186
possible better answer: http://stackoverflow.com/a/23005171
favorite count: 0
has answer: http://stackoverflow.com/a/23005171
tagged with: android
tagged with: maven
type: AnsweredQuestion
score: 1
tagged with: java
has body: I have seen both of this SO question : Plugin execution not covered by lifecycle configuration error com.jayway.maven.plugins.android.generation2: Plugin execution not covered by lifecycle configuration? And i tried to install the connector like those questions suggested. It get rid some errors, but i still got on error left : Plugin execution not covered by lifecycle configuration: com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.2.0:ndk-build (execution: ndk- build, phase: compile) Im new in Maven and im out of idea to fix this issue. This is my whole pom.xml, and i commented where the error is coming from : &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;info.kghost.android&lt;/groupId&gt; &lt;artifactId&gt;openvpn&lt;/artifactId&gt; &lt;version&gt;0.9.4&lt;/version&gt; &lt;packaging&gt;apk&lt;/packaging&gt; &lt;name&gt;OpenVpn&lt;/name&gt; &lt;profiles&gt; &lt;profile&gt; &lt;id&gt;sign&lt;/id&gt; &lt;activation&gt; &lt;file&gt; &lt;exists&gt;signkey.keystore&lt;/exists&gt; &lt;/file&gt; &lt;/activation&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-jarsigner-plugin&lt;/artifactId&gt; &lt;version&gt;1.2&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;signing&lt;/id&gt; &lt;goals&gt; &lt;goal&gt;sign&lt;/goal&gt; &lt;/goals&gt; &lt;inherited&gt;true&lt;/inherited&gt; &lt;configuration&gt; &lt;includes&gt; &lt;include&gt;target/*.apk&lt;/include&gt; &lt;/includes&gt; &lt;keystore&gt;${basedir}/signkey.keystore&lt;/keystore&gt; &lt;alias&gt;CERT&lt;/alias&gt; &lt;arguments&gt; &lt;argument&gt;-digestalg&lt;/argument&gt; &lt;argument&gt;SHA1&lt;/argument&gt; &lt;argument&gt;-sigalg&lt;/argu…
upvote count: 1
tagged with: eclipse
has answer: http://stackoverflow.com/a/23006005
tagged with: android-ndk
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/13554694
downvote count: 0
linked to: http://stackoverflow.com/q/7114563
has title: Eclipse android Maven : Plugin execution not covered by lifecycle configuration (execution: ndk- build, phase: compile)
accepted answer: http://stackoverflow.com/a/23006005

http://stackoverflow.com/a/23062992
upvote count: 3
has body: You can use the hashCode() function. http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#hashCode()
has comment: http://stackoverflow.com/comment/35244219
has comment: http://stackoverflow.com/comment/35243061
downvote count: 0
answers question: http://stackoverflow.com/q/23062918
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/35244685

http://stackoverflow.com/a/23103318
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23092767
has comment: http://stackoverflow.com/comment/35338680
score: 2
has comment: http://stackoverflow.com/comment/35342086
has body: ..here is the HTML: No it's not. I don't mean it is not there, I mean what's there is not HTML. It is some rubbish hacked out by a programmer that is pretending to be HTML. There are at least 3 errors in it. To find out what the errors are, use an HTML validation service.
upvote count: 2

http://stackoverflow.com/comment/35281592
score: 0
type: AnswerComment
type: Comment
has text: @Rogue Can you explain please :) ?
comment on: http://stackoverflow.com/a/23084332

http://stackoverflow.com/q/23007255
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/23012283
tagged with: java
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/23012283
has body: I have got Spring project. I need to use JMX. I am using simplejmx - I found it really useful but unfortunately, I cannot manage few, basic things. I wrote a really simple server: package com.pckg.jmx; import com.j256.simplejmx.web.JmxWebServer; public class JMXServer { public static void main(String[] args) throws Exception { JmxWebServer jmxWebServer = new JmxWebServer(8123); jmxWebServer.start(); } } with pom.xml: <project...> 8.1.9.v20130131 com.j256.simplejmx simplejmx 1.8 org.eclipse.jetty jetty-util ${jetty-version} org.eclipse.jetty jetty-server ${jetty-version} true </project> When I run it, it works well. I want to do it in Spring way. I created jmx-config file: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <property name="jmxServer" ref="jmxServer" /> <property name="registryPort" value="8123" /> </beans> I changed web.xml: contextConfigLocation ... jmx-config.xml I added simple class: package com.pckg.jmx; import com.j256.simplejmx.common.JmxResource; @JmxResource public class DummyJMX { private int var = 3; } When I run my application I see warnings: 10:15:07,184 WARN [org.jboss.as.ee] (MSC service thread 1-1) JBAS011006: Not installing optional component org.eclipse.jetty.continuation.Servlet3Continuation$1 due to exception: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011054: Could not find default constructor for class org.eclipse.jetty.continuation.Servlet3Continuation$1 at org.jboss.as.ee.component.ComponentDescrip…
favorite count: 0
tagged with: simplejmx
tagged with: jmx
has answer: http://stackoverflow.com/a/23009062
accepted answer: http://stackoverflow.com/a/23009062
tagged with: spring
has title: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/eclipse/jetty/server/AbstractConnector
score: 2

http://stackoverflow.com/comment/35296323
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23079604
has text: Pavel, what would my life be without you :)
score: 0

http://stackoverflow.com/a/23013544
upvote count: 0
has comment: http://stackoverflow.com/comment/35161831
score: -1
answers question: http://stackoverflow.com/q/22995183
downvote count: 1
has body: If I understand correctly your question, you want to know if the entered password is correct even if the user account is locked or not ? You can "validate" password, then know if the user is unlocked. Check the answer here to have a code sample. Then, you can move on your operation.
has comment: http://stackoverflow.com/comment/35225355
type: Answer

http://stackoverflow.com/comment/35209456
comment on: http://stackoverflow.com/a/23044742
score: 0
has text: I tried that but it doesn't work. I'm not getting an error just a blank field in the database. The value I'm passing at the moment is a string so the format shouldn't matter, and the method for date/time returns the correct string that I want to insert to the database. Thanks
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35278874
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23083124
has text: I think you mean "Eclipse JDT" and not "Eclipse AST".

http://stackoverflow.com/q/23111132
has title: Create Object with one of constructor's parameter
has answer: http://stackoverflow.com/a/23111383
accepted answer: http://stackoverflow.com/a/23111383
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23111304
tagged with: java
has comment: http://stackoverflow.com/comment/35328209
type: Question
has body: so I'm having a lot of trouble understanding how this works... public class Arbitros_modelo { public Arbitros_modelo(String nombre, String nacionalidad, String posicion) { // where my idea is to create objects with Constructor(String nombre) // eg Arbitros_modelo(esteban, colombiano, lateral) Object[] nombre = {nacionalidad, posicion}; } but this gave me error,this is the idea, but it does not work probbly not understanding the concept so can someone explain to me o give me an article where i can learn this ?... so did some researching and found this: public class Arbitros_modelo { public Arbitros_modelo(String nombre, String nacionalidad, String posicion) { Object[] Arbitros_modelo.class.getConstructor(Arbitro_modelo.class).newInstance(nombre) = {nacionalidad, posicion} } I know this is VERY wrong but just can't understand how to implement this correctly, please help. thanks !
has answer: http://stackoverflow.com/a/23111263
score: 0
possible better answer: http://stackoverflow.com/a/23111304
has answer: http://stackoverflow.com/a/23111259

replication
tags question: http://stackoverflow.com/q/23121963
tag name: replication
type: Tag
tags question: http://stackoverflow.com/q/23047760

http://stackoverflow.com/comment/38346756
comment on: http://stackoverflow.com/q/23027662
type: Comment
type: QuestionComment
has text: I have the same issue... any resolution?
score: 0

http://stackoverflow.com/q/22992046
type: UnansweredQuestion
tagged with: java
tagged with: multithreading
type: Question
score: 0
tagged with: email
answer count: 1
has answer: http://stackoverflow.com/a/22992099
has title: Threading. Keeps using the same info (variable while running)
has body: I developed a GUI in JAVA that after doing a few actions like writing to excel sends an email to a client with an attached file but sending email takes about 5 sec and sometimes it needs to send 100 emails in a row but i don´t won´t the user to wait for the emails to be sent because it is not important to him. So i tried creating a thread that sends the email. Something like: for(int i=0; i&lt;numEmail;i++){ info=getSomething(i); new Thread() { public void run() { sendEmail(info); System.out.println("Email sent"); } }.start(); } Although i create new Thread every email comes with the info of the first email instead of every email with different info. I'm a rookie java programmer and know very little of threading. I just need to not freeze the GUI for sending email. I never now the amont of emails to send but they all have different information to send.

http://stackoverflow.com/comment/35291959
score: 0
has text: `toArray(T[])` returns an array of the correct type. You're the one making it an array of `Object` by using the one that returns Objects http://docs.oracle.com/javase/7/docs/api/java/util/Set.html#toArray(T[])
comment on: http://stackoverflow.com/q/23090272
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23104809
type: Question
upvote count: 2
has body: Given an acrokey, is it possible to find the absolute position and dimension of that particular field (getLeft, getTop, getWidth, getHeight) ? And is the viceversa possible - if I know the position, can I get the acrokey of the field?
has title: Find field absolute position and dimension by acrokey
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23107047
score: 2
downvote count: 0
tagged with: java
tagged with: itext

http://stackoverflow.com/q/23110212
tagged with: http://stackoverflow.com/tag/xml
score: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23110396
tagged with: java
tagged with: jaxb
tagged with: xslt
type: Question
has title: Transforming one JAXB Object to another using XSLT
upvote count: 4
accepted answer: http://stackoverflow.com/a/23110396
linked to: http://stackoverflow.com/q/9482785
answer count: 1
downvote count: 0
has body: I found this question, which helped me a bit, but not enough: Transform From one JAXB object to another using XSLT template What I have is this: A source JAXB Object A class for my target JAXB Object A path to the XSLT I want to use to transform my original object to my target object What I'm trying is this: /** * Transforms one JAXB object into another with XSLT * @param src The source object to transform * @param xsltPath Path to the XSLT file to use for transformation * @return The transformed object */ public static &lt;T, U&gt; U transformObject(final T src, final String xsltPath) { // Transform the JAXB object to another JAXB object with XSLT, it's magic! // Marshal the original JAXBObject to a DOMResult DOMResult domRes = Marshaller.marshalObject(src); // Do something here SAXTransformerFactory tf = (SAXTransformerFactory) TransformerFactory.newInstance(); StreamSource xsltSrc = new StreamSource(xsltPath); TransformerHandler th = tf.newTransformerHandler(xsltSrc); th.setResult(domRes); } At this point, I'm puzzled. How do I obtain my transformed Document? From that point, unmarshalling it back to a JAXB object shouldn't be too hard, I think. As far as I know, there's no way to do this without marshalling, right? UPDATE Here is a full working example, using Saxon specifically as my XSLT's are using XSLT 2.0: /** * Transforms one JAXB object into another with an XSLT Source * * @param src * The source (JAXB)object to transform * @param xsltSrc * Source of the XSLT to use for transformation * @return The transformed (JAXB)object */ @SuppressWarnings("unchecked") public static &lt;T, U&gt; U transformObject(final T src, final Source xsltSrc, final Class&lt;U&gt; clazz) { try { final JAXBSource jxSrc = new JAXBSource(JAXBContext.newInstance(src.getClass()), src); final TransformerFactory tf = new net.sf.saxon.TransformerFactoryImpl(); final Transformer t = tf.newTransformer(xsltSrc); final JAXBResult jxRes = new JAXBResult(JAXBContext.newInstance(clazz)); t.transf…
favorite count: 0

http://stackoverflow.com/a/44055016
score: 0
type: Answer
has body: JTapi is a specification that is implemented by vendors, as CISCO or AVAYA. In my experience, there is no an generic API for JTapi, because each provider customizes their own implementation according at their telephony platform. If you want a "generic" JTapi you should review this link, that refer to an Asterisk JTapi: http://asterisk-jtapi.sourceforge.net/
answers question: http://stackoverflow.com/q/23111589

http://stackoverflow.com/comment/35249732
type: QuestionComment
has text: You can use back references.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23066779

http://stackoverflow.com/a/23108451
type: Answer
has body: Increase your permanent memory space by setting the JVM arguments like this -XX:PermSize=512m -XX:MaxPermSize=1028m You could also increase the heap size like this -Xms512m -Xmx1g This would allocate in total of 2 GB memory (1g max for heap space and 1g max for perm generation space)
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23108359
downvote count: 0

http://stackoverflow.com/comment/35102717
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22983514
has text: @ifLoop Coding style is subjective, there is no right or wrong. Do not edit people's post to change coding style to your personal preference. Your edit should not have been approved, so I'll do a rollback.

http://stackoverflow.com/a/22985283
score: 2
answers question: http://stackoverflow.com/q/22985124
type: AcceptedAnswer
downvote count: 0
has body: This might be a use case for generics. Consider the following arrangement of classes - here we define an abstract "parameter" type and reference this in the interface. Concrete classes work with a particular parameter set. abstract class HandlerParams { } interface FileHandler&lt;T extends HandlerParams&gt; { boolean uploadFile(T parameters); OutputStream downloadFile(T parameters); } Example implementations: class URLParams extends HandlerParams { // whatever... } class URLFileHandler implements FileHandler&lt;URLParams&gt; { @Override public boolean uploadFile(URLParams parameters) { // ... } @Override public OutputStream downloadFile(URLParams parameters) { // ... } } I must admit, I'm struggling to imagine scenarios where this arrangement would be that helpful. I suppose you could have something that works with file handlers, but it feels a little artificial: class SomethingThatUsesFileHandlers { public &lt;T extends HandlerParams&gt; void doSomething(FileHandler&lt;T&gt; handler, T params) { handler.downloadFile(params); } }
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/22985124

http://stackoverflow.com/q/22984266
upvote count: 1
tagged with: swing
has title: To use Tooltip in showconfirmDialog
downvote count: 1
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35099635
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22984750
type: UnansweredQuestion
tagged with: jbutton
tagged with: joptionpane
has body: I am trying to use the Tooltip feature of JButton in a Dialogue Box. I am using the showconfirmDialog feature. The code is something like this int optionSelection = javax.swing.JOptionPane.showConfirmDialog( null, "you have selected XXX checkbox. This will edit YYY file.\n Do you wish to proceed?", null, javax.swing.JOptionPane.YES_NO_CANCEL_OPTION, javax.swing.JOptionPane.QUESTION_MESSAGE); if (optionSelection == javax.swing.JOptionPane.YES_OPTION) { //Do something here } else if (optionSelection == javax.swing.JOptionPane.NO_OPTION) { //do something else here } else { //do something different from the above two } But how do I add the toolTip feature for each of the Buttons? Should I create the JOptionPane and Buttons and then create the toolTip or is there any other alternative?
tagged with: java

http://stackoverflow.com/comment/35218639
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23049661
has text: Yes I do. I would like the same order.
score: 0

http://stackoverflow.com/q/22987560
tagged with: javascript
tagged with: servlets
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22987964
duplicate of: http://stackoverflow.com/q/12112995
accepted answer: http://stackoverflow.com/a/22987794
has body: My form1 looks like this, &lt;form method="post" id="myform" name="myform" action="upload" enctype="multipart/form-data"&gt; &lt;div id="elements"&gt; &lt;ul id="ul"&gt; &lt;li&gt;Left File&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : &lt;input type="file" name="dataFile1" id="fileChooser1" /&gt;&lt;/li&gt;&lt;li&gt;&lt;br&gt;&lt;/li&gt; &lt;li&gt;Right File&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : &lt;input type="file" name="dataFile2" id="fileChooser2" /&gt;&lt;/li&gt;&lt;li&gt;&lt;br&gt;&lt;/li&gt; &lt;li&gt;Runner.xlsx : &lt;input type="file" name="dataFile3" id="fileChooser3" /&gt;&lt;/li&gt;&lt;li&gt;&lt;br&gt;&lt;/li&gt; &lt;li&gt;&lt;button type="button" id="execute" onclick="ValidateFile()"&gt;Click to Upload files&lt;/button&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/form&gt; I've declared a function like this to add hidden data to forms, function addHidden(theForm, key, value) { var input = document.createElement('input'); input.type = 'hidden'; input.name = key; input.value = value; theForm.appendChild(input); } in Validatefile() var myDivText1 = ace.edit("editor").getValue(); var theForm = document.forms['myform']; addHidden(theForm, 'mytxt1', myDivText1); alert(myDivText1); document.myform.submit(); and in my upload.java servlet, if (itemField.equals("dataFile1")) { //get the text of the editor here and save it String TEXT = request.getAttribute("mytxt1").toString();//this is being displayed as null System.out.println(TEXT); File uploadedFile = new File(fpath, fileName); item.write(uploadedFile); String f1 = "&lt;span class='blue'&gt;" + "Uploaded &lt;b&gt;left file&lt;/b&gt; " +fileName+ "&lt;br&gt;" + "&lt;/span&gt;"; request.setAttribute("f1stat", f1); } while the alert in my Javascript function displays correct value, when I try to access this in my upload.java servlet it shows a null value. I've used this function for another form too which is also it is passing the required data while this one fails, what is my mistake? I've t…
linked to: http://stackoverflow.com/q/12112995
has answer: http://stackoverflow.com/a/22988236
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22987794
possible better answer: http://stackoverflow.com/a/22987964
has title: Error in adding hidden data to form
tagged with: java
type: Question

http://stackoverflow.com/a/23042046
type: Answer
has body: Define what key you want (PRIMARY, UNIQUE) and remove the name of it CREATE TABLE IF NOT EXISTS `homes` ( `home_naam` varchar(20) NOT NULL, `speler` varchar(20) NOT NULL, `wereld` varchar(20) NOT NULL, `locatiex` int(11) NOT NULL, `locatiey` int(11) NOT NULL, `locatiez` int(11) NOT NULL, PRIMARY KEY (`home_naam`,`speler`) )
accepted answer of: http://stackoverflow.com/q/23042008
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23042008
score: 0

http://stackoverflow.com/a/23072535
type: AcceptedAnswer
has body: The problem isn't with the loop, but the last if condition: if (sorted = true) should be if (sorted == true)
type: Answer
accepted answer of: http://stackoverflow.com/q/23072485
answers question: http://stackoverflow.com/q/23072485
score: 0

http://stackoverflow.com/q/23068932
has comment: http://stackoverflow.com/comment/35253793
has title: ArrayList<String> gives NullPointerException When adding
has comment: http://stackoverflow.com/comment/35254180
score: -2
has comment: http://stackoverflow.com/comment/35254509
has body: I know most people make the mistake of not initializing the Arraylist and that's why they get the NullPointerException. But in my class i have initialized my Arraylist and I still get the exception when I try to add to it. protected int V; protected int E; protected boolean[][] adjacencyMatrix; public int i; public int[] num; public ArrayList&lt;String&gt; edges; public SimpleGraph(int V) { this.V = V; this.E = 0; this.adjacencyMatrix = new boolean[V][V]; edges = new ArrayList&lt;String&gt;(); num = new int[V]; } public void DFS(int V) { num[V] = i++; for(int u = 0; u &lt; getV(); u++) { if(adjacencyMatrix[V][u] == true &amp;&amp; u != V) { if(num[u] == 0) { Integer temp = new Integer(num[u]); edges.add("anything"); DFS(u); } } } } You can assume that I have correctly added to the adjacencyMatrix. Why do I get a NullPointerException when I try adding to the Arraylist?
linked to: http://stackoverflow.com/q/3988788
has comment: http://stackoverflow.com/comment/35254314
has comment: http://stackoverflow.com/comment/35254147
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35254103
tagged with: nullpointerexception
answer count: 3
has comment: http://stackoverflow.com/comment/35254484
has comment: http://stackoverflow.com/comment/35253837
has comment: http://stackoverflow.com/comment/35253889
favorite count: 0
has answer: http://stackoverflow.com/a/23069622
has answer: http://stackoverflow.com/a/23068992
has comment: http://stackoverflow.com/comment/35253830
has comment: http://stackoverflow.com/comment/35254214
type: UnansweredQuestion
tagged with: addition
has comment: http://stackoverflow.com/comment/35254513
upvote count: 1
has comment: http://stackoverflow.com/comment/35254286
has comment: http://stackoverflow.com/comment/35254372
has answer: http://stackoverflow.com/a/23068999
has comment: http://stackoverflow.com/comment/35254094
has comment: http://stackoverflow.com/comment/35254291
has comment: http://stackoverflow.com/comment/35254406
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/35254038
type: Question
has comment: http://stackoverflow.com/comment/35254423

http://stackoverflow.com/comment/35127418
type: AnswerComment
has text: i am trying to match it to my app,ill update here soon,thank you meanwhile
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22974485

http://stackoverflow.com/comment/35351393
comment on: http://stackoverflow.com/q/23123668
score: 0
type: QuestionComment
has text: I did, the error I received is written the bottom.
type: Comment

http://stackoverflow.com/a/22988924
downvote count: 0
score: 5
has body: You'll need to cast them to the class before using the method. for (User user : listOfUsers) { String name = user.getName(); if (user instanceof Student) { Student tmp = (Student)user; // call getGrade(); tmp.getGrade(); } else { // it is an instance of a Teacher Teacher tmp = (Teacher)user; // call getSubject(); tmp.getSubject(); } }
answers question: http://stackoverflow.com/q/22988859
type: Answer
upvote count: 5

http://stackoverflow.com/q/22974008
tagged with: arrays
has comment: http://stackoverflow.com/comment/35081957
has comment: http://stackoverflow.com/comment/35081859
has answer: http://stackoverflow.com/a/22974167
score: 0
has comment: http://stackoverflow.com/comment/35081770
answer count: 3
has body: I would appreciate if someone could help me with my school project. I have a txt file with names and phone numbers (ex. John Smith 1123456789). I need Java to read the file and load it into two separate array strings: one with first/last names and another with phone numbers. Please give me advise on how to do it right. Thanks a lot in advance. String book; FileReader reader; BufferedReader buffer; String line; String[] list; try { reader = new FileReader(book); buffer = new BufferedReader(reader); list = new String[50]; int x = 0; line = buffer.readLine(); while (line != null){ list[x] = line; line = buffer.readLine(); x++; } buffer.close(); } catch(FileNotFoundException e)
tagged with: string
has comment: http://stackoverflow.com/comment/35081846
has answer: http://stackoverflow.com/a/22974155
type: UnansweredQuestion
tagged with: filereader
has title: How to split different data types in String[] in Java
has comment: http://stackoverflow.com/comment/35081997
tagged with: java
has answer: http://stackoverflow.com/a/22974245
type: Question

http://stackoverflow.com/q/23080305
tagged with: android
has comment: http://stackoverflow.com/comment/35274581
has answer: http://stackoverflow.com/a/27853059
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35273991
type: Question
tagged with: java
score: 0
has body: My AddOnPreDrawListener method isn't getting the height of the webview? ViewTreeObserver viewTreeObserverTop = topContent.getViewTreeObserver(); viewTreeObserverTop.addOnPreDrawListener(new OnPreDrawListener() { @Override public boolean onPreDraw() { int topHeight = topContent.getMeasuredHeight(); if (topHeight != 0) { RelativeLayout instructions = (RelativeLayout) findViewById(R.id.info_layout); instructions.post(mAddTabletMargin); } topContent.getViewTreeObserver().removeOnPreDrawListener( this); return false; } }); Could anyone suggest why or any other methods I could use to get the height?
answer count: 1
has title: Android AddOnPreDrawListener not getting content height

http://stackoverflow.com/comment/35123079
type: QuestionComment
comment on: http://stackoverflow.com/q/22996974
has text: Don't you want `double sum` and `double num = Double.parseDouble(nums[i]);`?
score: 0
type: Comment

http://stackoverflow.com/comment/35086224
type: Comment
has text: I don't see the file, but it was there before the clean.
comment on: http://stackoverflow.com/a/22976543
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35175513
type: AnswerComment
comment on: http://stackoverflow.com/a/23025412
type: Comment
has text: Thanks for taking the time to respond. I will be dealing with at least 9 booleans so that method would be extreme cumbersome.
score: 0

http://stackoverflow.com/a/22969574
has body: In below case, you are performing operation on two null and + operation is not defined for two null. String s1 = null + null; And in this one you are performing concatenation of String with null. String s2 = s1 + null; And another interesting case is, String abcd = (String) null + null; That will be resulted in "nullnull" string as you are casting String to null and again concatenation will be performed. so first null will be treated as String.
downvote count: 0
answers question: http://stackoverflow.com/q/22969348
score: 9
type: Answer
upvote count: 9

http://stackoverflow.com/comment/35254987
comment on: http://stackoverflow.com/q/23069381
score: 0
type: Comment
type: QuestionComment
has text: GenericDao is imported from the same package.

http://stackoverflow.com/comment/35210839
has text: i have added my localEnergy method to the question
type: Comment
comment on: http://stackoverflow.com/q/23045299
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35291325
type: QuestionComment
score: 0
has text: That is exactly what I am asking and it would have been much more productive if we focused on the question, instead of running an exercise in downvoting. As if there are no hundreds of questions in StackOverflow discussing tools already!
comment on: http://stackoverflow.com/q/23037279
type: Comment

http://stackoverflow.com/comment/35197643
has text: In your for loop you need to start i from 1 and not from 2, as we just need to skip the first String
comment on: http://stackoverflow.com/a/23037990
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35142301
type: Comment
has text: And often, global variables simply don't work. "Here's how to use global variables" is not an appropriate answer to "where should I declare my variables", and it's disappointing to me to see that this answer has two upvotes. Now, if the question had been "where should I NOT declare my variables", I might have upvoted this myself.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23007303

http://stackoverflow.com/q/23027175
has comment: http://stackoverflow.com/comment/35244994
tagged with: repository
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1928023
has title: adding pre-commit hooks in subversion(svn)
tagged with: git
type: Question
has body: I want to add pre-commit hook for jshint in svn. As I new to svn therefore, I need some help. I already did some work which is following. Below is my local repo folder structure svn-repo branches hooks pre-commit.sh tags trunk scripts script.js index.html .jshintrc Here is my pre-commit hook code ROOT_DIR=$(git rev-parse --show-toplevel) # gets the path of this repo CONF="--config=${ROOT_DIR}/build/config/jshint.json" # path of your jshint config JSHINT=$(which jshint) # jshint path if git rev-parse --verify HEAD &gt;/dev/null 2&gt;&amp;1; then against=HEAD else # Initial commit: diff against an empty tree object against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi for file in $(git diff-index --name-only ${against} -- | egrep \.js); do if $JSHINT $file ${CONF} 2&gt;&amp;1 | grep 'No errors found' ; then echo "jslint passed ${file}" exit 0 else $JSHINT $file exit 1 fi done I installed jshint globally and is located on below location /usr/local/bin/jshint Now when I commit with incorrect javascript then it still gets committed and does not throw any errors even though js contains errors according to .jshintrc. How can I make this pre-commit work?
tagged with: svn
tagged with: java
has answer: http://stackoverflow.com/a/23028883
score: 0
answer count: 1
tagged with: javascript

http://stackoverflow.com/comment/35343565
type: Comment
comment on: http://stackoverflow.com/a/23119242
has text: Ohh... I was adding exta +... My bad
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35215311
comment on: http://stackoverflow.com/q/23047881
score: 0
type: Comment
type: QuestionComment
has text: beacuse parseInt stop the rest of the code for me to put that string in there for output.

http://stackoverflow.com/a/23010757
has body: Get it straight with your String literals http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html
type: Answer
answers question: http://stackoverflow.com/q/23009455
score: 0

http://stackoverflow.com/q/23095779
has comment: http://stackoverflow.com/comment/35323707
has answer: http://stackoverflow.com/a/23208842
has title: Reading a file from a developer controlled account
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35324551
tagged with: google-drive-api
accepted answer: http://stackoverflow.com/a/23208842
tagged with: android
has comment: http://stackoverflow.com/comment/35307077
has body: I simply want to read a Google drive spreadsheet owned by a account controlled by the developer. So I don't want my users to have to login to anything. I just need to obtain this file from hard coded credentials and read it. It used to work very easy with drive v1 but since that doesn't seem to work anymore we are forced to go to drive v2. I haven't even found where to start.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35324299
has comment: http://stackoverflow.com/comment/35326924
tagged with: java
type: Question
tagged with: google-oauth

http://stackoverflow.com/a/23127798
score: 9
upvote count: 9
downvote count: 0
answers question: http://stackoverflow.com/q/23127392
type: Answer
has body: 42 is the seed, as the very same Javadoc says. So, what is a seed? A random number is seldom truly random - often it's a pseudo-random instead. This means it's generated from a function, which is said PRNG (pseudo random number genrator). Being generated from a function, in turn, means that the output is not random anymore, since it's predictable! However, depending on your needs, this pseudo-randomness may be enough - I said enough because generating random bit is expensive, and I'm not talking about time or memory, but about money (see this link on wikipedia). So, for example, if you need a random value to place enemies in your game, a pseudo-random number is ok - but if your are building security-related software, you want to use a true random number, or at least a cryptographically secure PRNG. How can we describe a PRNG, like the one used in Math.random()? It's a function, initialized with a seed S that returns an array of values A. Note that, for each integer S, is defined one and only one array A. For example (values are not actual): first call second call third call seed: 14329 .18 .82 .5 seed: 3989 .7 .02 .93 So you seed you PRNG with some known value when you want its result to be predictable - for example for testing purposes or to ensure that, each time you run level 1 in your game, the enemies are always placed in the same (pseudo) random places - otherwise you don't need to explicitely pass a seed.

http://stackoverflow.com/a/23042331
upvote count: 3
score: 3
has body: There are several steps involved here, each with different numbers. Let's split the code up for each statement: double original = 128.12301; // Or 128888.12301 float floatValue = (float) original; double backToDouble = (double) floatValue; System.out.println(backToDouble); So for each number, the steps are: Compile time: Convert the decimal value in the source code into the nearest exact double value Execution time: Convert the double value to the nearest exact float value Execution time: Convert the float value into a double value (this never loses any information) Execution time: Convert the final double value into a string Steps 1 and 2 can lose information; step 4 doesn't always print the exact value - it just follows what Double.toString(double) does. So let's take 128.12301 as an example. That's converted at compile-time to exactly 128.123009999999993624442140571773052215576171875. Then the conversion to float yields exactly 128.123016357421875. So after the conversion back to double (which preserves the value) we print out 128.123016357421875. That prints 128.12301635712188 because that's the fewest digits in can print out without being ambiguous between that value and the nearest double value greater than or less than it. Now with 128888.12301, the exact double value is 128888.123009999995701946318149566650390625 - and the closest float to that is exactly 128888.125. After converting that back to a double, the exact value of that double is printed out because there are other exact double values near it. Basically, the result will depend on how many significant digits you've included to start with, and how much information is lost when it rounds to the nearest double and then to the nearest float.
accepted answer of: http://stackoverflow.com/q/23042246
has comment: http://stackoverflow.com/comment/35204668
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23042246

http://stackoverflow.com/q/23058700
has title: Create Neo4j Unique nodes in java class
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has body: I want to create nodes and relatioships based on column values in DB. Node1 values will come from column "App-Name",Node2 -> "Corresponding_App" &amp; relationship->"Interface_Name" Based on column values "Interface_Type_Name"->Incoming/Outgoing arrows will be drawn to particular nodes. nodes should be unique and if created already then should not create duplicate one. Transaction tx=graphDb.beginTx(); Connection conn = null; try{{ conn=ConnectionFactory.getConnection(); Statement stat=conn.createStatement(); String sql="select * from Fade where App_Int_Id &lt; 22"; ResultSet rs=stat.executeQuery(sql); String n1 = "",n2="",rel="",type=""; while(rs.next()){ n1=rs.getString(1); n2=rs.getString(7); rel=rs.getString(3); type=rs.getString(4); Node first=graphDb.createNode(); first.setProperty("name", n1); first.addLabel(DynamicLabel.label(n1)); Node sec=graphDb.createNode(); sec.setProperty("name", n2); sec.addLabel(DynamicLabel.label(n2)); RelationshipType KNOWS = DynamicRelationshipType.withName(rel); if(type.equalsIgnoreCase("Incoming")){ sec.createRelationshipTo(first, KNOWS); } else if(type.equalsIgnoreCase("Outgoing")){ first.createRelationshipTo(sec, KNOWS); } For every single row its creating new nodes.so How to create unique nodes in the above code?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23061451
answer count: 1
tagged with: neo4j
accepted answer: http://stackoverflow.com/a/23061451

http://stackoverflow.com/comment/35122432
type: QuestionComment
has text: possible duplicate of [JavaFx image resizing](http://stackoverflow.com/questions/15951284/javafx-image-resizing)
comment on: http://stackoverflow.com/q/22993550
score: 0
type: Comment

http://stackoverflow.com/comment/35303572
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23024780
has text: I do not understand this comment. What's not simple about using getInputStream()?

http://stackoverflow.com/comment/35293018
has text: this is right... the python interpreter must have some concept of the variables it's dealing with or it would have issues performing operations on the variables
comment on: http://stackoverflow.com/a/23090755
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35075129
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22969846
has text: Why are printing the objects `arrayList` and `student` and not the string value of their elements/fields ?

http://stackoverflow.com/comment/35157532
type: Comment
type: QuestionComment
score: 6
has text: If it crashes, always add the stacktrace with your question please.
comment on: http://stackoverflow.com/q/23016209

http://stackoverflow.com/q/23029668
has answer: http://stackoverflow.com/a/23029792
type: Question
linked to: http://stackoverflow.com/q/9413656
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/23029792
favorite count: 0
has body: Have a look at this piece of code: public class TestClass { public long myLong = 1234; public static void main(String[] args) { final TestClass test = new TestClass(); Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { test.doStuff(); } }, 0, test.myLong); } public void doStuff(){ //do stuff here } } /Originally copied from How to use Timer class to call a method, do something, reset timer, repeat?. My question is: During the execution of this code, does it hangs the whole JFrame. For eg- I have placed a JTextField on my form (win1), And I want some random input from user. Will the JForm will be able to accept input during this time frame? Thanks.
has answer: http://stackoverflow.com/a/23029751
accepted answer: http://stackoverflow.com/a/23029751
type: AnsweredQuestion
has title: Timer Class. Accepting Input from user without hanging the JForm
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/35409984
score: 0
type: Comment
has text: Thanks vschafer. I am using Tomcat not Tomcat EE for local testing. The two links I posted did use use JEE and I am not sure if the third party authentication library uses Java EE mechanisms. I will explore your suggestion "subclass of the AbstractPreAuthenticatedProcessingFilter". The below is what I see in the request header after it is authenticated by third party authentication library.
comment on: http://stackoverflow.com/a/23030700
type: AnswerComment

http://stackoverflow.com/q/23086525
favorite count: 0
has comment: http://stackoverflow.com/comment/35285200
answer count: 1
has comment: http://stackoverflow.com/comment/35284986
has body: I am using a static member variable in my base abstract class and static getters/setters for it. Here is my class structure: public abstract class Parent{ private static XmlService xmlService; //getters and setters for xmlService } This xmlService is used in child classes for xml conversion etc. However, the instances of child classes are created at runtime based on the data using another service. Now I want to test with junit and need to mock the xmlService. If I dont make it static, I do not see any way to initialize xmlService with mock. So my question is that is this approach (static + abstract) is okay or does it break any OOP concepts etc. I don't see any issues with this though but just want an opinion. Thanks EDIT: I think based on the comments, I will review my design and most likely will go with constructor injection approach
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: oop
tagged with: java
has comment: http://stackoverflow.com/comment/35284925
has answer: http://stackoverflow.com/a/23086723
type: Question
has title: Using static variable in abstract class
downvote count: 0
has comment: http://stackoverflow.com/comment/35285179

http://stackoverflow.com/q/22969271
tagged with: swing
accepted answer: http://stackoverflow.com/a/22969870
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35072628
has title: Resize JscrollPane
tagged with: java
has comment: http://stackoverflow.com/comment/35072564
type: Question
has answer: http://stackoverflow.com/a/22969870
has body: I want to resize my Scrollpane attached to Jpanel. I tried the solution on the link : From Java Site 1: http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/size.html this is the interface : I want the scroll pane looks more smaller. like that exactly : package javaapplication14; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ public class NewJFrame extends javax.swing.JFrame { /** * Creates new form NewJFrame */ public NewJFrame() { 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() { jScrollPane1 = new javax.swing.JScrollPane(); jPanel1 = new javax.swing.JPanel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBackground(new java.awt.Color(255, 255, 51)); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 398, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); jScrollPane1.setViewportView(jPanel1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addCom…
has comment: http://stackoverflow.com/comment/35072755
score: 0
answer count: 1

http://stackoverflow.com/q/23001292
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/23001820
tagged with: manifest
tagged with: awt
linked to: http://stackoverflow.com/q/18601225
has title: Animated GIF leads to SplashScreen being null
linked to: http://stackoverflow.com/q/19081438
answer count: 1
score: 1
tagged with: splash-screen
has body: I know this is probably close to a duplicate of this thread: Animated GIF in Splashscreen But since it seems unanswered and I can't comment on it or anything I'm sorry to repost this but it would be awesome if someone could give me an answer. I am making a game and this game takes quite a lot of time to start. Therefore I want to give the user feedback during the loading screen so he knows the application hasn't crashed. That's why I use the SplashScreen API from java 7. In eclipse, when I run my application using the following configuration in VM Arguments, SplashScreen.getSplashScreen() returns null. -splash:src/aapplication/Splash.gif But when I use this configuration, it works fine (I have to files in the same package, one is Splash.png and the other Splash.gif): -splash:src/aapplication/Splash.png In a jar file (in MANIFEST.MF), this doesn't work: SplashScreen-Image: aapplication/Splash.gif While this does: SplashScreen-Image: aapplication/Splash.png My GIF is about 1Mb in size while the PNG is 50kb. Can anyone explain to me why does the GIF can't even be loaded while the PNG does (I know it's not the path since they have the same)? Everywhere I looked, it said it should work just as fine as for PNGs. Thanks for your help!
favorite count: 0
has answer: http://stackoverflow.com/a/23001820
tagged with: animated-gif
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35131913
upvote count: 1

http://stackoverflow.com/comment/35225147
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23053378
has text: What don't you understand?

http://stackoverflow.com/a/23106991
score: 4
accepted answer of: http://stackoverflow.com/q/23106010
answers question: http://stackoverflow.com/q/23106010
type: Answer
upvote count: 4
has body: You didn't set ResultSet type , so you left it to its default value, which is : ResultSet.TYPE_FORWARD_ONLY. Here is your method API : http://docs.oracle.com/javase/6/docs/api/java/sql/Connection.html#prepareStatement(java.lang.String,int) You must use: prepareStatement(sql, resultSetType, resultSetConcurrency); OR prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability); So for you , this should be enough: conn.prepareStatement(CDS, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/35260380
score: 0
has text: This code is not causing your out of memory problem. It is however completely pointless.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23072334

http://stackoverflow.com/q/23068762
score: 1
has answer: http://stackoverflow.com/a/23068847
tagged with: jframe
answer count: 3
upvote count: 1
tagged with: swing
tagged with: java
tagged with: jpanel
has body: First time posting here, and let me first say that I'm a bit of a Java noob, I've only started learning it in uni this year. So anyway, I have to create a UI for a Tamagotchi project, and I'm trying to create it using JFrame etc. This is what I'm trying to create: This is my code so far: import javax.swing.*; import java.awt.*; public class DogUI { private JFrame DogUI; private JPanel leftPanel, topPanel, bottomPanel, rightPanels; private JButton jb; private JLabel lb, lb1, lb2; public DogUI() { GUI(); } public void GUI() { DogUI = new JFrame("Dog UI"); DogUI.setSize(800, 600); DogUI.setResizable(false); leftPanel = new JPanel(); leftPanel.setBackground(Color.green); leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS)); topPanel = new JPanel(); topPanel.setBackground(Color.white); bottomPanel = new JPanel(); bottomPanel.setBackground(Color.red); rightPanels = new JPanel(); rightPanels.setLayout(new BoxLayout(rightPanels, BoxLayout.X_AXIS)); DogUI.setVisible(true); lb = new JLabel("Name: "); leftPanel.add(lb); lb1 = new JLabel("Image"); topPanel.add(lb1); lb2 = new JLabel("Buttons"); bottomPanel.add(lb2); rightPanels.add(topPanel); rightPanels.add(bottomPanel); DogUI.add(rightPanels); } public static void main(String [] args) { new DogUI(); } } This is what I end up with: I'm sure it's something simple, or perhaps I am going the complete wrong way about doing it, but please try explain it in layman's terms if possible. Thanks. Chris.
has comment: http://stackoverflow.com/comment/35253760
has answer: http://stackoverflow.com/a/23069047
type: AnsweredQuestion
has title: Setting up JFrame with leftPanel, topPanel and bottomPanel
accepted answer: http://stackoverflow.com/a/23069047
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35253460
possible better answer: http://stackoverflow.com/a/23068979
type: Question
has answer: http://stackoverflow.com/a/23068979

http://stackoverflow.com/q/22993877
has body: I have some code that makes a POST request to a url basically. I set some default settings on the HttpClient instance in a Util class I use to create and maintain the HttpClient instance: cm = new PoolingHttpClientConnectionManager(); cm.setMaxTotal(100); cm.setDefaultMaxPerRoute(100); RequestConfig config = RequestConfig.custom() .setConnectionRequestTimeout(500) .setConnectTimeout(10) .setSocketTimeout(2000) .setExpectContinueEnabled(true) .setStaleConnectionCheckEnabled(true).build(); httpClient = HttpClients.custom() .setDefaultRequestConfig(config) .setConnectionManager(cm) .build(); This code works perfectly when running locally on my mac running within IntelliJ. I test it by setting the socketTimeout to something like 5 ms. Throws a socket exception as expected. BTW, this is a standalone Java app. Doesn't run in a container. My problem is when I push this app to an EC2 instance running ubuntu. When I perform the exact same test with the same version of the app by lowering the socket timeout to a really low value, it doesn't have any affect at all. Any ideas why this is happening? Am I using this as it should be used? I basically want to make sure calls to this URL will not take any longer than 2 seconds total. Is this the proper way to do that, or do I need to spawn a thread for every request (seems like overkill) to monitor each request and kill it after the timeout period?
has comment: http://stackoverflow.com/comment/35122594
type: UnansweredQuestion
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/35125978
score: 2
answer count: 0
downvote count: 0
favorite count: 0
has title: Setting Socket Timeout value for HttpClient (4.3.3) doesn't work on Ubuntu
tagged with: apache-httpclient-4.x
type: Question
upvote count: 2
tagged with: sockets
tagged with: java

http://stackoverflow.com/a/23568986
answers question: http://stackoverflow.com/q/23007984
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36490865
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23007984
has body: Do you know the rough order of magnitude of the input columns? If so, and you don't need to preserve the original input file order? Then you can just use a sufficiently large hash function to avoid collisions for the input keys. If you insist on having a dense consecutive key space, then you've already covered the two primary choices. You could certainly try redis, I've seen it used for 10s of millions of key-value pairs, but it is probably not going to scale beyond that. You could also try memcached. It might have a slightly lower memory overhead than redis, but I would definitely experiment with both, since they are fairly similar for this particular usage. You don't actually need Redis's advanced data structures. If you need more key-values than you can store in memory on a single machine, you could fall back to something like BDB or Kyoto cabinet, but eventually this step is going to become the bottleneck to your processing. The other red flag is if you can fit an entire column in memory on a single machine, then why are you using Hadoop? Honestly, relying on a dense ordered primary key is one of the first things that gets thrown out in a NoSQL DB as it assumes a single coordinated master. If you can allow for even some gaps, then you can do something similar to a vector clock. One final alternative, would be to use a map-reduce job to collect all the duplicate values up by key and then assign a unique value using some external transactional DB counter. However, the map-reduce job is essentially a multi-pass approach, so it may be worse. The main advantage is that you will be getting some IO parallelism. (Although the id assignment is still a serial transaction.)

http://stackoverflow.com/q/22970688
tagged with: java
has comment: http://stackoverflow.com/comment/35128686
has comment: http://stackoverflow.com/comment/35129091
tagged with: stream
has title: Java seems to be sending carriage returns to a sub-process?
tagged with: process
has comment: http://stackoverflow.com/comment/35117592
tagged with: vbscript
has comment: http://stackoverflow.com/comment/35123214
type: Question
has body: I am using Java to handle the overhead of running a sub-process. The sub-process is the Microsoft Compute Cluster Pack (if that is relevant). When I run the MSCCP on command-line, everything is fine, I interact with it in prompts and everyone is happy. When I try to do the same in Java, the sub-process seems to act like infinite carriage returns are being sent to its stdin. (When I run the process on command prompt and just hit carriage return over and over, it exhibits the same behavior as when I run it in Java). Here is my java code, pretty standard: List&lt;String&gt; params = Arrays.asList("cmd.exe", "/c", "job.cmd", "submit", stderr, stdout, cwd, scheduler, name, user, run, bif); final Process p = new ProcessBuilder(params).redirectErrorStream(true).directory(location).start(); To keep the question concise, assume all variables are set right. They are -- I ran a loop, println-ing them to console, then copy and pasted them directly into my command prompt and it runs. Other variables, such as write below are BlockingQueues. In separate threads, I am listening to the stdout/err and stdin: // Thread for writing to sub-process' input stream when Queue has char[] in it new Thread(new Runnable() { public void run() { char[] writeThis; PrintWriter procIn = new PrintWriter(p.getOutputStream(), true); try { //write is a BlockingQueue which contains input to the program. while ((writeThis = write.take()) != null) { wait.set(true); for (int i = 0; i &lt; writeThis.length; i++) { procIn.print(writeThis[i]); writeThis[i] = 0; //clearing buffer for security reasons. } procIn.println(); //the only carriage return I intend to send... wait.set(false); } } catch (InterruptedException e) { e.printStackTrace(); } } }).start(); // Thread for listening to the stdout/stderr of the sub-process and reacting to its output. new Thread(new Runnable() { public void run() { Scanner procOut = new Scanner(p.getInputStream()); StringBuffer reqs = new StringBuffer(); while (procOut.hasNext()) { …
has comment: http://stackoverflow.com/comment/35083129
has comment: http://stackoverflow.com/comment/35131986
has comment: http://stackoverflow.com/comment/35128990
score: 0
has comment: http://stackoverflow.com/comment/35122332
has comment: http://stackoverflow.com/comment/35083587
has comment: http://stackoverflow.com/comment/35127887
has comment: http://stackoverflow.com/comment/35083373
type: UnansweredQuestion
tagged with: windows
has comment: http://stackoverflow.com/comment/35122574
has comment: http://stackoverflow.com/comment/35127869
has comment: http://stackoverflow.com/comment/35129097
answer count: 0

http://stackoverflow.com/comment/35227329
type: AnswerComment
score: 0
type: Comment
has text: line 5 : v(1st cell from where you start) is visited and `t` : cell
comment on: http://stackoverflow.com/a/23054029

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/23048532
tags question: http://stackoverflow.com/q/23080114
tags question: http://stackoverflow.com/q/23126973
tags question: http://stackoverflow.com/q/23106154
tags question: http://stackoverflow.com/q/23040273
tags question: http://stackoverflow.com/q/23055906
tags question: http://stackoverflow.com/q/23113547
tags question: http://stackoverflow.com/q/23048763
tags question: http://stackoverflow.com/q/22996984
tags question: http://stackoverflow.com/q/22987878
tags question: http://stackoverflow.com/q/23083480
tags question: http://stackoverflow.com/q/23086866
tags question: http://stackoverflow.com/q/22999959
tags question: http://stackoverflow.com/q/23005558
tags question: http://stackoverflow.com/q/23076696
tags question: http://stackoverflow.com/q/23005896
tags question: http://stackoverflow.com/q/23110337
tags question: http://stackoverflow.com/q/23036284
tags question: http://stackoverflow.com/q/23050150
tags question: http://stackoverflow.com/q/23090850
tags question: http://stackoverflow.com/q/23107235
type: Tag
tags question: http://stackoverflow.com/q/23044386
tags question: http://stackoverflow.com/q/22978777
tags question: http://stackoverflow.com/q/22996135
tags question: http://stackoverflow.com/q/23050483
tags question: http://stackoverflow.com/q/22999870
tags question: http://stackoverflow.com/q/22974522
tags question: http://stackoverflow.com/q/22983884
tags question: http://stackoverflow.com/q/23006440
tags question: http://stackoverflow.com/q/22984097
tags question: http://stackoverflow.com/q/23103189
tags question: http://stackoverflow.com/q/23049759
tags question: http://stackoverflow.com/q/23110212
tags question: http://stackoverflow.com/q/23044197
tags question: http://stackoverflow.com/q/23021667
tags question: http://stackoverflow.com/q/23126434
tags question: http://stackoverflow.com/q/23016047
tags question: http://stackoverflow.com/q/23045414
tags question: http://stackoverflow.com/q/22979551
tags question: http://stackoverflow.com/q/22985492
tags question: http://stackoverflow.com/q/23098020
tags question: http://stackoverflow.com/q/23116695
tags question: http://stackoverflow.com/q/23058030
tags question: http://stackoverflow.com/q/23058930
tags question: http://stackoverflow.com/q/23004397
tags question: http://stackoverflow.com/q/23017816
tags question: http://stackoverflow.com/q/23120815
tags question: http://stackoverflow.com/q/23030350
tags question: http://stackoverflow.com/q/23057726
tags question: http://stackoverflow.com/q/23085327
tags question: http://stackoverflow.com/q/23111029
tags question: http://stackoverflow.com/q/23076182
tags question: http://stackoverflow.com/q/23117885
tags question: http://stackoverflow.com/q/23020635
tags question: http://stackoverflow.com/q/23067972
tags question: http://stackoverflow.com/q/22998461
tags question: http://stackoverflow.com/q/23024795
tags question: http://stackoverflow.com/q/23064721
tags question: http://stackoverflow.com/q/22985076
tags question: http://stackoverflow.com/q/23115681
tags question: http://stackoverflow.com/q/23117943
tags question: http://stackoverflow.com/q/23022273
tags question: http://stackoverflow.com/q/22976498
tags question: http://stackoverflow.com/q/22996319
tags question: http://stackoverflow.com/q/23016557
tags question: http://stackoverflow.com/q/23060428
tags question: http://stackoverflow.com/q/23007497
tag name: xml
tags question: http://stackoverflow.com/q/23053180
tags question: http://stackoverflow.com/q/23068468
tags question: http://stackoverflow.com/q/23083815
tags question: http://stackoverflow.com/q/23016239
tags question: http://stackoverflow.com/q/23057015
tags question: http://stackoverflow.com/q/22978933
tags question: http://stackoverflow.com/q/23045859
tags question: http://stackoverflow.com/q/23113261
tags question: http://stackoverflow.com/q/23027382
tags question: http://stackoverflow.com/q/23006506
tags question: http://stackoverflow.com/q/23100965

http://stackoverflow.com/comment/35243381
score: 0
type: Comment
type: QuestionComment
has text: Isn't 'x' always 0 because you have commented `testText()` after `Log.e(TAG3, " getY: " + returnY);`? Or is it called from somewhere else?
comment on: http://stackoverflow.com/q/23063046

http://stackoverflow.com/q/23031555
has answer: http://stackoverflow.com/a/23032084
tagged with: jsf
has answer: http://stackoverflow.com/a/23032001
tagged with: java
has body: I have a question concerning JSF. If i want to write a own converter in JSF, it it necessary to implement the interface converter with the two abstract methods getAsObject(FacesContext context, UIComponent component, String value) and public String getAsString(FacesContext context, UIComponent component, Object value) It is not clear for me, which methods will be called automatically in which JSF lifecyclephase? Is it right, that the method "getAsObject" will be called, which a Request gets to the webserver and the method "getAsString" will be called, if the Response gets from the webserver to the client? Greetz Marwief
type: Question
score: 0
answer count: 2
has title: How to write own Converter in JSF
linked to: http://stackoverflow.com/q/23031746
type: UnansweredQuestion

http://stackoverflow.com/q/22976394
has answer: http://stackoverflow.com/a/22976727
has comment: http://stackoverflow.com/comment/35085944
has comment: http://stackoverflow.com/comment/35085987
accepted answer: http://stackoverflow.com/a/22976727
has comment: http://stackoverflow.com/comment/35086128
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35085921
has comment: http://stackoverflow.com/comment/35086135
has comment: http://stackoverflow.com/comment/35086453
tagged with: java
tagged with: compression
has comment: http://stackoverflow.com/comment/35086035
has comment: http://stackoverflow.com/comment/35085928
type: Question
has comment: http://stackoverflow.com/comment/35086068
has title: How you decompress an array of shorts[][] using for loops?
has body: I have to create a decompress method that is passed a compressed array of shorts created from another method in my program. It's basically RLE, with the first value being the number of times a value is repeated and the second being the value itself. I'm not the best with for loops or arrays - I'm really trying to get better - so this last part of my assignment is throwing me off. Can anyone help or point me in the right direction? public static short[][] decompress(short[][] cmpArray){ int position = 1; short[][] dcmpArray = new short[cmpArray.length][cmpArray.length]; for(int i=0; i&lt;cmpArray.length; i++){ for(int j=0; j&lt;cmpArray[0].length; j++){ } } return dcmpArray; } I know that I have to assign the incoming values to the new array - "dcmpArray" - and that should be done inside the for loop. I'm having problems on separating the values and then determining how many times the value should be printed in the new array. I was going to use "position" to determine the position in which index the value should be printed, but I'm having a brain fart..
has comment: http://stackoverflow.com/comment/35086339
has comment: http://stackoverflow.com/comment/35085937
tagged with: arrays
has comment: http://stackoverflow.com/comment/35086002
has comment: http://stackoverflow.com/comment/35086255
score: 0
tagged with: for-loop
answer count: 1
has comment: http://stackoverflow.com/comment/35085945

http://stackoverflow.com/a/22976778
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22976653
score: 1
upvote count: 1
has body: You can nest panels. One option you may want to consider is to create four panels with GridBagLayout (or labels). Use some simple photoshop to cut out one of the pale boxes and use it for the background of each panel/label. You can then you can just add each button on top of the panel/label. This way you will ensure that no matter what size the frame, the buttons will be in the pale image Here's an example using these images import java.awt.Dimension; import java.awt.Graphics; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class ButtonsWithBackground { public ButtonsWithBackground() { BufferedImage[] images = getImages(); ImagePanel backgroundPanel = new ImagePanel(images[0]); backgroundPanel.setLayout(new GridLayout(1, 2, 0, 0)); JPanel buttonsPanel = createButtonsPanel(images); JPanel leftPanel = new JPanel(); leftPanel.setOpaque(false); backgroundPanel.add(leftPanel); backgroundPanel.add(buttonsPanel); JFrame frame = new JFrame(); frame.setContentPane(backgroundPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } private JPanel createButtonsPanel(BufferedImage[] images) { JPanel panel = new JPanel(new GridLayout(4, 1)); for (int i = 0; i &lt; 4; i++) { ImagePanel buttonPanel = new ImagePanel(images[1]); buttonPanel.add(new JButton("Hey I'm a Button")); panel.add(buttonPanel); } return panel; } private BufferedImage[] getImages() { BufferedImage[] bi = new BufferedImage[2]; try { BufferedImage bg = ImageIO.read(new URL("https://i.sstatic.net/YFfO4.png")); BufferedImage jbtbg = ImageIO.read(new URL("https://i.sstatic.net/DtO9U.png")); bi[0] = bg; bi[1] = jbtbg; } catch (I…

http://stackoverflow.com/a/22988679
answers question: http://stackoverflow.com/q/22988604
has body: You are comparing String with char so change '-' with "-" ( do same for other operators as well ) and compare it as Op.equals("-") and about error: not a statement; assign the result to a variable like result = a-b
score: 0
type: Answer

http://stackoverflow.com/a/23112714
score: 1
has body: This is called anonymous class. Generally it's creating new implementation of ActionListener interface and overloading actionPerformed method. Its equivalent of class MyActionListener implements ActionListener { public void actionPerformed(ActionEvent e) { String location = GUI.Custom.QuickDialogs.selectFile(false); ... } } addActionListener(new MyActionListener()) More information can be found at http://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html
answers question: http://stackoverflow.com/q/23112626
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/23104926
has body: Create a small class to hold your data: public class ListItem { public String path; public int pos; } Then use a List&lt; ListItem >.
has comment: http://stackoverflow.com/comment/35317150
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23104778
has comment: http://stackoverflow.com/comment/35323583
has comment: http://stackoverflow.com/comment/35317244
score: 3
has comment: http://stackoverflow.com/comment/35323321
type: Answer
answers question: http://stackoverflow.com/q/23104778
has comment: http://stackoverflow.com/comment/35317086
upvote count: 3

http://stackoverflow.com/q/22997636
has answer: http://stackoverflow.com/a/23021760
has answer: http://stackoverflow.com/a/23015481
upvote count: 0
tagged with: java
downvote count: 1
has title: How to deploy jar in eclipse maven remote repository?
type: Question
tagged with: svn
score: -1
tagged with: eclipse
answer count: 2
has body: i am working with others developers on eclipse project. The project is hosted on SVN. I wonder how I can add JAR file to the dependencies. Thank you.
tagged with: jar
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4649015
tagged with: maven

http://stackoverflow.com/q/23008253
has title: Strange stacktrace in analytics
type: Question
tagged with: google-analytics
duplicate of: http://stackoverflow.com/q/8585184
upvote count: 1
has body: can someone explain me the following stacktrace? Thread: main, Message: File res/drawable/zz_moto_list_bkg.xml from drawable resource ID #0x1080417 Stacktrace: android.content.res.Resources$NotFoundException: File res/drawable/zz_moto_list_bkg.xml from drawable resource ID #0x1080417 at android.content.res.Resources.loadDrawable(Resources.java:1735) at android.content.res.TypedArray.getDrawable(TypedArray.java:601) at android.widget.ListView.&lt;init&gt;(ListView.java:200) at android.widget.AutoCompleteTextView$DropDownListView.&lt;init&gt;(AutoCompleteTextView.java:1578) at android.widget.AutoCompleteTextView.buildDropDown(AutoCompleteTextView.java:1330) at android.widget.AutoCompleteTextView.showDropDown(AutoCompleteTextView.java:1182 at android.widget.AutoCompleteTextView.updateDropDownForFilter(AutoCompleteTextView.java:1060) at android.widget.AutoCompleteTextView.onFilterComplete(AutoCompleteTextView.java:1043) at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:285) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3859) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:890) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:648) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at android.graphics.drawable.LayerDrawable.addLayer(LayerDrawable.java:186) at android.graphics.drawable.LayerDrawable.inflate(LayerDrawable.java:157) at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:795) at android.graphics.drawable.Drawable.createFromXml(Drawable.java:736) at android.content.res.Resources.loadDrawable(Resources.java:1732) ... 16 more I can find this causing a force close multiple times in my analytics and only motorola devices seem to be affected. I…
downvote count: 0
tagged with: motorola
favorite count: 0
linked to: http://stackoverflow.com/q/8585184
type: UnansweredQuestion
tagged with: android
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/23009293
has body: The problem The error comes from an access to arr[2], while only indices 0 and 1 are valid (0-based index) for an array of size 2. The solution Your limits should be instead: i &lt; arr.length in the first loop j &lt; arr[i].length in the second loop. The explanation As a general rule, access to something[index] requires 0 &lt;= index &lt; something.length. What's wrong in your case: In the first loop, you can replace my something by your arr and the index is i. You're defining an index i that is used to access arr[i] without limiting it to the range of arr. In the second loop, you can replace my something by your arr[i] and the index is j. You're defining an index j that is used to access arr[i][j], but j is not guaranteed to be in the range of arr[i], because you define it in the range of arr[2] (which by the way, does not exist).
score: 1
answers question: http://stackoverflow.com/q/23009211
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/23117796
downvote count: 0
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/23117762
has body: Unchecked exceptions are mainly compiler-level, as they internally get thrown around in the same way. Only differences are requirements of them being explicit in code and method signatures. You create an unchecked exception by inheriting from RuntimeException as opposed to Exception. JLS 11.2 states: The Java programming language requires that a program contains handlers for checked exceptions which can result from execution of a method or constructor (§8.4.6, §8.8.5). This compile-time checking for the presence of exception handlers is designed to reduce the number of exceptions which are not properly handled. For each checked exception which is a possible result, the throws clause for the method or constructor must mention the class of that exception or one of the superclasses of the class of that exception (§11.2.3). .... The unchecked exception classes (§11.1.1) are exempted from compile-time checking.
score: 6
accepted answer of: http://stackoverflow.com/q/23117762
type: AcceptedAnswer

http://stackoverflow.com/comment/35354674
comment on: http://stackoverflow.com/a/23125492
type: AnswerComment
has text: So i went ahead and tried your suggestions. Now the emulator is showing zero text when i run it.
score: 0
type: Comment

http://stackoverflow.com/comment/35232008
score: 0
has text: I modified the example in a more explicative way... ;)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23056777

http://stackoverflow.com/comment/35294903
comment on: http://stackoverflow.com/a/23091608
has text: @Quincunx Hmm, you're right. I don't know much about regex interpreters. Could that potentially be slower since it has to recheck for spaces after every char?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/108103493
score: 0
type: Comment
has text: @uvsmtid Thanks for adding that. It clarified exactly what I was trying to answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/23050180

http://stackoverflow.com/a/23079313
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/23079197
score: 8
has body: java.net.URL aURL; try { aURL = new java.net.URL("http://example.com:80/docs/"); System.out.println("host = " + aURL.getHost()); //example.com } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); }
downvote count: 0
has comment: http://stackoverflow.com/comment/35272273

http://stackoverflow.com/q/23094606
has comment: http://stackoverflow.com/comment/35300514
has body: *I'm using marker on google map it doesn't update or not moving while i'm walking.. I want that marker to move as i walk... *I need to use Network location while gps location not available then ultimately i need to use GPS location when it's available... GetandGiveLocation.java public class GetandGiveLocation extends Service implements LocationListener { private final Context mContext; // flag for GPS status boolean isGPSEnabled = false; // flag for network status boolean isNetworkEnabled = false; // flag for GPS status boolean canGetLocation = false; Location location; // location double latitude; // latitude double longitude; // longitude // The minimum distance to change Updates in meters private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES =0; // 10 meters // The minimum time between updates in milliseconds private static final long MIN_TIME_BW_UPDATES = 0; // 2seconds // Declaring a Location Manager protected LocationManager locationManager; public GetandGiveLocation(Context context) { this.mContext = context; getLocation(); } public Location getLocation() { try { locationManager = (LocationManager) mContext .getSystemService(LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setAltitudeRequired(false); criteria.setBearingRequired(false); criteria.setCostAllowed(true); criteria.setPowerRequirement(Criteria.NO_REQUIREMENT); String bestProvider = locationManager.getBestProvider(criteria, true); // getting GPS status isGPSEnabled = locationManager .isProviderEnabled(LocationManager.GPS_PROVIDER); // getting network status isNetworkEnabled = locationManager .isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!isGPSEnabled && !isNetworkEnabled) { // no network provider is enabled } else { this.canGetLocation = true; // First get location from Network Provider if (isNetworkEnabled) { locationManager.requestLocationUpdates( bestProvider, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); L…
tagged with: gps
has title: I'm using marker on google map it doesn't update or not moving while i'm walking
answer count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/35300612
has comment: http://stackoverflow.com/comment/35300819
tagged with: java
tagged with: google-maps-api-3
score: 0
tagged with: google-maps
has comment: http://stackoverflow.com/comment/35300686
tagged with: android

http://stackoverflow.com/q/23119747
upvote count: 1
has comment: http://stackoverflow.com/comment/35344730
has comment: http://stackoverflow.com/comment/35345372
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35344973
has answer: http://stackoverflow.com/a/23119886
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35345265
answer count: 2
has comment: http://stackoverflow.com/comment/35344733
downvote count: 5
has comment: http://stackoverflow.com/comment/35344552
has comment: http://stackoverflow.com/comment/35344689
has comment: http://stackoverflow.com/comment/35344644
accepted answer: http://stackoverflow.com/a/23119886
has comment: http://stackoverflow.com/comment/35345111
has comment: http://stackoverflow.com/comment/35344928
has comment: http://stackoverflow.com/comment/35345195
has comment: http://stackoverflow.com/comment/35344777
has comment: http://stackoverflow.com/comment/35344618
has comment: http://stackoverflow.com/comment/35345351
favorite count: 0
possible better answer: http://stackoverflow.com/a/23119789
has body: //I know that compareTo() returns an int value. returns 0 if a equal b returns -1 if a &lt; b returns 1 if a &gt; b //But how does sort method makes use of these 0, 1, -1 values, and how does it arranges the list exactly.
has comment: http://stackoverflow.com/comment/35344564
has answer: http://stackoverflow.com/a/23119789
score: -4
has title: CompareTo() method in Java

http://stackoverflow.com/q/23080696
downvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23080713
score: 0
answer count: 2
has body: Can somebody please tell me if the keyword 'extends' must be an used (in the syntax) of child classes that overide methods of their super class.
tagged with: polymorphism
favorite count: 0
possible better answer: http://stackoverflow.com/a/32196762
has answer: http://stackoverflow.com/a/32196762
accepted answer: http://stackoverflow.com/a/23080713
has title: Trying to understand the basics of polymorphism in Java.
tagged with: java
upvote count: 1

http://stackoverflow.com/q/23076177
tagged with: concurrency
has title: do I need a lock?
downvote count: 0
has comment: http://stackoverflow.com/comment/36349895
has answer: http://stackoverflow.com/a/23076435
favorite count: 0
has answer: http://stackoverflow.com/a/23076439
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35267079
has answer: http://stackoverflow.com/a/23076415
tagged with: java
has comment: http://stackoverflow.com/comment/35267302
has answer: http://stackoverflow.com/a/23076271
type: Question
has answer: http://stackoverflow.com/a/23076365
score: 5
has comment: http://stackoverflow.com/comment/35267241
has body: MyObject myObj ... public void updateObj(){ MyObject newObj = getNewMyObject(); myObj = newObj; } public int getSomething(){ //O(n^2) operation performed in getSomething method int something = myObj.getSomething(); return something; } Suppose the main thread periodically calls updateObj() and a child thread calling getSomething() method pretty often. Do I need a lock (or declare methods as synchronized) before myObj = newObj; and int something = myObj.getSomething(); Someone argued I don't need a lock here because in Java, assignment operations (e.g myObj = newObj;) is atomic. But what I don't get it is that myObj.getSomething(); this is not an atomic operation but its O(n^2) so I think a locking is still needed. Is this correct?
has comment: http://stackoverflow.com/comment/35267088
upvote count: 5

http://stackoverflow.com/comment/35270137
score: 0
type: Comment
type: QuestionComment
has text: i am running this app in my local machine
comment on: http://stackoverflow.com/q/23077982

http://stackoverflow.com/comment/35312709
type: Comment
comment on: http://stackoverflow.com/q/23101679
has text: Well, I guessed that it was supposed to be. But how is the program supposed to know that it's 11, 12, 13, ... and not (say) 111, 21, 31, 4, 1, 51, 6 ?
score: 0
type: QuestionComment

http://stackoverflow.com/q/22987147
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35107682
tagged with: glasspane
answer count: 0
score: 0
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/35107748
tagged with: jdialog
has body: I have got a frame in which sometimes a dialog is opened. I would like this dialog to be attached to the existing frame, so for example when I drag that frame the opened dialog follows it. I have heard that this might be possible to achieve using GlassPane but I need some hints. Right now, when I open a new dialog and set its location relative to frame it looks like this: I would like the "testDialog" to appear next to the frame attached to its upper-right corner. When I drag the "test" frame, the "testDialog" follows it. Here is a working example: import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Example { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { showGUI(); } }); } public static void showGUI() { final JFrame frame=new JFrame("test"); JButton open=new JButton("Open new dialog"); open.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("test"); JDialog dialog=new JDialog((Frame)null,"testdialog"); dialog.setPreferredSize(new Dimension(200,300)); dialog.getContentPane().add(new JLabel("testlabel")); dialog.pack(); dialog.setLocationRelativeTo(frame); dialog.setVisible(true); } }); frame.setLayout(new FlowLayout()); frame.getContentPane().add(open); frame.getContentPane().add(new JLabel("test")); frame.setLocationRelativeTo(null); frame.setPreferredSize(new Dimension(400, 200)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } }
has comment: http://stackoverflow.com/comment/35107628
has title: Swing: how to open and attach a new dialog into an existing frame?
tagged with: jframe

http://stackoverflow.com/comment/35162334
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23018606
has text: You need administrator rights to override this file. Try launching your application as Administrator and It should work. If not, try removing the "Read only" flag on that file. Or you could allow your current user to modify the file, but it's absolutly not recommended.
score: 0

http://stackoverflow.com/comment/35227892
has text: you write a code to check the session in servlet and make ajax call to that servlet..I hope u get it.
comment on: http://stackoverflow.com/q/23054471
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35171469
type: Comment
type: QuestionComment
has text: Literally been doing this for hours. Have rest of code written and everything works but I need to check for the user entering "q" to exit in a specific method. The only return in this method is a string. tried with the parse, works for numbers, but once i enter the q it crashes. Anyway I can upload code to here to have a peek. I have tried a bunch of different ways.
score: 0
comment on: http://stackoverflow.com/q/23023190

http://stackoverflow.com/comment/35089618
comment on: http://stackoverflow.com/q/22978333
type: QuestionComment
type: Comment
has text: You don't connect to networks. You connect to hosts, via networks. Your question is unclear.
score: 0

http://stackoverflow.com/q/23086961
has title: StanfordCoreNLP does not work in my way
has body: I use below code. However, the outcome is not what I expected. The outcome is [machine, Learning] But I want to get [machine, learn]. How can I do this? Also, when my input is "biggest bigger", I wanna get the result like [big, big], but the outcome is just [biggest bigger] (PS: I just add these four jars in my eclipse:joda-time.jar, stanford-corenlp-3.3.1-models.jar, stanford-corenlp-3.3.1.jar, xom.jar Do I need add some more?) import java.util.LinkedList; import java.util.List; import java.util.Properties; import edu.stanford.nlp.ling.CoreAnnotations.LemmaAnnotation; import edu.stanford.nlp.ling.CoreAnnotations.SentencesAnnotation; import edu.stanford.nlp.ling.CoreAnnotations.TokensAnnotation; import edu.stanford.nlp.ling.CoreLabel; import edu.stanford.nlp.pipeline.Annotation; import edu.stanford.nlp.pipeline.StanfordCoreNLP; import edu.stanford.nlp.util.CoreMap; public class StanfordLemmatizer { protected StanfordCoreNLP pipeline; public StanfordLemmatizer() { // Create StanfordCoreNLP object properties, with POS tagging // (required for lemmatization), and lemmatization Properties props; props = new Properties(); props.put("annotators", "tokenize, ssplit, pos, lemma"); this.pipeline = new StanfordCoreNLP(props); } public List&lt;String&gt; lemmatize(String documentText) { List&lt;String&gt; lemmas = new LinkedList&lt;String&gt;(); // Create an empty Annotation just with the given text Annotation document = new Annotation(documentText); // run all Annotators on this text this.pipeline.annotate(document); // Iterate over all of the sentences found List&lt;CoreMap&gt; sentences = document.get(SentencesAnnotation.class); for(CoreMap sentence: sentences) { // Iterate over all tokens in a sentence for (CoreLabel token: sentence.get(TokensAnnotation.class)) { // Retrieve and add the lemma for each word into the // list of lemmas lemmas.add(token.get(LemmaAnnotation.class)); } } return lemmas; } // Test public static void main(String[] args) { System.out.println("Starti…
tagged with: stemming
score: 0
tagged with: lemmatization
answer count: 1
tagged with: nlp
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23099837
accepted answer: http://stackoverflow.com/a/23099837
type: Question
tagged with: stanford-nlp
tagged with: java

http://stackoverflow.com/q/23120474
downvote count: 2
upvote count: 1
answer count: 1
favorite count: 0
tagged with: static-methods
tagged with: non-static
linked to: http://stackoverflow.com/q/2042813
has comment: http://stackoverflow.com/comment/35345908
accepted answer: http://stackoverflow.com/a/23120509
tagged with: jframe
has body: I am using swing to make a java project with JFrames. I am trying to call the non-static method build(), which builds the JFrame with its components. However, build can't be static because I am using getClass(), which requires a non-static method. I can't make my main non-static, so how can I call build? Here is my code: public class MainUI { public static void main(String[] args) { build(); // Calls build method } private void build() { // Builds JFrame JFrame frame = new JFrame(); JPanel base = new JPanel(); JLabel background = new JLabel(); frame.setVisible(true); frame.setTitle("Space Age"); frame.setSize(640,480); frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); frame.setAutoRequestFocus(false); frame.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); frame.setLocationRelativeTo(null); base.setSize(640,480); base.setAlignmentX(0.0F); base.setAlignmentY(0.0F); base.setBackground(new java.awt.Color(255,255,255)); background.setSize(640,480); background.setAlignmentX(0.0F); background.setAlignmentY(0.0F); background.setIcon(new javax.swing.ImageIcon(getClass().getResource("/path/image.png"))); frame.add(base); frame.add(background); } // Variable declarations private JFrame frame; private JPanel base; private JLabel background; }
tagged with: swing
has title: How to call non-static method from static method?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23120509
tagged with: java
score: -1
type: Question
duplicate of: http://stackoverflow.com/q/2042813

http://stackoverflow.com/q/22975896
tagged with: playframework
upvote count: 1
answer count: 1
favorite count: 0
tagged with: playframework-2.2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24999320
has body: So I have Play Framework running at the moment with JPA and Hibernate. I'm completely new to both and the tutorials I've found around the web are above my head. How in the world can I send a simple query or create a table? This is example code I've written up and I get: "RuntimeException: No EntityManager bound to this thread. Try wrapping this call in JPA.withTransaction, or ensure that the HTTP context is setup on this thread." package controllers; import play.Logger; import javax.persistence.Entity; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.EntityTransaction; import javax.persistence.Persistence; import javax.persistence.Query; import play.db.jpa.JPA; import play.mvc.Controller; import play.db.*; public class Database { public static void initbuild() { Logger.info("Checking database structure. The database will be restructured if not in the correct format."); JPA.em().createQuery("create table test"); } }
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Create a Table/Query with JPA/Hibernate in Play Framework

http://stackoverflow.com/comment/35233524
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23057096
score: 0
has text: @RomanC I've already added the maven dependencies in the deployment assembly (myProject=>properties=>Deployment Assembly=>add=>java build path entries=>maven dependencies); Is this what you meant by deploy them with the application?

http://stackoverflow.com/comment/35198786
has text: Why don't use scala-swing?
type: QuestionComment
comment on: http://stackoverflow.com/q/23038558
score: 0
type: Comment

http://stackoverflow.com/comment/35162186
has text: You should update all plugins.
comment on: http://stackoverflow.com/q/23012400
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35195794
type: AnswerComment
type: Comment
has text: @JaviFernández absolutely not. What makes you think that?
comment on: http://stackoverflow.com/a/23036991
score: 0

http://stackoverflow.com/a/22986068
accepted answer of: http://stackoverflow.com/q/22985896
answers question: http://stackoverflow.com/q/22985896
has body: Use this. @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) { String myStr = spinner.getSelectedItem().toString(); selectedSpinner.setText(myStr); } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { }
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/comment/35073691
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22969140
has text: thanks but this article use static string ListView ... and not use dynamic string as in my case
score: 0

exec
tags question: http://stackoverflow.com/q/23004879
tag name: exec
type: Tag

http://stackoverflow.com/comment/35176844
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23024464
has text: On which line you get the exception?! Please add your stack trace!
score: 0

http://stackoverflow.com/comment/35236556
has text: It's very good for high performance queries with lots of data. But it has some limitations compared to standard MySQL engines.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23055899
type: AnswerComment

http://stackoverflow.com/a/23017017
type: AcceptedAnswer
downvote count: 0
upvote count: 1
type: Answer
has body: Location best = locations.parallelStream().min(new ComparatorScoreDif(colour)).get(); That will return the actual object from the optional object. it it exists. You might call .isPresent() on the optional object beforehand to check this. Am I going in the right direction here, is this the right way to do this? Yes it is. By calling .parallelStream() you hand over the concurrency part to the JVM (it will partition the stream into multiple substreams)and you can focus on the actual logic that has to be executed in parallel. See OracleDocs - Parallelism for further information and some nice explainings.
accepted answer of: http://stackoverflow.com/q/23016965
score: 1
answers question: http://stackoverflow.com/q/23016965

http://stackoverflow.com/comment/35153132
type: Comment
has text: This is EXACTLY what I wanted, thank you very much for that txtPhone.setFocusableInTouchMode(true); was the part I needed but didn't know about its use :D
score: 0
comment on: http://stackoverflow.com/a/23001038
type: AnswerComment

http://stackoverflow.com/comment/35232166
has text: have put in String Cheryl = "running is a good hobby"; and it has no errors, yet when I run it, nothing appears in the console and no errors either!. I apologise if I am annoying anyone.
type: Comment
comment on: http://stackoverflow.com/a/23054796
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35346310
type: Comment
has text: The OP is using `after` to compare the two dates, which is far more readable than `compareTo`. Using this code would be a step backwards.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23120023

http://stackoverflow.com/a/23017601
has comment: http://stackoverflow.com/comment/35225696
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23016557
has body: Say we have annotated entity @XmlRootElement public class Product { String name; @XmlElement(name="sss") public void setName(String name) { this.name = name; } } Code below will print "sss" using java Reflection API. Here 'product' is an object of Product class import java.lang.reflect.Method; ... Method m = product.getClass().getMethod("setName",String.class); XmlElement a = m.getAnnotation(XmlElement.class); String nameValue = a.name(); System.out.println(nameValue); If you need to get @XmlElement annotation attribute from private field, you could use something like this: Field nameField = product.getClass().getDeclaredField("name"); nameField.setAccessible(true); XmlElement a = nameField.getAnnotation(XmlElement.class); String nameValue = a.name(); System.out.println(nameValue);
type: AcceptedAnswer
score: 4
downvote count: 0
answers question: http://stackoverflow.com/q/23016557
has comment: http://stackoverflow.com/comment/35160767
type: Answer

http://stackoverflow.com/a/23050390
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23050343
answers question: http://stackoverflow.com/q/23050343
has body: The class is for a Tree, which is a common data structure used to store things in a tree like form (each part of the tree is called a "node", and then each node can have a child node to its left or right like this. The generic parameter T means we can create a tree of any type, and all the nodes in that tree will need to be of that same type. The constructor we see allows us to create a new Node (the top of the tree), initialise it with the rootData, and create a list of children which will be all of the nodes below this root node.

http://stackoverflow.com/q/23093553
has answer: http://stackoverflow.com/a/23093979
type: Question
tagged with: for-loop
answer count: 1
tagged with: alignment
score: 0
accepted answer: http://stackoverflow.com/a/23093979
has body: I have information from a text file that I have read in through 3 parallel arrays. There's one for names, id numbers, and gpa. However because the name lengths vary the id numbers and gpa are all shifted differently. Is there a way to align all the id numbers so they begin on the same part of the line and the same for the gpa's despite different name lengths? I used a for loop for all of it and my code looks like this: { int lineLength; lineLength = lineFinder(names); System.out.printf("NAME ID GPA\n"); System.out.println(); for(int i = 0; i &lt; lineLength; i++) { System.out.printf("%s %14d %14.2f", names[i] , id[i], gpa[i]); System.out.println(); } } Any suggestions would be appreciated :)
type: AnsweredQuestion
tagged with: java
tagged with: loops
has title: How to align print statements on the same line with varying lengths in Java?
has comment: http://stackoverflow.com/comment/35298376

http://stackoverflow.com/comment/35277921
type: Comment
type: QuestionComment
has text: Your json does not contain the array of boolean (arr property), If you want to populate it then you need to write custom JsonDeserializer
comment on: http://stackoverflow.com/q/23082431
score: 0

http://stackoverflow.com/comment/35222316
type: Comment
type: QuestionComment
has text: @trashgod Any suggestions for a profiler to work with Android Studio? I'm just starting with profiling.
comment on: http://stackoverflow.com/q/23049628
score: 0

http://stackoverflow.com/comment/35342087
type: QuestionComment
has text: Please include the error stack trace and the code where it is caused.
comment on: http://stackoverflow.com/q/23118213
score: 0
type: Comment

http://stackoverflow.com/comment/35133519
type: Comment
comment on: http://stackoverflow.com/q/23002490
has text: Eating dinner if no one answers when I'm done I will pop the code in eclipse and check it out.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35229038
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23055536
has text: Ok, that means that the Spring configuration is in XML files. It is probably called something like, applicationContext.xml, config.xml, mvc-dispatcher.xml or something like that

http://stackoverflow.com/comment/35097674
has text: //Move this to a new mutator method to set the HashSet while (sc2.hasNextLine()) { Scanner s2 = new Scanner(sc2.nextLine()); boolean b; while (b = s2.hasNext()) { String s = s2.next(); withoutDuplicatesHashSet.add(s); System.out.println(s); } } System.out.println(withoutDuplicatesHashSet);
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22978032
type: Comment

http://stackoverflow.com/q/23029749
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/35182470
has comment: http://stackoverflow.com/comment/35182538
tagged with: php
has comment: http://stackoverflow.com/comment/35192290
tagged with: java
has comment: http://stackoverflow.com/comment/35182552
type: Question
tagged with: jsoup
has comment: http://stackoverflow.com/comment/35182602
score: 0
has comment: http://stackoverflow.com/comment/35182474
has body: This is my first ever post on stackoverflow. StackOverflow has always been a helper for me in case of any difficulties, I face during coding. Well not wasting much time, let me go to the problem in which I have stuck, For a project, I am building up the database. I have a database of hyperlinks in this format, http://link.xyz.com/?id=108 http://link.xyz.com/?id=109 httpp://link.xyz.com/?id=110 and so on. These links when fired up in browser, redirects me to a download link which starts downloading the content. Example: When httpp://link.xyz.com/?id=108 is opened in browser, it redirects me to the below url. httpp://xyz.com/abc/pqr/some_content.avi [download link]. SO i am looking for a solutions which converts my huge list of hyperlinks into download link. Solution is any programming language is acceptable, as far as the secure links are converted into download links. I tried using HttpURLConnection and several libraries in JAVA but no sucess. I throws away the below exception, Request URL ... httpp://link.xyz.com/?id=3108 Response Code ... 403 java.io.IOException: Server returned HTTP response code: 403 for URL: httpp://link.xyz.com/?id=3108 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at Fetch.main(Fetch.java:56) Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: httpp://link.xyz.com/?id=3108 at sun.net.www.protocol.http.HttpURLConnection.getInpu…
answer count: 1
has comment: http://stackoverflow.com/comment/35182717
has comment: http://stackoverflow.com/comment/35182436
has answer: http://stackoverflow.com/a/23029882
has comment: http://stackoverflow.com/comment/35190726
type: UnansweredQuestion
has title: How to Determine the Download Link from a Secure Link?

http://stackoverflow.com/q/23071656
has comment: http://stackoverflow.com/comment/35259940
tagged with: inputstream
has comment: http://stackoverflow.com/comment/35259650
has comment: http://stackoverflow.com/comment/35285721
type: AnsweredQuestion
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/8653283
favorite count: 0
has title: "java.lang.OutOfMemoryError: Java heap space" while reading huge zip files
tagged with: truevfs
type: Question
has answer: http://stackoverflow.com/a/23110056
has comment: http://stackoverflow.com/comment/35259450
tagged with: http://stackoverflow.com/tag/zip
has body: I have a program that load data into a DB thru namedpipes, very cool. This program was running for about 2 years and accept text files or gzip. But now appeared some zip to load and I want to improve it. But I can't put this to work, I'm getting an OutOfMemoryError. (Of course, I'm calling this using -Xms512M -Xmx2048M) Below is how I get the InputStream: PipeLoader.java protected BufferedReader getBufferedReader(File file, String compression) throws Exception { BufferedReader bufferedReader = null; if(compression.isEmpty()) { bufferedReader = new BufferedReader(new FileReader(file), BUFFER); } else if(compression.equalsIgnoreCase("gzip")) { InputStream fileStream = new FileInputStream(file); InputStream gzipStream = new GZIPInputStream(fileStream); // Works fine Reader reader = new InputStreamReader(gzipStream); bufferedReader = new BufferedReader(reader, BUFFER); } else if(compression.equalsIgnoreCase("zip")){ InputStream fileStream = new FileInputStream(file); ZipInputStream zipStream = new ZipInputStream(fileStream); zipStream.getNextEntry(); // For testing purposes I'm getting only the first entry Reader reader = new InputStreamReader(zipStream); // Works only with small zips bufferedReader = new BufferedReader(reader, BUFFER); } return bufferedReader; } I'm also tried with TrueVFS library: // The same: works with small zip files, OutOfMemoryError with big zip files TFile tFile = new TFile(file); TFileInputStream tfis = new TFileInputStream(new TFile(tFile.getAbsolutePath(), tFile.list()[0])); Reader reader = new InputStreamReader(tfis); bufferedReader = new BufferedReader(reader, BUFFER); And yes, I'm closing everything properly (remember, works with gz!). In this case I need to load some zip file with only 1 plain textfile inside (~4GB zipped, ~35GB unzipped) I got an OutOfMemoryError in the first file, in less than 1min from the start. PS.: This is not a duplicate from Reading a huge Zip file in java - Out of Memory Error, he had the option to read each one …
tagged with: java
has comment: http://stackoverflow.com/comment/35285418
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/23110056

http://stackoverflow.com/comment/35099442
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22984130
has text: @GrIsHu try it yourself before commenting
score: 1

http://stackoverflow.com/comment/35167977
type: QuestionComment
comment on: http://stackoverflow.com/q/23021406
type: Comment
score: 0
has text: [SML](http://en.wikipedia.org/wiki/Standard_ML_of_New_Jersey)

http://stackoverflow.com/comment/35219624
score: 0
type: Comment
has text: @BevynQ YOU GOT IT! Oh my god I can't believe I made employees static -.- Thank you so much
type: QuestionComment
comment on: http://stackoverflow.com/q/23049606

http://stackoverflow.com/comment/35171663
type: AnswerComment
has text: Yes it's a typo. Anyway, this part is compiling correctly, I get the right info in login and user.
type: Comment
comment on: http://stackoverflow.com/a/23023338
score: 0

http://stackoverflow.com/a/23017252
has comment: http://stackoverflow.com/comment/35165627
upvote count: 1
has comment: http://stackoverflow.com/comment/35164987
has body: Apache Tika tries to return consistent metadata across all file formats. It shouldn't matter if one format calls it Author, another Creator, another Created By and another Creator[0], Tika maps those all onto a consistent key. Typically, those keys are based on well known external standards, such as Dublin Core If you want to see the mappings that Tika applies to Microsoft Office documents, you'll need to look in SummaryExtractor. If you want to know what all the metadata keys and values are that Tika can extract from a given file, either use the tika-app cli tool with --metadata, or call names() on the Metadata object to get the list of metadata keys Tika found.
type: Answer
has comment: http://stackoverflow.com/comment/35881247
answers question: http://stackoverflow.com/q/23013861
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35459457

http://stackoverflow.com/comment/35236909
has text: But [in-order](http://en.wikipedia.org/wiki/Tree_traversal#In-order_.28symmetric.29) is: left, self, right. The output is ok, but completely confusing. The confirmed answer already catches the solution. I think my output is correct, isn't it?
comment on: http://stackoverflow.com/a/23059379
score: 0
type: AnswerComment
type: Comment

memory-management
tags question: http://stackoverflow.com/q/23106011
tags question: http://stackoverflow.com/q/23040583
tags question: http://stackoverflow.com/q/23083398
tags question: http://stackoverflow.com/q/23027712
tags question: http://stackoverflow.com/q/23100294
tags question: http://stackoverflow.com/q/23081565
tags question: http://stackoverflow.com/q/23093934
tags question: http://stackoverflow.com/q/23036898
type: Tag
tag name: memory-management

http://stackoverflow.com/q/22982846
score: 0
answer count: 1
has body: Here is the issue: I have a class for e.g., public class EmployeeServiceImpl { @Autowired EmployeeDAO empDAO; public void findDepartments() throws NoEmployeeFoundException { int age = empDAO.findEmployeeById(12).getAge(); if( age &gt; 30 ){ //do something }else{ //do something else. } } } My goal is to : (1) detect the variable assignment (2) remove the variable assignment and (3) add the assigned variable as method parameter. So, after AST transformation, the code will look like : public class EmployeeServiceImpl { @Autowired EmployeeDAO empDAO; public void findDepartments(int age) throws NoEmployeeFoundException { if( age &gt; 30 ){ //do something }else{ //do something else. } } } I am able to do (1) &amp; (2). However, for (3), although the variable assignment node is getting removed, I'm not able to add the parameter to the method. The AST transformer code is given below. What am I missing? (Please forgive the monolithic code and the absolute disregard for sound design) MethodVisitor visitor = new MethodVisitor(); String source = unit.getSource(); Document document = new Document(source); ASTParser parser = ASTParser.newParser(AST.JLS3); parser.setSource(unit); CompilationUnit astRoot = parse(unit); AST ast = astRoot.getAST(); astRoot.accept(visitor); TestGenClassVisitor classVisitor = new TestGenClassVisitor(); for (MethodDeclaration method : visitor.getMethods()) { method.accept( classVisitor ); } // creation of ASTRewrite ASTRewrite rewrite = ASTRewrite.create( ast ); astRoot.recordModifications(); // for getting insertion position TypeDeclaration typeDecl = (TypeDeclaration) astRoot.types() .get(0); MethodDeclaration methodDecl = typeDecl.getMethods()[0]; Block block = methodDecl.getBody(); List&lt;VariableDeclarationStatement&gt; varDeclarations = classVisitor.getReplaceableVardDeclarationNodes(); ListRewrite listRewrite = rewrite.getListRewrite(block, Block.STATEMENTS_PROPERTY); TextEditGroup textEditGroup = new TextEditGroup("abc"); for( VariableDeclarati…
accepted answer: http://stackoverflow.com/a/23009236
type: AnsweredQuestion
tagged with: java
tagged with: eclipse-jdt
type: Question
has answer: http://stackoverflow.com/a/23009236
tagged with: eclipse
has title: Adding method parameters using Eclipse AST

http://stackoverflow.com/a/23044395
type: Answer
has comment: http://stackoverflow.com/comment/35209358
answers question: http://stackoverflow.com/q/23044225
score: 0
has body: you cannot get direct values , without any reference date for your requirements, you need define first reference value like below: String dateStart = "01/14/2012 09:29:58"; SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss") Date d1 = format.parse(dateStart); the above is your reference date , now you need to find the current date and time using following. long currentDateTime = System.currentTimeMillis(); Date currentDate = new Date(currentDateTime); Date d2.format(currentDate) and the difference of these values like long diff=d2-d1 will gives values in milliseconds. then long diffSeconds = diff / 1000 % 60; long diffMinutes = diff / (60 * 1000) % 60; long diffHours = diff / (60 * 60 * 1000) % 24; long diffDays = diff / (24 * 60 * 60 * 1000); and similarly for months and years. you can also refer the example given on this link for more information http://javarevisited.blogspot.in/2012/12/how-to-convert-millisecond-to-date-in-java-example.html

http://stackoverflow.com/a/23019118
score: 0
has body: It would be a better style to use different variables for each part (city, postal and zip code). Otherwise you might Change the order of the elements, take postal into the middle and than do String city = Location.split("[0-9]")[0]; Define a token that the users inputs to seperate the data (e.g. #) and than do String city = Location.split(#`)[0];
has comment: http://stackoverflow.com/comment/35163242
type: Answer
answers question: http://stackoverflow.com/q/23019070
has comment: http://stackoverflow.com/comment/35163282

http://stackoverflow.com/q/23079603
answer count: 2
has title: Mapping of generic classes in Hibernate
has body: I have following classes in a Java Hibernate project: @Entitiy @Inheritance(strategy = InheritanceType.SINGLE_TABLE) public class ClassA&lt;T extends ClassB&gt;{ @OneToOne @JoinColumn(name = "mycolumn_id") private T instance; [...] } @Entitiy @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public abstract class ClassB{ @Id @GeneratedValue(strategy = GenerationType.TABLE) private Integer id; [...] } When I try to create/save an instance of ClassA (with an instance of a class which inherits ClassB) I get the following exception: org.hibernate.AnnotationException: Property ClassA.instance has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type I can't set an explicit target to "T instance" in ClassA because ClassB is abstract and the literal "T.class" is not valid. However the generic usage is necessary because I have to save many different types of ClassB in ClassA. How can I solve this problem?
downvote count: 0
has answer: http://stackoverflow.com/a/30376046
has comment: http://stackoverflow.com/comment/35272951
has comment: http://stackoverflow.com/comment/35288945
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/30392449
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35275301
score: 3
has comment: http://stackoverflow.com/comment/35274823
upvote count: 3
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/q/23105861
has body: I've created a server program which, when it receives some commands, executes some actions. I'd like when it receives the command "android" (which happens when a client connects from an android device) that my server launches a shell script and when the client disconnects I'd like it to stop the execution of this script. Also, when a web browser clients connects and send the command "browser" the server would launch an other script. Those two scripts can't be used at the same time because they use the same resources. That's why I need to stop them when a client disconnects (I'm aware that I can't have the two types of clients connected at the same time). For now, I've been able to launch the scripts, but not to stop them. Here is the code of my run method in the server : @Override public void run() { try { BufferedReader ins = new BufferedReader(new InputStreamReader(soc.getInputStream())); Runtime r = Runtime.getRuntime(); Process p = null; int i = 0; while (i &lt; 1) { String request = ins.readLine(); if (request == null || request.equals("close")) { p.destroy(); System.out.println("The child was destroyed? "+p.exitValue()); i++; } else { if (request.equals("android")) { p = r.exec("sh /home/pi/test-raspicamsrc.sh &amp;"); } else if (request.equals("browser")) { p = r.exec("sh /home/pi/test-http-launch.sh &amp;"); } else if (request.equals("left")) { serialPort.writeBytes("4".getBytes());//Write data to port } else if (request.equals("right")) { serialPort.writeBytes("6".getBytes()); } else if (request.equals("stop")) { serialPort.writeBytes("5".getBytes()); } else if (request.equals("forward")) { serialPort.writeBytes("8".getBytes()); } else if (request.equals("backward")) { serialPort.writeBytes("2".getBytes()); } else { System.out.println("Unknown command"); } } } ins.close(); soc.close(); // We always stop the car in the end. serialPort.writeBytes("5".getBytes()); } The first time I disconnect an android device, the output of p.exitValue() is 143, and the scri…
type: Question
linked to: http://stackoverflow.com/q/1410741
answer count: 2
possible better answer: http://stackoverflow.com/a/23106413
downvote count: 0
linked to: http://stackoverflow.com/q/2471657
has answer: http://stackoverflow.com/a/23106413
tagged with: linux
has answer: http://stackoverflow.com/a/23130426
tagged with: shell
favorite count: 0
tagged with: process
upvote count: 1
has title: Java how to stop shell script launched previously in the program
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23130426
score: 1
tagged with: java

http://stackoverflow.com/q/23097086
has title: Invisible Stage/Scene in JavaFX
upvote count: 3
has comment: http://stackoverflow.com/comment/35313114
downvote count: 0
has body: I'm looking for a way to hide a JavaFX Stage or Scene. Now I know about .hide(), but that won't work. I need something that still keeps the window, but just makes it completely transparent. A good analogy is display: none and visibility: hidden in CSS. Whereas the first completely and totally removes a tag/node from the screen, the second just makes it invisible. I'd like something like visibility in JavaFX, not display (which is the hide and show methods). It also might help that my stage decoration is set to TRANSPARENT. That should make things a little easier. I've already tried moving the stage off the screen, but that makes the whole program do some unexpected things. It throws a lot of errors that it clearly shouldn't. One more thing: If it's possible, I'd like to be able to move/interact with the window, even though you can't see it. If this is too hard, that's okay. Its not really necessary.
tagged with: java
tagged with: javafx
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23113829
score: 3
has comment: http://stackoverflow.com/comment/35328939
tagged with: scene
has comment: http://stackoverflow.com/comment/61324788
has answer: http://stackoverflow.com/a/23113829
tagged with: visibility
has comment: http://stackoverflow.com/comment/61324775
has comment: http://stackoverflow.com/comment/61324535
answer count: 1
favorite count: 0

http://stackoverflow.com/q/23000708
has answer: http://stackoverflow.com/a/23000903
linked to: http://stackoverflow.com/q/22732835
has body: I have a program ready that acts as a client and another that acts as a server. I want to be able to send a message to the server, and the server will then forward the message to another client that is also connected to the server. So the the server is supposed to forward the message to the other client. How would i be able to do that, and what do I need to read up on? This is what i got now. Server.java package server; import java.net.*; import java.io.*; import javax.swing.*; public class Server{ public static void run() { ServerSocket serverSocket = null; Socket socket = null; try{ while(true){ serverSocket = new ServerSocket(5555); socket = serverSocket.accept(); InputStreamReader streamReader = new InputStreamReader(socket.getInputStream()); BufferedReader bufferedReader = new BufferedReader(streamReader); String message = bufferedReader.readLine(); System.out.println(message); if(message != null){ PrintStream printStream = new PrintStream(socket.getOutputStream()); printStream.println("Message receivd!"); } streamReader.close(); socket.close(); serverSocket.close(); bufferedReader.close(); } }catch(Exception e){} // try{ // // }catch(Exception e){} } public static void main(String[]args){ Server s = new Server(); s.run(); } } And then I also got TCPClient.java package client; import java.net.*; import java.io.*; public class TCPClient { private String serverIP = "localhost"; private int serverPort = 1111; private int count = 0; private Thread thread; public TCPClient() { this.thread = new Thread(new ConnectAndListenToServer()); // thread.start(); } public void sendMessage(int count){ this.count = count; this.thread = new Thread(new ConnectAndListenToServer()); thread.start(); } private class ConnectAndListenToServer implements Runnable { Socket socket = null; public void run() { BufferedReader bufferedReader = null; InputStreamReader streamReader = null; try { socket = new Socket(serverIP,serverPort); PrintStream printStream = new PrintStream(socket.getOutputS…
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23042582
accepted answer: http://stackoverflow.com/a/23042582
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35129817
type: Question
tagged with: client-server
answer count: 2
upvote count: 1
has title: MultiClient server - Java
favorite count: 0
possible better answer: http://stackoverflow.com/a/23000903
tagged with: sockets

http://stackoverflow.com/comment/35316139
type: QuestionComment
has text: They might have meant protected? Or it's just a mistake. When you have a lot of information, a few mistakes are bound to slip through.
comment on: http://stackoverflow.com/q/23098385
score: 0
type: Comment

http://stackoverflow.com/a/23119653
has body: You're casting your array length to a UINT16. Any size larger than 65,535 bytes is going to cause you trouble. 460800 % 65536 is, not surprisingly, 2048.
accepted answer of: http://stackoverflow.com/q/23119603
answers question: http://stackoverflow.com/q/23119603
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/comment/35285651
score: 0
has text: I forgot to mention that `type` would be unused in the concrete implementation.
comment on: http://stackoverflow.com/q/23086931
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35361636
comment on: http://stackoverflow.com/a/23129658
type: Comment
has text: and check your firewall status too
score: 0
type: AnswerComment

google-analytics
tags question: http://stackoverflow.com/q/23008253
tag name: google-analytics
type: Tag

http://stackoverflow.com/q/23019260
tagged with: java
has title: Java reference variable management?
has body: I want to understand the exact management of reference variables in Java. How memory is management for them? How much memory itself a reference variable takes say of 32 bit or 64 bit operating system. What about two of following code? Which would be better based on above questions Creating reference variable one and assigning it to new objects (Flyweight pattern I guess ??). StringBuilder strReference = null; for(int i = 0;i &lt; 1000000; i ++) { strReference = // assiging some object from somewhere say from DB list // doing some operation on object with strReference } NowCreating the Reference variable everytime in the for(int i = 0;i &lt; 1000000; i ++) { StringBuilder strReference = // assiging some object from somewhere say from DB list // doing some operation on object with strReference } Can I see the exact effect of above two code statements by profiler ?
type: Question
has comment: http://stackoverflow.com/comment/35163631
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/35163835
tagged with: java-ee-6
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/23019414
favorite count: 0
has comment: http://stackoverflow.com/comment/35163750
has answer: http://stackoverflow.com/a/23019414
tagged with: reference
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35163554

http://stackoverflow.com/comment/35179823
type: Comment
has text: Does the Toast appear?
type: AnswerComment
comment on: http://stackoverflow.com/a/23020897
score: 0

http://stackoverflow.com/q/23096595
type: Question
has body: I have created the code that returns me the full address of my current location but I want it to just return certain aspects of my current position e.g. just the postcode, just the county etc. //Place your latitude and longitude List&lt;Address&gt; addresses = geocoder.getFromLocation(lati,longi, 1); if(addresses != null) { Address fetchedAddress = addresses.get(0); StringBuilder strAddress = new StringBuilder(); for(int i=0; i&lt;fetchedAddress.getMaxAddressLineIndex(); i++) { strAddress.append(fetchedAddress.getAddressLine(i)).append("\n"); } String Address= strAddress.toString(); Toast.makeText(getApplicationContext(),Address, Toast.LENGTH_LONG).show(); That is the code I have so far so it would be greatly appreciated if someone could point me in the direction to a tutorial or even give me help with this issue
downvote count: 0
tagged with: android
answer count: 1
score: 1
has answer: http://stackoverflow.com/a/23096797
favorite count: 0
accepted answer: http://stackoverflow.com/a/23096797
type: AnsweredQuestion
has title: reverse geocoding coordinates to address
tagged with: java
tagged with: reverse-geocoding
upvote count: 1

http://stackoverflow.com/comment/35317201
score: 0
comment on: http://stackoverflow.com/q/23093451
type: Comment
has text: found one reference: http://stackoverflow.com/questions/9234297/filtering-on-a-jtree
type: QuestionComment

http://stackoverflow.com/a/31824901
type: Answer
accepted answer of: http://stackoverflow.com/q/23110771
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23110771
has comment: http://stackoverflow.com/comment/94855349
has body: try to use this: static Context = mConext; i think this works.
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/51596342

http://stackoverflow.com/q/23079197
has answer: http://stackoverflow.com/a/23079286
has answer: http://stackoverflow.com/a/23079313
has comment: http://stackoverflow.com/comment/35272059
type: AnsweredQuestion
has title: Extract host name/domain name from URL string
has answer: http://stackoverflow.com/a/23079936
tagged with: java
upvote count: 11
type: Question
has answer: http://stackoverflow.com/a/23079360
has answer: http://stackoverflow.com/a/50688130
answer count: 7
tagged with: url
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/58945154
has answer: http://stackoverflow.com/a/23079402
accepted answer: http://stackoverflow.com/a/23079402
downvote count: 0
has comment: http://stackoverflow.com/comment/35309469
possible better answer: http://stackoverflow.com/a/23079313
score: 11
has body: I have a URL like http://hostname:port_no/control/login.jsp. I have the above url stored in some String.Now, I need to extract hostname from the String. I am doing like this in my Java code String domain = url.substring(url.indexOf('/') + 2, url.lastIndexOf(':')); I want to know if there is any better way to do the same.

http://stackoverflow.com/a/74241202
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/23019482
score: -1
upvote count: 0
has body: I came across this same challenge while working through "Core Java for the Impatient" by Cay S. Horstmann (Excellent read btw). https://horstmann.com/javaimpatient/ First, obtain a Field object using the reflective getField method. Field f = System.class.getField("out") Now obtain a Method object from the underlying value of the Field object. In this case, it is the static field out of the System class. You are able to pass in null as the argument due to it being a static field. Method m = f.get(null).getClass().getMethod("println", String.class); Finally, invoke the method using the underlying value of the Field object. m.invoke(f.get(null), "Hello, World");

http://stackoverflow.com/q/23098301
score: 0
has comment: http://stackoverflow.com/comment/35306790
answer count: 3
has comment: http://stackoverflow.com/comment/35306776
favorite count: 0
has comment: http://stackoverflow.com/comment/35307094
has comment: http://stackoverflow.com/comment/35306804
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35307009
upvote count: 1
has title: Comparing Two ArrayLists for common items and deleting those items from one of those ArrayList
has body: I have two arrayLists. One of them lists all of the presidents born in a state(List A). The second lists all of the presidents ever(List B). I have to compare the two and print out a list of presidents who were not born in any of our current states. Basically, they would not be in List A. So I have to find all names in common between the lists and delete them from list B. How do I go about doing this? import java.util.*; import java.io.*; // NO CMD ARGS - ALL FILENAMES MUST BE HARDOCDED AS I HAVE DONE FOR YOU HERE public class Potus { public static void main( String[] args ) throws Exception { BufferedReader infile1 = new BufferedReader( new FileReader("state2Presidents.txt") ); BufferedReader infile2 = new BufferedReader( new FileReader("allPresidents.txt") ); //BufferedReader infile3 = new BufferedReader( new FileReader("allStates.txt") ); HashMap&lt;String,ArrayList&lt;String&gt;&gt; Map = new HashMap&lt;String,ArrayList&lt;String&gt;&gt;(); HashMap&lt;String,String&gt; Maping = new HashMap&lt;String,String&gt;(); ArrayList&lt;String&gt; inverting = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; presState = new ArrayList&lt;String&gt;(); String state; while ((infile1.ready())) { ArrayList&lt;String&gt; president = new ArrayList&lt;String&gt;(); state = infile1.readLine(); String [] states = state.split(" "); for(int i=1; i&lt;states.length; i++) { president.add(states[i]); inverting.add(states[i]); Maping.put(states[i],states[0]); } Map.put(states[0], president); presState.add(states[0]); } Collections.sort(presState); Collections.sort(inverting); System.out.println( "The following states had these presidents born in them:\n"); // DO NOT REMOVE OR MODIFY for(int i=0; i&lt;presState.size(); i++) { System.out.print(presState.get(i)); ArrayList&lt;String&gt; value = Map.get(presState.get(i)); for (int j=0; j&lt; value.size() ; j++) { System.out.print(" "+value.get(j)); } System.out.println(); } System.out.println( "\nList of presidents and the state each was…
tagged with: java
has answer: http://stackoverflow.com/a/23098335
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23098366
has answer: http://stackoverflow.com/a/23098423
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35307168

http://stackoverflow.com/q/23056122
score: 0
has body: In ant task in ant, we have a property named 'Dir' where i can specify the base directory to be used in the called target. I am looking for something similar in 'ant callback' task. How can i set the directory in ant callback
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23056503
tagged with: ant
tagged with: java
has comment: http://stackoverflow.com/comment/35230930
type: Question
has title: How to set directory in antcallbacktask?
answer count: 1

http://stackoverflow.com/comment/49517596
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22989501
has text: @sakura the "once constructed" condition covers that case.

http://stackoverflow.com/comment/35344966
score: 0
type: Comment
has text: There are some (rather arcane) words in the JVM spec about removing references that might otherwise lead to exceptions. I can't cite chapter and verse, though, and, on reflection, I think there may be a weasleword "out" for this scenario.
comment on: http://stackoverflow.com/a/23119827
type: AnswerComment

http://stackoverflow.com/comment/35184434
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23029350
has text: here `if (!myStrisEmpty())` you miss a DOT: `if (!myStr.isEmpty())`. Also make sure you have an EditText whiuch has an `android:id="@+id/editText"` in your layout (mind the **+** sign).

http://stackoverflow.com/comment/35161448
has text: Since your only condition for the last 2 dialogs is whether the money is adequate or not, in you ` get_user_id_money` task, you can do the the check (if/else statement) in the PostExecute. you should have the money value for the if.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23017443
type: AnswerComment

http://stackoverflow.com/comment/35160657
has text: Where is your Button and and how you want to show it ? I mean you want to show it in a listview or what ?
comment on: http://stackoverflow.com/q/23017631
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22990163
score: -1
has body: There are a lot of answers suggesting HashMaps. I really don't like them, because you have to iterate through them once again anyway. Rather, I would sort the List Collections.sort(list); and then loop through it. Something similar to String prev = null, mostCommon=null; int num = 0, max = 0; for (String str:list) { if (str.equals(prev)) { num++; } else { if (num&gt;max) { max = num; mostCommon = str; } num = 1; prev = str; } } should do it.
has comment: http://stackoverflow.com/comment/59866156
type: Answer
has comment: http://stackoverflow.com/comment/71007548
downvote count: 1
upvote count: 0
answers question: http://stackoverflow.com/q/22989806

http://stackoverflow.com/comment/35398943
has text: @Praven I used [this code](http://stackoverflow.com/questions/14576710/ping-application-in-android/) to ping and there is 100% packet loss. What is going wrong?
comment on: http://stackoverflow.com/a/23132091
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35085895
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22972599
has text: I really hope this hammers home the point that you should create your UI via `JPanel` (although I still have yet to here an argument for why you should extend `JPanel` over `JComponent`). Then if you want an application you create a `JFrame` and set its content pane to your panel or, if you want to create an applet, extend `JApplet` and set _its_ content pane to your panel.

http://stackoverflow.com/a/23016692
has body: You have to create the 2 panels A and B and add them to another panel C. Then you add C to your frame. A bit better explained: This is what you have now: JPanel lights = new LinearLightsPanel(nButtons); myFrame.add(lights); But you would like something like: JPanel lightsA = new LinearLightsPanel(nButtonsA); JPanel lightsB = new LinearLightsPanel(nButtonsB); JPanel lightsC = new JPanel(); lightsC.add(lightsA); lightsC.add(lightsB); myFrame.add(lightsC);
type: Answer
answers question: http://stackoverflow.com/q/23016525
score: 0

http://stackoverflow.com/comment/35106673
comment on: http://stackoverflow.com/q/22987062
score: 0
has text: By the way. If your device generally is slow in finding GPS and it is running CyangenMod or otherwise rooted, then it might be using the wrong region server for AGPS. To fix this you can download FasterFix from Google Play. I am running CyanogenMod, live in Europe and it was using the server in North America which made it painfully slow at finding GPS signal.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23153331
accepted answer of: http://stackoverflow.com/q/23043117
type: Answer
answers question: http://stackoverflow.com/q/23043117
score: 0
has body: Atlast, i can able to access from cloud datastore from appengine application, following are my answer, Ans For Ques 1: Cloud Datstore doesn't require compute engine instance. Ans for Ques 2: To access cloud datastore, you need either service account credentials or u must have access token for authenticated user with Scopes set to Datastore, and user email. Use Google api Client library,or simply use ProtoBuf library provided in documentation. Ans for Ques 3: simply use create credentials from application u want to access and use it in other applications https://developers.google.com/datastore/docs/getstarted/overview Thanks!
type: AcceptedAnswer

http://stackoverflow.com/q/23009891
favorite count: 0
has answer: http://stackoverflow.com/a/23009963
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/23009963
has comment: http://stackoverflow.com/comment/35145680
has body: I noticed that inside my class that extends View, to get the screen size I have to use getContext DisplayMetrics dispM = getContext.getResources().getDisplayMetrics(); int width = dispM.WidthPixels; int height = dispM.HeightPixels; if I wanted to do the same inside my Activity, I have to replace getContext with getBaseContext. Why is this the case?
tagged with: java
has answer: http://stackoverflow.com/a/23010008
answer count: 3
upvote count: 7
linked to: http://stackoverflow.com/q/5853082
possible better answer: http://stackoverflow.com/a/23010008
linked to: http://stackoverflow.com/q/1026973
has answer: http://stackoverflow.com/a/23009985
duplicate of: http://stackoverflow.com/q/5853082
duplicate of: http://stackoverflow.com/q/1026973
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/22966601
downvote count: 0
has comment: http://stackoverflow.com/comment/35145714
linked to: http://stackoverflow.com/q/10641144
has title: getBaseContext or getContext? How do they differ?
score: 7

http://stackoverflow.com/a/23101856
has body: If you are sure that the cycle can not end normally, you can just replace the cycle condition with the plain while( true ) without changing the code semantics. In general, if you are sure that something will not happen, throw an AssertionError at that point with the message explaining the "impossible condition". In your case it could be something like throw new AssertionError("not reachable"); AssertionError is better suited to mark "impossible" conditions, while IllegalStateException is the proper exception for situations when the system state does not allow to perform some otherwise valid operation.
upvote count: 1
has comment: http://stackoverflow.com/comment/35312439
answers question: http://stackoverflow.com/q/23101700
type: Answer
has comment: http://stackoverflow.com/comment/35312673
downvote count: 0
score: 1

http://stackoverflow.com/comment/35388906
score: 0
type: AnswerComment
type: Comment
has text: But the question is asked in each case statement, so the input would happen before the question is made
comment on: http://stackoverflow.com/a/23098248

http://stackoverflow.com/comment/35152141
type: Comment
comment on: http://stackoverflow.com/a/22999531
type: AnswerComment
score: 0
has text: That is correct. The second method matches the highest priority MIME type in the request header (text/html).

http://stackoverflow.com/a/23004424
answers question: http://stackoverflow.com/q/23002058
score: 1
has body: It's just a DEBUG message, nothing to worry about - basically each Result in Struts must provide DEFAULT_PARAM definition, at least it can be null.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/23030717
has comment: http://stackoverflow.com/comment/90334980
type: Answer
score: 2
has body: Does such a cast incur a performance overhead, versus the alternative of including this method into the interface and calling that method directly without the cast? In this case, yes, because the object mightn't be a Car, so Java has to do a runtime check, which is how ClassCastExceptions can get thrown. JVM Specification #2.6.8. If you have to do this kind of thing you're usually doing something wrong at the design phase. I would reconsider your object model.
downvote count: 0
answers question: http://stackoverflow.com/q/23029681
upvote count: 2

http://stackoverflow.com/a/23047335
downvote count: 0
has body: Yes, but you'd want while(yn), not while(true), which goes on forever. The break only breaks from the switch statement. Alright, try this: import java.util.Scanner; public static void main(String args[]){ Scanner s = new Scanner(System.in); boolean checking = true, valid = true; String[] names = new String[50]; int i = 0; while(checking){ System.out.println("Enter name..."); me = s.nextLine(); System.out.println("You entered " + me + "."); while(valid){ System.out.println("Enter another? y/n"); you = s.nextLine(); if(you.equals("n")){ valid = false; checking = false; }else if you.equals("y")){ names[i] = you; i++; valid = false; }else{ System.out.println("Sorry, try again (y/n)..."); } } } }
has comment: http://stackoverflow.com/comment/35214287
answers question: http://stackoverflow.com/q/23047309
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/35345339
type: Comment
comment on: http://stackoverflow.com/q/23119788
type: QuestionComment
score: 0
has text: It is something like: "subject#semester#grade@subject#semester#grade@.... and so on. I need an array[number of records][3] where i have info about: subject | semester | grade

http://stackoverflow.com/comment/35259656
has text: Sadly it isn't. It takes much longer. The method took almost 100ms more than the loop =/
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23072081
type: Comment

http://stackoverflow.com/q/22983408
possible better answer: http://stackoverflow.com/a/22983480
has body: While Porting a Game I come to a below statement Object o = new Object[]{"A","B"}; It's really weird! But when I try the same with "String" then compiler report me an Error msg String s = new String[] {"A", "B", "C"}; Error: Type mismatch: cannot convert from String[] to String Can you please reveal the Mystery of it ?
has answer: http://stackoverflow.com/a/22983474
answer count: 5
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/22983471
downvote count: 1
accepted answer: http://stackoverflow.com/a/22983474
type: Question
has title: Java Object class MYSTERY
upvote count: 4
tagged with: object
tagged with: class
has answer: http://stackoverflow.com/a/22983480
has answer: http://stackoverflow.com/a/22983449
has answer: http://stackoverflow.com/a/22983535
favorite count: 0

http://stackoverflow.com/q/23042246
linked to: http://stackoverflow.com/q/14749960
accepted answer: http://stackoverflow.com/a/23042331
tagged with: double
duplicate of: http://stackoverflow.com/q/14749960
has comment: http://stackoverflow.com/comment/35204497
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23042352
has title: float to double giving Strange results
has answer: http://stackoverflow.com/a/23042352
type: Question
has comment: http://stackoverflow.com/comment/35204482
has body: I came across with this behavior of float and double during type casting. I modified my actual statements to better understanding. 1 System.out.println((double)((float)(128.12301)));//Output:128.12301635712188 Same output all the time. 2 System.out.println((double)((float)(128888.12301)));//Output:128888.125 Both outputs are strange for me I can't understand how it's working. Can anyone help me out?
has answer: http://stackoverflow.com/a/23042331
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23042298

http://stackoverflow.com/comment/36018460
comment on: http://stackoverflow.com/a/23387314
score: 0
type: AnswerComment
has text: Okay. Makes sense. In my own tests, the AES flags doesn't seem to be honored. No matter I enable or disable the flags, the execution times are the same. So, if we need the actual difference introduced by CPU support, we might need identical CPUs - one with disabled AES-NI and another enabled. One guy here has some interesting results (not java), with kernel disabling AES-NI : https://ask.fedoraproject.org/en/question/29298/how-can-i-verify-that-my-luks-will-utilize-aes-ni-encryption-support-in-my-system/ His results are very close to yours (7x in many cases)
type: Comment

http://stackoverflow.com/comment/35230327
type: Comment
score: 0
has text: Thanks guys. I managed to fix the code and what you were saying now makes sense. The lines of code that fixed it for me were. this.top=new Ellipse(); etc.. I now know I was creating a local variable top that could now be seen outside that method.
type: AnswerComment
comment on: http://stackoverflow.com/a/23019938

http://stackoverflow.com/comment/35259175
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23054989
type: Comment
has text: I think what you are trying to do is start a jvm and your class file from an native program. This has nothing to do with injecting any code. You need to first create a C executable that leverages JNI to start a JVM. There are lots of examples out there to do that. see: http://www.inonit.com/cygwin/jni/invocationApi/c.html

http://stackoverflow.com/a/23049774
has comment: http://stackoverflow.com/comment/35218892
accepted answer of: http://stackoverflow.com/q/23049759
has body: You already create a variable: public Button butHOURS; Then, you should use this variable as follows: butHOURS = (Button) findViewById(R.id.butHOURS); You variable is useless in your code. However, the real problem is (as you can see in your LogCat): have you declared this activity in your AndroidManifest.xml? You should declare Main3 Activity inside your Manifest as follows: <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> // other activities Every Activity in your app needs to be declared in your Manifest file as above.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23049759
has comment: http://stackoverflow.com/comment/35218884
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35218937
has comment: http://stackoverflow.com/comment/35218919

actor
tags question: http://stackoverflow.com/q/23046501
type: Tag
tags question: http://stackoverflow.com/q/23073650
tag name: actor
tags question: http://stackoverflow.com/q/23023059

http://stackoverflow.com/comment/35267044
has text: I thought this was a feature specific to IE, as it is more tightly integrated into the Windows filesystem.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23076169
type: QuestionComment

http://stackoverflow.com/q/23061363
accepted answer: http://stackoverflow.com/a/23061673
type: Question
linked to: http://stackoverflow.com/q/2591083
has title: Is it ok to use javax.lang.model.SourceVersion to determine the JRE version?
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23061673
has body: Is it ok to use javax.lang.model.SourceVersion to determine the JRE version? If it is, which one is preffered? int version = SourceVersion.latest().ordinal(); // or int version = SourceVersion.latestSupported().ordinal(); Bonus points to whomever explains when SourceVersion#latest() and SourceVersion#LatestSupported() can differ. PS. I am aware of Getting Java version at runtime
possible better answer: http://stackoverflow.com/a/23062928
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23062928

http://stackoverflow.com/comment/35215235
score: 0
has text: operations are not related with subclasses., so it is not the best solutions.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23033916

http://stackoverflow.com/q/23117861
score: 2
downvote count: 0
tagged with: client
favorite count: 0
type: Question
answer count: 2
tagged with: sockets
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35340951
has comment: http://stackoverflow.com/comment/35341923
has title: Multithreaded Client/Server application java issue
upvote count: 2
has answer: http://stackoverflow.com/a/23118260
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23118155
tagged with: chat
has body: This is my first post, so correct me if I am doing something wrong. I am trying to make a multithreaded client/server application. I have no problem making a basic 1 to 1 client/server application without threading, but I want every client to talk individually to the server and each client only to recieve the messages that belongs to the particular client in the console. This is where I can't make it work. I have looked at some tutorials online and I tried to debug in Eclipse without any luck. What I want the application to do: If I run the server and 2 clients I want to be able to write a message on a client and make the server return the message and the message number without skipping a number. Client 1 : Message no: 0. You said: Hello! Message no: 1. You said: Whats up! Client 2 : Message no: 0. You said: Hey Server! Message no: 1. You said: What are you doing now? It works with the first Client that I run and perfectly increment the messagenumber, but when I create the second one it freezes, so I guess my problem is either with the socket declaration or with the way I am threading. (Maybe a socket.close() is missing somewhere?) I know there is some other flaws with the application, but keep in mind that it is just a school assignment for working with threads. Thanks in advance if someone is willing to help. :) Server Code: public class Server extends Thread { DataInputStream in; DataOutputStream out; ServerSocket listener; public Server() throws IOException { try { while (true) { listener = new ServerSocket(9090); Socket socket = listener.accept(); System.out.println("Test"); ThreadServer ts = new ThreadServer(socket); Thread t1 = new Thread(ts); t1.start(); } } finally { listener.close(); } } public static void main(String[] args) throws IOException { new Server(); } } Client code: public class Client extends JFrame { DataOutputStream dos; BufferedReader input; String answer = null; String textString; Socket s = new Socket("localhost", 9090); public Client() th…

http://stackoverflow.com/comment/35561624
has text: Hi ajb, using `"\035"` worked for me. Thanks a lot.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23114092

http://stackoverflow.com/comment/35236102
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23057920
has text: <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> same thing working in tomcat and not working in webshpere. webshpere Version 8, Apache Tomcat Version 6.0.29
score: 0

http://stackoverflow.com/comment/35194338
comment on: http://stackoverflow.com/a/23034845
type: AnswerComment
score: 0
type: Comment
has text: What is your expected output?

http://stackoverflow.com/comment/35323753
has text: It works for me in the [ea release](https://jdk8.java.net/download.html). But I think a line chart is a better option anyway.
score: 0
comment on: http://stackoverflow.com/q/23074752
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35366035
comment on: http://stackoverflow.com/a/23129068
score: 1
type: AnswerComment
type: Comment
has text: Thanks for removing my confusion.After reading your answer I can say it is right approach in my case.

http://stackoverflow.com/comment/35334640
score: 0
has text: @user3541797 But are yuo trying to use the DAO in a Servlet Filter? If so...it's normal you have a nullpointerexception; ServletFilter is outside the spring framework control
comment on: http://stackoverflow.com/q/23114050
type: Comment
type: QuestionComment

http://stackoverflow.com/a/71969132
upvote count: 2
has body: If you need to provide your own certificate, you can pass it like this: Manifest: <application android:networkSecurityConfig="@xml/network_security_config" ... > res/xml/network_security_config.xml: <?xml version="1.0" encoding="UTF-8" ?> <network-security-config> <certificates src="@raw/your_PEM_formatted_cert" /> <certificates src="user" /> <certificates src="system" />
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/138146718
answers question: http://stackoverflow.com/q/23103174
downvote count: 0

http://stackoverflow.com/comment/35190413
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23033074
has text: Works in Microsoft SQL, Oracle Database, DB2, Teradata, EXASOL and MS SQL. See: http://en.wikipedia.org/wiki/Upsert . I have personally used it in MSSQL.
type: Comment

http://stackoverflow.com/comment/35195588
comment on: http://stackoverflow.com/q/23036937
type: QuestionComment
type: Comment
score: 1
has text: Then look at the bounds (and off-by-one errors). E.g. `index > 1` (esp. in buildHeap) looks suspicious - should it be `>= 1` or `> 0`?

http://stackoverflow.com/comment/35338630
comment on: http://stackoverflow.com/a/23100285
type: AnswerComment
score: 0
type: Comment
has text: This is windows, and I have a .dll. This has worked fine for years, but only fails on a subset of new users. And the loadLibrary works, but the native methods just dont seem to connect.

http://stackoverflow.com/comment/35160202
comment on: http://stackoverflow.com/q/23017529
has text: programmers.stackexchange.com is more suitable for this question.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/35359187
score: 0
type: AnswerComment
has text: Thanks It helped now It doesnt want to log in i have tryed to return the vaues coming from the feilds with System.out.println(password);System.out.println(id); and it retuns a empty line
type: Comment
comment on: http://stackoverflow.com/a/23103474

http://stackoverflow.com/q/23033157
upvote count: 1
has comment: http://stackoverflow.com/comment/35188740
downvote count: 1
accepted answer: http://stackoverflow.com/a/23033262
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35188912
tagged with: java
type: Question
has body: I have just started learning Java. I was learning about "Randomization" from the "Kilobolt" tutorials. When I ran this code: import java.util.Random; public class Randomization { public static void main (String[] args) { Random rand = new Random(); rand.nextInt(11); System.out.println(rand); } } The console displayed: java.util.Random@1888759 Is this supposed to happen? Or are there errors in my code? ( Sorry if i used any wrong terms in this question, I'm new to the website)
has comment: http://stackoverflow.com/comment/35188833
has answer: http://stackoverflow.com/a/23033402
favorite count: 0
score: 0
has answer: http://stackoverflow.com/a/23033262
has title: Can't print a Random integer
has answer: http://stackoverflow.com/a/23033191
answer count: 4
possible better answer: http://stackoverflow.com/a/23033181
has answer: http://stackoverflow.com/a/23033181
has comment: http://stackoverflow.com/comment/35188767

http://stackoverflow.com/comment/35287283
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/23087795
type: Comment
has text: What do you mean by can't compare? Also what does terminating mean here? Does `getEmails()` return a list of Strings? Does that list contain the String m? I don't see a reason why it shouldn't work since `contains()` is using `equals()`.

http://stackoverflow.com/comment/35316487
score: 0
has text: The table is generated when the tomcat server starts, is there a jpa annotation? GenerationType.auto doesnt work
type: QuestionComment
comment on: http://stackoverflow.com/q/23104274
type: Comment

http://stackoverflow.com/q/23058331
has title: Gwt flex table getRowCount() method not returning current value
tagged with: java
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/23082705
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35236366
has body: I am using a GWTFlexTable and have one issue: I am deleting any row after that when I do try to add new row it is giving rowcount value including removed row because of this while iterating last row giving IndexOutOfBoundsException. for( count=0; count &lt; table.getRowCount(); count++ ) { } Giving this exception [FATAL] Uncaught Exception: [java] java.lang.IndexOutOfBoundsException: [java] Column index: 0, Column size: 0
has answer: http://stackoverflow.com/a/23060180
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35234102
tagged with: flextable
has comment: http://stackoverflow.com/comment/35235133

http://stackoverflow.com/q/23108916
tagged with: solr
has answer: http://stackoverflow.com/a/23110096
accepted answer: http://stackoverflow.com/a/23110096
type: AnsweredQuestion
tagged with: java
tagged with: mysql
type: Question
has title: Does not working less than operator in solr query
has comment: http://stackoverflow.com/comment/35325754
score: 0
has body: I'm using solr4.7 with CoreContainer to create core and EmbeddedSolrServer to connect and ModifiableSolrParams to fetch the data.. I have configured "solrconfig.xml" with requestHelper "import" to import the data and other configuration file for data config as under.... &lt;dataConfig&gt; &lt;dataSource driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/koupon" user="root" password="root" /&gt; &lt;document&gt; &lt;entity name="koupon" query="SELECT k.kouponid as kid, k.name, k.image,k.description,k.discount as discount, k.startdate,k.enddate,k.actualamount, k.discountamount,k.discountamount, c.name as category FROM koupon.koupon k INNER JOIN koupon.category c on c.categoryid = k.categoryid where k.startDate &lt;= NOW() and endDate >= NOW() AND c.isActive=true AND c.isDeleted=false AND k.isActive =true AND lower(k.status)=lower('approved') order by k.kouponid"&gt; &lt;field column="kid" name="kid"/&gt; &lt;field column="name" name="name"/&gt; &lt;field column="image" name="image"/&gt; &lt;field column="description" name="description"/&gt; &lt;field column="startdate" name="startdate"/&gt; &lt;field column="enddate" name="enddate"/&gt; &lt;field column="actualamount" name="actualamount"/&gt; &lt;field column="discountamount" name="discountamount"/&gt; &lt;field column="discount" name="discount"/&gt; &lt;field column="category" name="category"/&gt; &lt;/entity&gt; &lt;/document&gt; &lt;/dataConfig&gt; In this code use "k.startDate &lt;= NOW() and endDate &gt;= NOW()" for fetching in between record but solr query not providing this. I have one solution that's start "To" End but that's not exact solution.. I am very tired for this Issue any know about this? How to solve this ?
tagged with: solrj
answer count: 1
has comment: http://stackoverflow.com/comment/35325229

http://stackoverflow.com/comment/35106641
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22987884
has text: well, okay. He didn't point out the version, so I thought it does not necessarily matter. The point is to get the classname for the cells that are generated and then be able to use the :nth-child selector to color them. I edited my answer anyways.
score: 0

http://stackoverflow.com/comment/35124234
type: AnswerComment
comment on: http://stackoverflow.com/a/22997621
type: Comment
has text: but `T extends P`. What is the issue in it.
score: 0

http://stackoverflow.com/comment/35317861
score: 0
comment on: http://stackoverflow.com/q/23103804
type: Comment
type: QuestionComment
has text: What does the proxy's response say?

http://stackoverflow.com/q/23044710
type: Question
has comment: http://stackoverflow.com/comment/35209910
tagged with: signature
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23045310
accepted answer: http://stackoverflow.com/a/23045310
has body: What does the first &lt;T&gt; mean in the generic method signature: public static &lt;T&gt; void sort(List&lt;T&gt; list, Comparator&lt;? super T&gt; c) And where can I find information that goes in details about generic method signatures?
has answer: http://stackoverflow.com/a/23045134
has title: Tyring to figure out generic method signatures in Collections
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23045134
tagged with: java
tagged with: methods
tagged with: collections

http://stackoverflow.com/comment/35255155
score: 0
comment on: http://stackoverflow.com/q/23069673
type: Comment
type: QuestionComment
has text: What URL are you trying to send your request to?

http://stackoverflow.com/q/23007711
tagged with: primary-key
tagged with: mysql
type: Question
tagged with: java
tagged with: hibernate
score: 0
tagged with: sql
answer count: 1
has answer: http://stackoverflow.com/a/23007850
accepted answer: http://stackoverflow.com/a/23007850
has title: How to define a non generated primary key field in Hibernate
has body: Consider class Person : package model; import java.io.Serializable; import openAPI.modelInterfaces.PersonInterface; /** * * @author X3 * */ public class Person implements PersonInterface , Serializable { private static final long serialVersionUID = 1L; private String m_id = "Missing ID number"; private String m_firstName = "Missing first name";; private String m_lastName = "Missing last name";; private String m_userName = "Missing user name";; private String m_password = "Missing password"; private String m_address = "Missing address"; private String m_status = "Missing status"; /** * * @param _id * @param _firstName * @param _lastName * @param _userName * @param _password * @param _address */ public Person(String _id, String _firstName , String _lastName , String _userName , String _password , String _address , String _status) { this.m_id = _id; this.m_firstName = _firstName; this.m_lastName = _lastName; this.m_userName = _userName; this.m_password = _password; this.m_address = _address; this.m_status = _status; } public Person() {} ////////////////////////// getters ///////////////////////// @Override public String getLastName() { return this.m_lastName; } @Override public String getIdnumber() { return this.m_id; } @Override public String getFirstName() { return this.m_firstName; } @Override public String getUserName() { return this.m_userName; } @Override public String getPassword() { return this.m_password; } @Override public String getAddress() { return this.m_address; } ///////////////////// setters /////////////////////// @Override public void setAddress(String _address) { if (!isMissing(_address)) this.m_address = _address; } @Override public void setLastName(String _lastName) { if (!isMissing(_lastName)) this.m_lastName = _lastName; } @Override public void setPassword(String _password) { if (!isMissing(_password)) this.m_password = _password; } @Override public void setUsername(String _userName) { this.m_userName = _userName; } @Override public void setFirs…
type: AnsweredQuestion

http://stackoverflow.com/q/23005332
has comment: http://stackoverflow.com/comment/35138414
type: UnansweredQuestion
tagged with: sockets
tagged with: android
has body: I'm trying to work on multiple AVD in Android and sending data between them using Sockets. Serverside code-snippet: ServerSocket ss = new ServerSocket(10000); Log.v("ReceiverTask", "Receiver waiting for requests"); connectedSocket = ss.accept(); ObjectInputStream ois = new ObjectInputStream(connectedSocket.getInputStream()); Object obj = ois.readObject(); ois.close(); ss.close(); Client side code: Socket socket = new Socket(InetAddress.getByAddress(new byte[]{10, 0, 2, 2}),njr.sendTo()); BufferedOutputStream bos = new BufferedOutputStream(socket.getOutputStream()); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(njr); Log.d("Client","Object send successfull"); oos.flush(); bos.flush(); oos.reset(); oos.close(); bos.close(); socket.close(); The problem is that The objects that are sent from one AVD (as given by log) is not being received at other AVD. This happens sometimes and not always at a same point. Any hints as to what could be the problem???
has title: Data not being read by ServerSocket
has comment: http://stackoverflow.com/comment/35138155
tagged with: java
has comment: http://stackoverflow.com/comment/35139168
type: Question
has comment: http://stackoverflow.com/comment/35138095
answer count: 2
has comment: http://stackoverflow.com/comment/35139060
score: 0
has comment: http://stackoverflow.com/comment/35137820
has answer: http://stackoverflow.com/a/23005374
has comment: http://stackoverflow.com/comment/35137958
has answer: http://stackoverflow.com/a/23005393

http://stackoverflow.com/comment/65553864
score: 3
comment on: http://stackoverflow.com/a/30520620
type: AnswerComment
has text: I don't understand how changing sdk versions solves this dex problem...
type: Comment

http://stackoverflow.com/a/47195291
has body: &lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd"&gt;
type: Answer
answers question: http://stackoverflow.com/q/22978933
score: 0

http://stackoverflow.com/comment/35245725
type: AnswerComment
has text: Going back to 4.2.10 with BoneCP 0.8 worked. Thanks for the tip!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23031727

http://stackoverflow.com/q/23029991
answer count: 1
downvote count: 0
tagged with: swingx
favorite count: 0
tagged with: jxtable
has body: I have a jXTable that is linked to a MySQL database. I am using the DefaultTableModel. I have it so far that the user can edit the data in the table. I have been trying to add an "Insert New Row" button but was unsuccessful. In the meantime, I thought I could just have an empty row added at the end of the table every time the user updates the table. I was able to get my empty row with the addRow() method, but it isn't editable. Here is my code so far. Any tips on how to get the empty row editable? public void rowSetChanged(RowSetEvent event) { Object[] record; Object[] emptyrow; String [] columnNames=new String [] {"DATE RECEIVED", "INCOME NAME", "DESCRIPTION", "AMOUNT", "FUND ALLOCATION"}; DefaultTableModel dtm=new DefaultTableModel(columnNames,0){ Class[] types = new Class [] { java.sql.Date.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class, java.lang.Float.class, java.lang.String.class}; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } }; try { IncomeUI.frs.beforeFirst(); while (IncomeUI.frs.next()){ record=new Object[]{IncomeUI.frs.getDate("DateReceived"), IncomeUI.frs.getString("IncomeName"), IncomeUI.frs.getString("Description"), IncomeUI.frs.getBigDecimal("Amount"),IncomeUI.frs.getString("FundAllocation")}; dtm.addRow(record); } } catch (SQLException ex) {ex.printStackTrace();} emptyrow = new Object[]{" ", " ", " ", " ", " "}; dtm.addRow(emptyrow); this.setModel(dtm); this.setShowHorizontalLines(false); this.setShowVerticalLines(false); IncomeUI.jScrollPane2.setViewportView(this); //System.out.println(event.toString()); }
type: UnansweredQuestion
score: 1
upvote count: 1
type: Question
tagged with: java
tagged with: mysql
has title: How to Make empty row editable in JXTable
has answer: http://stackoverflow.com/a/23257899

http://stackoverflow.com/q/23091007
has comment: http://stackoverflow.com/comment/35296095
has comment: http://stackoverflow.com/comment/35294118
type: Question
has comment: http://stackoverflow.com/comment/35294236
has comment: http://stackoverflow.com/comment/35293556
has comment: http://stackoverflow.com/comment/35295912
has title: Simple string concat example fast in Java 7, slow in Java 8
score: 3
answer count: 1
has comment: http://stackoverflow.com/comment/35293915
favorite count: 0
has comment: http://stackoverflow.com/comment/35293902
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35293751
upvote count: 6
has comment: http://stackoverflow.com/comment/35293615
has body: I have a little class that demonstrates some timing characteristics of different ways to concatenate strings (StringBuilder vs. plain string contatenation). Irrespective of the relative timings of each strategy, I noticed particular performance behavior with Java 6, and then later Java 7, and now Java 8. I had first written it with Java 6, and I was impressed with the large improvements I saw with Java 7. I had assumed that Java 8 would show similar performance. However, when I run this on my Win7/64-bit laptop, I find that the Java 8 numbers are even slower than my Java 6 numbers. It's entirely possible I'm seeing issues with Java 6 and 7 where the JVM is removing the code I'm testing at runtime (a common obstacle to microbenchmarks), but I just don't know. I'm going to show my perf numbers for the three runs, and then I'll include the source code. Note that the test has a hefty warmup pass, which hopefully should result in all classloading and JIT work finishing before the timing runs. Also note that the relative timings in Java 6 and Java 8 are "consistent". For instance, I expect tests 2 and 3 to be the two fastest, 2 sometimes faster than 3, or vice versa. The Java 7 timings are all much lower than that, and mostly about the same, so it's possible I have an issue with the Java 7 JIT cutting out too much code. Java 6: stringBuilder0:499 stringBuilder1:260 stringBuilder2:262 stringBuilder3:180 stringBuilder4:184 stringBuilder5:210 stringBuilder6:286 stringBuilder7:287 stringBuilder8:203 stringBuilder9:248 Java 7: stringBuilder0:66 stringBuilder1:269 stringBuilder2:57 stringBuilder3:57 stringBuilder4:57 stringBuilder5:57 stringBuilder6:299 stringBuilder7:57 stringBuilder8:57 stringBuilder9:57 Java 8: stringBuilder0:714 stringBuilder1:367 stringBuilder2:368 stringBuilder3:279 stringBuilder4:271 stringBuilder5:318 stringBuilder6:415 stringBuilder7:406 stringBuilder8:308 stringBuilder9:349 Here are the two classes that generate this data. StringBuilderTests: package …
tagged with: performance
has comment: http://stackoverflow.com/comment/35299664
has comment: http://stackoverflow.com/comment/35293379
has answer: http://stackoverflow.com/a/23094349
tagged with: java
downvote count: 3

http://stackoverflow.com/comment/35141450
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23006192
score: 0
has text: (GUI upon the standalone process that can easily be detached) == SystemTray (baloons/messagess) with JPopupMenu,

http://stackoverflow.com/comment/35139072
type: QuestionComment
score: 1
has text: http://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html
comment on: http://stackoverflow.com/q/23006152
type: Comment

http://stackoverflow.com/q/23059184
has title: Accessing Log4j2 logs within an external .jar
answer count: 0
tagged with: reflection
type: UnansweredQuestion
tagged with: java
upvote count: 1
tagged with: log4j2
type: Question
has body: I'm using Java Reflection to run code that's inside a .jar file. However, I should not modify any contents of the file, I have to use the .jar as is. Debugging is tricky (because everything is also obfuscated inside it), so I thought it might be a good idea to have a look at the logger. I could not find any documentation that is directly relevant for this case, and to be honest I'm a little confused whether or not it is possible. Here's the log4j2.xml that is within the .jar's root: <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" /> <PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg%n" /> <RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz"> <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" /> <TimeBasedTriggeringPolicy /> <OnStartupTriggeringPolicy /> </RollingRandomAccessFile> <MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" /> <AppenderRef ref="SysOut"/> <AppenderRef ref="File"/> <AppenderRef ref="ServerGuiConsole"/> I looked around, but there does not seem to be a latest.log file, there is also no console output there. So my question is if getting the log's output is at all possible in any way without altering this xml? Thank you in advance, CX
downvote count: 0
tagged with: jar
score: 1
favorite count: 0

http://stackoverflow.com/a/23054107
has comment: http://stackoverflow.com/comment/35265749
has comment: http://stackoverflow.com/comment/35242352
has body: I think, Decorator pattern is the way to go.. Make Post an Interface. Question and Answer as Abstract Classes which implement Post.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23053958
has comment: http://stackoverflow.com/comment/35266577

http://stackoverflow.com/q/23067408
has body: I'm trying to do an Android app that sends an image automatically without any intervention from the user. I'm using javax.mail jar (and the activation.jar and additional.jar) in order to do so. I'm doing the following Properties props = new Properties(); props.put("mail.smtp.auth", true); props.put("mail.smtp.starttls.enable", true); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.ssl.enable",true); props.put("mail.smtp.port", "465"); Session session = Session.getInstance(props,new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(USER,PASS); } }); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress("*******@gmail.com")); message.setSubject("Email Subject"); message.addRecipient(Message.RecipientType.TO, new InternetAddress("******@gmail.com")); MimeBodyPart messageBodyPart = new MimeBodyPart(); Multipart multipart = new MimeMultipart(); multipart.addBodyPart(messageBodyPart); messageBodyPart = new MimeBodyPart(); messageBodyPart.setContent("&lt;img src=\"image.gif\"/&gt;","text/html"); multipart.addBodyPart(messageBodyPart); messageBodyPart = new MimeBodyPart(); FileDataSource source = new FileDataSource(new File(ruta)); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName("picture.gif"); messageBodyPart.setDisposition("inline"); multipart.addBodyPart(messageBodyPart); message.setContent(multipart); Transport.send(message); When I execute this code, I get the following error W/System.err(24907): javax.mail.MessagingException: IOException while sending message; W/System.err(24907): nested exception is: W/System.err(24907): javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; W/System.err(24907): boundary="----=_Part_0_1095625208.1397499270313" W/System.err(24907): at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1182) W/System.err(24907): at javax.mail.Transport.se…
tagged with: email
accepted answer: http://stackoverflow.com/a/23068444
favorite count: 0
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35251708
possible better answer: http://stackoverflow.com/a/51434030
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/51434030
has answer: http://stackoverflow.com/a/23068444
type: Question
answer count: 2
has title: Exception while sending an email in Java with javax.mail
downvote count: 0
tagged with: jakarta-mail
tagged with: android

http://stackoverflow.com/a/23051452
type: Answer
answers question: http://stackoverflow.com/q/23050583
score: 2
upvote count: 2
has body: You can use a RowFilter/RowSorter. You can read more at Sorting and Filtering from the How to use Tables tutorial. You can can also see a working example in the question posted here. The accepted answer also provides a solution for case-insensitive filtering, if you're interested in that functionality
downvote count: 0

http://stackoverflow.com/q/23083057
type: Question
has comment: http://stackoverflow.com/comment/35278768
accepted answer: http://stackoverflow.com/a/23083266
tagged with: java-2d
upvote count: 2
tagged with: mouselistener
answer count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/35278746
has title: MouseListener on a graphics object
has comment: http://stackoverflow.com/comment/35278747
linked to: http://stackoverflow.com/q/4634107
tagged with: java
possible better answer: http://stackoverflow.com/a/23083798
linked to: http://stackoverflow.com/q/14574045
has answer: http://stackoverflow.com/a/23083266
has comment: http://stackoverflow.com/comment/35278714
has answer: http://stackoverflow.com/a/23083798
tagged with: graphics
score: 2
type: AnsweredQuestion
downvote count: 0
has body: I'm feeling quite stupid. But what is the reason why this simple piece of code doesn't change the ellipse's color? Basically I want to add a mouse listener to the oval - a graphic object. when the mouse cursor is in oval, the oval changes its color. But this code doesn't change at all... This code is for testing only. public class Help extends JFrame{ public static void main(String [] agrs){ Help h = new Help(); h.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); h.add(new Help_Option()); h.setSize(2000, 1000); h.setVisible(true); } } class Help_Option extends JComponent implements MouseListener{ Ellipse2D ellipse = new Ellipse2D.Double(0, 0, 1000, 500); Color c = Color.BLACK; public Help_Option(){ this.addMouseListener(this); } public void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.BLUE); g2d.draw(ellipse); g2d.setColor(c); g2d.fill(ellipse); } public void setColor(Color c){ this.c = c; } @Override public void mouseClicked(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) { if (ellipse.contains(e.getX(), e.getY()) ) { setColor(Color.GREEN); repaint(); } } @Override public void mouseExited(MouseEvent e) { } }
favorite count: 0

http://stackoverflow.com/comment/35274598
score: 0
comment on: http://stackoverflow.com/q/23078747
type: Comment
type: QuestionComment
has text: What happens if you remove the qualifier and/or the unitName?

http://stackoverflow.com/a/22979952
downvote count: 0
has body: Take a moment to have a look at you collision detection statement... if (bullet.intersects(rec)); g.drawString("collision!", 50, 20); The problem is, you've ended your if statement with a ; if (bullet.intersects(rec)); ^--- This means that the statement is effectively ignored, it would be the same as... if (bullet.intersects(rec)) { } g.drawString("collision!", 50, 20); Which would have alerted you to the problem in the first place Instead, try using if (bullet.intersects(rec)) { g.drawString("collision!", 50, 20); } Now, don't call repaint or any method that might call repaint (like setBackground) from any paint method. This will set up a cycle of repeated paint events that will eventually consume your CPU. I don't think you really need 200fps and Thread.sleep of roughly 40 would give you 25fps and would typically be more then adequate for your purposes. You should also consider using key bindings, which will allow you to over come the focus related issues of KeyListener. I'd also encourage you to explore the use of a Swing Timer which will reduce the possibility of un-synchorised updates between the model and the view, which could cause random and difficult to solve artificates or other issues... Shooting Problems There's a bunch of logic issues and mis-use of variables... To start with... Remove bx and by, you don't need them. You actually don't really need x and y either, but that might be come a little more apparent as we go... Don't create bullet in paintComponent, this is causing some confusion... You may not need the keyReleased check of VK_SPACE but if you did, you should set shot to false and bullet to null... Setting readyToFire to true right before you check to see if it's true seems weird...however, when you detect a VK_SPACE in keyPressed check to see if bullet is null or not, if it's not, then a bullet already exist, don't know if this is an issue, but if you were to use a List, you could have multiple bullets firing at the same time...any way, create…
has comment: http://stackoverflow.com/comment/35092075
has comment: http://stackoverflow.com/comment/35094586
has comment: http://stackoverflow.com/comment/35092138
type: Answer
has comment: http://stackoverflow.com/comment/35092255
score: 2
accepted answer of: http://stackoverflow.com/q/22979862
upvote count: 2
answers question: http://stackoverflow.com/q/22979862
has comment: http://stackoverflow.com/comment/35092333
type: AcceptedAnswer

http://stackoverflow.com/a/23071080
accepted answer of: http://stackoverflow.com/q/23070298
has comment: http://stackoverflow.com/comment/64980583
downvote count: 1
has comment: http://stackoverflow.com/comment/99605125
answers question: http://stackoverflow.com/q/23070298
has comment: http://stackoverflow.com/comment/37051927
has comment: http://stackoverflow.com/comment/37051974
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/48630179
has comment: http://stackoverflow.com/comment/35594701
has comment: http://stackoverflow.com/comment/35257995
has comment: http://stackoverflow.com/comment/50191839
has comment: http://stackoverflow.com/comment/35257955
has comment: http://stackoverflow.com/comment/36743033
score: 171
type: Answer
has body: You would write a custom deserializer that returns the embedded object. Let's say your JSON is: { "status":"OK", "reason":"some reason", "content" : { "foo": 123, "bar": "some value" } } You'd then have a Content POJO: class Content { public int foo; public String bar; } Then you write a deserializer: class MyDeserializer implements JsonDeserializer&lt;Content&gt; { @Override public Content deserialize(JsonElement je, Type type, JsonDeserializationContext jdc) throws JsonParseException { // Get the "content" element from the parsed JSON JsonElement content = je.getAsJsonObject().get("content"); // Deserialize it. You use a new instance of Gson to avoid infinite recursion // to this deserializer return new Gson().fromJson(content, Content.class); } } Now if you construct a Gson with GsonBuilder and register the deserializer: Gson gson = new GsonBuilder() .registerTypeAdapter(Content.class, new MyDeserializer()) .create(); You can deserialize your JSON straight to your Content: Content c = gson.fromJson(myJson, Content.class); Edit to add from comments: If you have different types of messages but they all have the "content" field, you can make the Deserializer generic by doing: class MyDeserializer&lt;T&gt; implements JsonDeserializer&lt;T&gt; { @Override public T deserialize(JsonElement je, Type type, JsonDeserializationContext jdc) throws JsonParseException { // Get the "content" element from the parsed JSON JsonElement content = je.getAsJsonObject().get("content"); // Deserialize it. You use a new instance of Gson to avoid infinite recursion // to this deserializer return new Gson().fromJson(content, type); } } You just have to register an instance for each of your types: Gson gson = new GsonBuilder() .registerTypeAdapter(Content.class, new MyDeserializer&lt;Content&gt;()) .registerTypeAdapter(DiffContent.class, new MyDeserializer&lt;DiffContent&gt;()) .create(); When you call .fromJson() the type is carried into the deserializer, so it should then work for all you…
has comment: http://stackoverflow.com/comment/40852594
upvote count: 172
has comment: http://stackoverflow.com/comment/35594840
has comment: http://stackoverflow.com/comment/35258097

http://stackoverflow.com/comment/35808707
score: 0
type: AnswerComment
type: Comment
has text: This is sometimes fast, but n^2 in the worst case. Think what would happen on [5,4,3,2,1]. It would look at every possible combo before returning length 1.
comment on: http://stackoverflow.com/a/23270799

jdbc
tags question: http://stackoverflow.com/q/23008966
tags question: http://stackoverflow.com/q/23056502
tags question: http://stackoverflow.com/q/23095498
tags question: http://stackoverflow.com/q/23040185
tags question: http://stackoverflow.com/q/23083136
tags question: http://stackoverflow.com/q/22977407
tags question: http://stackoverflow.com/q/23058320
tags question: http://stackoverflow.com/q/22984438
tags question: http://stackoverflow.com/q/22985904
tags question: http://stackoverflow.com/q/23009400
tags question: http://stackoverflow.com/q/23066532
tags question: http://stackoverflow.com/q/23089605
tags question: http://stackoverflow.com/q/23084372
tags question: http://stackoverflow.com/q/22980134
tags question: http://stackoverflow.com/q/22973795
type: Tag
tags question: http://stackoverflow.com/q/23106010
tags question: http://stackoverflow.com/q/22971699
tags question: http://stackoverflow.com/q/22998281
tags question: http://stackoverflow.com/q/22985043
tags question: http://stackoverflow.com/q/23101180
tags question: http://stackoverflow.com/q/23005825
tags question: http://stackoverflow.com/q/23094877
tags question: http://stackoverflow.com/q/23106193
tags question: http://stackoverflow.com/q/23096123
tags question: http://stackoverflow.com/q/23095081
tags question: http://stackoverflow.com/q/22978212
tags question: http://stackoverflow.com/q/23054136
tags question: http://stackoverflow.com/q/23047200
tags question: http://stackoverflow.com/q/23067518
tags question: http://stackoverflow.com/q/23011675
tags question: http://stackoverflow.com/q/23125112
tags question: http://stackoverflow.com/q/23070187
tags question: http://stackoverflow.com/q/23057033
tags question: http://stackoverflow.com/q/23001208
tags question: http://stackoverflow.com/q/23021351
tags question: http://stackoverflow.com/q/23087539
tags question: http://stackoverflow.com/q/23129080
tags question: http://stackoverflow.com/q/23102747
tags question: http://stackoverflow.com/q/23115538
tags question: http://stackoverflow.com/q/23084224
tags question: http://stackoverflow.com/q/23031867
tags question: http://stackoverflow.com/q/23127915
tags question: http://stackoverflow.com/q/23062340
tags question: http://stackoverflow.com/q/23000737
tags question: http://stackoverflow.com/q/23129017
tags question: http://stackoverflow.com/q/22994482
tag name: jdbc
tags question: http://stackoverflow.com/q/22972426
tags question: http://stackoverflow.com/q/23020857
tags question: http://stackoverflow.com/q/23070091
tags question: http://stackoverflow.com/q/23007222
tags question: http://stackoverflow.com/q/23064017
tags question: http://stackoverflow.com/q/23047243
tags question: http://stackoverflow.com/q/23125279
tags question: http://stackoverflow.com/q/23104363
tags question: http://stackoverflow.com/q/23006999

http://stackoverflow.com/comment/35270539
comment on: http://stackoverflow.com/q/23077978
type: QuestionComment
type: Comment
has text: Ok, do you know what types of images can `cv::Mat` hold?
score: 0

http://stackoverflow.com/comment/35353370
type: Comment
has text: @Amadan Ah, agreed. I too favor the the `{` on the same line. I was confused because you said *indent* style (when it's really a curly-brace-line style issue). My bad.
type: QuestionComment
comment on: http://stackoverflow.com/q/23124721
score: 0

http://stackoverflow.com/comment/35362052
comment on: http://stackoverflow.com/a/23128241
type: AnswerComment
has text: org.jsoup.nodes.Document doc = Jsoup.connect("http://sss.eu").timeout(7*1000).get(); Elements tables = currentServerPage.getElementsByClass("tabella-voli"); Element secondTable = tables.get(1); Elements tdElements = currentServerPage.getElementsByTag("td"); for(Element tempElement : tdElements){ thread++; System.out.println(tdElements); is wrong
score: 0
type: Comment

http://stackoverflow.com/a/23115528
downvote count: 0
has body: This is a has-a relation, also called Composition. In this example, UsingDatatable has a DataTable. The following example will help you better understand the concept. public class Address{ private String houseNo; private String streetNo; } public class Person{ private Address address = null; } This example says that the Person has an Address.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23115179
upvote count: 1

http://stackoverflow.com/comment/35417075
type: Comment
type: AnswerComment
has text: I got it. Thank you. I am trying to work more with scaling and setTranslation and am having trouble here. http://stackoverflow.com/questions/23159579/programmatically-line-up-two-views-at-a-corner?noredirect=1#comment35415678_23159579
score: 0
comment on: http://stackoverflow.com/a/23116839

http://stackoverflow.com/comment/35310955
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23101133
has text: or if your requirement is to put in session then show your code.
score: 0

http://stackoverflow.com/a/23025467
score: 0
type: Answer
has body: You can add scrollbars to your code using java.awt class. Please refer to the link for complete code. http://www.fixoncloud.com/Home/LoginValidate/OneProblemComplete_Detailed.php?problemid=558
answers question: http://stackoverflow.com/q/23024914

unicode
tags question: http://stackoverflow.com/q/23000150
tag name: unicode
type: Tag
tags question: http://stackoverflow.com/q/23013654
tags question: http://stackoverflow.com/q/23057226
tags question: http://stackoverflow.com/q/23109819
tags question: http://stackoverflow.com/q/23024609
tags question: http://stackoverflow.com/q/23121765
tags question: http://stackoverflow.com/q/23028358
tags question: http://stackoverflow.com/q/23075615
tags question: http://stackoverflow.com/q/23107029

http://stackoverflow.com/q/23034093
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/2501033
tagged with: objective-c
has body: I have this function in Java: private String hexStringToByteString(String s) { String r = ""; for (int i = 0; i &lt; s.length(); i += 2) r += (char) Integer.parseInt(s.substring(i, i + 2), 16); return r; } and must implement this in Objective C, because I am developing an app and have to do some encryptions. The problem is I don't know how to make the Integer.parseInt part, passing a String and a radix int to the function. Some help will be great.
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/35190354
has title: Integer.parseInt(String s, int radix) equivalent in Objective C
upvote count: 1
type: Question
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/23034196
answer count: 1

http://stackoverflow.com/q/22999136
has comment: http://stackoverflow.com/comment/35127966
has answer: http://stackoverflow.com/a/22999209
has comment: http://stackoverflow.com/comment/35127527
score: 0
tagged with: java
tagged with: swing
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/35127304
tagged with: arrays
type: UnansweredQuestion
has body: I am having a problem with my ControlGUI class. I want to create an array that store integer values of data entered on the GUI JTextfield and return the input for use in a a different class. My code is: public class ControlGUI extends JFrame{ private TemperatureControlAgent myAgent;*emphasized text* public static JTextField mouldTempField, meltTempField; public ControlGUI() { } public static int[] getArray(){ int input[] = new int [2]; JTextField t[]=new JTextField [10]; //public TextFieldArray JPanel panel=new JPanel(new GridLayout(5,2)); for(int i=0;i&lt;10;i++) { t[i]= new JTextField(10); panel.add(t[i]); input[0] = Integer.parseInt(mouldTempField.getText()); input[1] = Integer.parseInt(meltTempField.getText()); System.out.println("Input mouldTempField"+ input[0]); return input;} ControlGUI (TemperatureControlAgent a) { super (a.getLocalName()); myAgent = a; JPanel p = new JPanel(); p.setLayout(new GridLayout (3, 3)); p.add(new JLabel ("Mould Temperature Set Value: ")); mouldTempField = new JTextField (10); p.add(mouldTempField); p.add(new JLabel ("Melt temperature: ")); meltTempField = new JTextField (10); p.add(meltTempField); getContentPane().add(p, BorderLayout.CENTER); JButton addButton = new JButton ("Enter"); addButton.addActionListener (new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { try { String mouldTemp = mouldTempField.getText().trim(); String meltTemp = meltTempField.getText().trim(); myAgent.updateCatalogue(Integer.parseInt(mouldTemp), Integer.parseInt(meltTemp)); mouldTempField.setText(""); meltTempField.setText(""); } catch (Exception e) { JOptionPane.showMessageDialog(ControlGUI.this, "Invalid values. "+e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } }); p = new JPanel(); p.add(addButton); getContentPane().add(p, BorderLayout.SOUTH); //Ensure termination of the agent when the user closes the GUI //using "close" button addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e)…
has title: Using an array to store values from a GUI
tagged with: user-interface
type: Question
has comment: http://stackoverflow.com/comment/35128646
has comment: http://stackoverflow.com/comment/35127004
has comment: http://stackoverflow.com/comment/35127107
answer count: 2
has answer: http://stackoverflow.com/a/23000432

http://stackoverflow.com/q/23050331
has title: Can I not do this? Getting an 'exception' error
has body: Getting the following error: ".Exception in thread "main" java.lang.NullPointerException " // Creates 10 accounts Account[] AccArray = new Account[10]; // Data fields double atmVal; // Sets each account's discrete id and initial balance to 100 for (int i=0;i&lt;10;i++){ AccArray[i].setId(i); // this line is specified in the error AccArray[i].setBalance(100); } This compiled fine, but I get an "exception" (not sure what those are, yet). I don't see what's wrong at all, at least not here. If that's deemed to be the case, I'll add more of my code.
has answer: http://stackoverflow.com/a/23050340
answer count: 4
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23050340
tagged with: error-handling
type: Question
has answer: http://stackoverflow.com/a/23050640
possible better answer: http://stackoverflow.com/a/23050339
has answer: http://stackoverflow.com/a/23050339
score: 0
has answer: http://stackoverflow.com/a/23050342

bloom-filter
type: Tag
tags question: http://stackoverflow.com/q/23057200
tag name: bloom-filter

http://stackoverflow.com/a/23090755
has comment: http://stackoverflow.com/comment/35293088
has comment: http://stackoverflow.com/comment/35293953
has comment: http://stackoverflow.com/comment/35293018
has comment: http://stackoverflow.com/comment/35293663
upvote count: 3
has comment: http://stackoverflow.com/comment/35292831
has body: Before being usable, variables must be allocated a memory location and then initialized--whether in Java, Python, or even Logo. Declare means that you make that variable come to life with a specific snippet of code, with (using Java as an example) something like int i; Person p; These are declared, but not initialized. They are now assigned a location in memory--which, in some languages, may be ever-changing, both in location and size. But regardless, there is now some physical location in memory that the runtime environment can query, to retrieve the variable (either an indirect pointer to it, or the actual location itself). Now that it has an empty "box" in which to go, it must be filled, which is to say it must be "initialized": i = 3; p = new Person(); Now there is something concrete in the box. It is ready for use. Attempting to use it before its initialized will result (in Java) in a NullPointerException. Some languages require you to declare variables, in order to explicitly allocate memory for it (location and/or size). Some languages do this memory-allocation for you. As stated in the comments to both your question and this answer, there's a lot of variation.
has comment: http://stackoverflow.com/comment/35292937
type: Answer
has comment: http://stackoverflow.com/comment/35293675
answers question: http://stackoverflow.com/q/23090669
has comment: http://stackoverflow.com/comment/35293418
score: 3
has comment: http://stackoverflow.com/comment/35292931
downvote count: 0
has comment: http://stackoverflow.com/comment/35292948
accepted answer of: http://stackoverflow.com/q/23090669
has comment: http://stackoverflow.com/comment/35293146
has comment: http://stackoverflow.com/comment/35292974
has comment: http://stackoverflow.com/comment/35293718
type: AcceptedAnswer

http://stackoverflow.com/q/22983183
has comment: http://stackoverflow.com/comment/35097360
downvote count: 0
tagged with: web
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22983317
has body: Recently came accross a question, If anybody has some idea pls share. How to track a HTTP request in browser, OR can say how to track a request in its lifecycle. Is there any tool to test it.
has answer: http://stackoverflow.com/a/22983538
type: UnansweredQuestion
upvote count: 1
has title: how to track a request in the webapplication. Is there any tool for this with which we can test a HTTP request
tagged with: java
tagged with: servlets
type: Question
answer count: 2

http://stackoverflow.com/a/23289149
upvote count: 1
has body: This question is related to another question on Stackoverflow: Vaadin 7.0.1 Combobox with JPAContainer and FieldGroup. I wrote a blog post about this topic which explains how FieldGroups work internally and how you can make them work for this particular use case: Select Nested JavaBeans With a Vaadin FieldGroup. This post will also explain why a ConversionException is thrown in your example. Of course you could switch to using a BeanItemContainer, but by using a simple Converter implementation you can use any Container implementation as data source for your ComboBox. See the blog post for details.
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35803211
score: 1
answers question: http://stackoverflow.com/q/23117547

japplet
tags question: http://stackoverflow.com/q/23022585
tag name: japplet
type: Tag
tags question: http://stackoverflow.com/q/23017504

http://stackoverflow.com/q/23005822
has answer: http://stackoverflow.com/a/23006108
has body: I want to get data from db and display in a table and each record should have a link for See Details , for this I have : First Name Last Name More <% Connection connection = null; Statement statement = null; ResultSet resultSet = null; try { connection = com.secure.db.DatabaseManager.getConnection(); statement = connection.createStatement(); resultSet = statement.executeQuery("SELECT * from address"); while (resultSet.next()) { %> <%=resultSet.getString("first_name")%> <input type="hidden" name="fname" value="<%=resultSet.getString("first_name")%>"> <%=resultSet.getString("last_name")%> <input type="hidden" name="lname" value="<%=resultSet.getString("last_name")%>"> See Details <% } %> <% } catch (Exception ex) { ex.printStackTrace(); %> Ooops, something bad happened: <% } finally { if (resultSet != null) resultSet.close(); if (statement != null) statement.close(); if (connection != null) connection.close(); } %> Now result is : when I click on first record I get correct information, but when I click on other than first record I'm still getting data of first record. how to get correct data?
type: Question
answer count: 2
tagged with: jsp
tagged with: javascript
tagged with: jquery
tagged with: tomcat
score: 0
accepted answer: http://stackoverflow.com/a/23006108
favorite count: 0
possible better answer: http://stackoverflow.com/a/23005959
has comment: http://stackoverflow.com/comment/35138581
has answer: http://stackoverflow.com/a/23005959
has comment: http://stackoverflow.com/comment/35139137
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has title: how to sent data by clicking a link in jsp
tagged with: java

http://stackoverflow.com/q/23124525
has comment: http://stackoverflow.com/comment/35353023
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/23124579
linked to: http://stackoverflow.com/q/6414601
tagged with: depth-first-search
has answer: http://stackoverflow.com/a/23124612
has title: StackOverflowError -java
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23124579
has comment: http://stackoverflow.com/comment/35352928
tagged with: java
has body: I am writing a code to run DFS on a graph however these graphs are huge. I am getting a stack overflow error on DFS visit however other people were able to run DFS visit without any problems. Is there any reason why I would be getting a StackOverFlow error? I tried allocating more memory (I have 16gb RAM) however it caps me at 1gb ram. public void DFSVisit(Graph &lt;String, String&gt; graph, String current, int [] data, StackObject [] finish, boolean complicated){ //data stores the time data[9]++; graph.setAnnotation(current, "time", data[9]); graph.setAnnotation(current, "color", "gray"); Iterator &lt;ArrayList&lt;String&gt;&gt; itr = graph.outAdjacentVertices(current); ArrayList &lt;String&gt; currentlist = null; String adjacent; while(itr.hasNext()){ currentlist = itr.next(); adjacent = currentlist.get(1); if(graph.getAnnotation(adjacent, "color").equals("white")){ graph.setAnnotation(adjacent, "parent", current); DFSVisit(graph, adjacent, data, finish, complicated); } } graph.setAnnotation(current, "color", "black"); data[9]++; graph.setAnnotation(current, "done", data[9]); finish[0].done.push(current); //System.out.println(current); }
type: Question
has answer: http://stackoverflow.com/a/23147595
accepted answer: http://stackoverflow.com/a/23147595
tagged with: graph
has answer: http://stackoverflow.com/a/23124580
tagged with: stack-overflow
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/35295359
has text: For what it's worth, it's always good practice to make sure you don't get out of bounds of an array.
comment on: http://stackoverflow.com/a/23090145
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23114049
tagged with: mutual-authentication
tagged with: android
upvote count: 6
linked to: http://stackoverflow.com/q/8798707
score: 6
tagged with: https
has title: SSL mutual authentication FAIL on Android Client accepts servers certificate but server does not get the client cert
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23121297
tagged with: java
tagged with: ssl
linked to: http://stackoverflow.com/q/1217141
type: Question
downvote count: 0
answer count: 1
has body: I am trying to set up a mutually authenticated SSL between a Linux Server and Android APP. So far, I have been able to get the app to work with the server certificate communicate via SSL but once I set the server to only accept client certificates it stops working. The server configuration seems ok, but I am a kind of stuck. My best guess is that the client certificate is not correctly being presented to the server but got no idea how to test it next. I tried using the .pem for the client in my OS X keychain but the browsers does not seem to work with that certificate. Then again the Server certificate works perfectly because I can achieve https connection and the APP Accepts my unsigned server certificate. The code I have been I am using is the combination of various tutorials, answers this is the main ones I have bookmarked: http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/ Self-signed SSL acceptance on Android Securing communication [Authenticity, Privacy &amp; Integrity] with mobile app? (For the Server Config) https://security.stackexchange.com/questions/34897/configure-ssl-mutual-two-way-authentication This are the two main classes I am using for the connection: 1) This class handles the JSON parsing and does the REQUESTS package edu.hci.additional; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.util.List; import android.content.Context; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.utils.URLEncodedUtils; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; public class JSONParse…
accepted answer: http://stackoverflow.com/a/23121297
favorite count: 0

http://stackoverflow.com/comment/35159175
type: Comment
has text: yes, it is in the form of 01/04/2010 or any other date with the same format
score: 0
comment on: http://stackoverflow.com/q/23016896
type: QuestionComment

http://stackoverflow.com/comment/35157593
comment on: http://stackoverflow.com/a/23016184
score: 0
has text: He is teaching us object oriented programming and I am so confused. I will appreciate any help on this subject.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35094229
has text: @MarounMaroun I am not attacking, just aksing. If you perceive this as an attack you may want to learn a bit about stylistic /rethorical devices ... take it easy, take a break.
comment on: http://stackoverflow.com/q/22981210
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23055675
has body: This is a slight variant of Luciano's answer. Regarding your 4 questions: return type: use generics int range: use IntStream.range permutation algorithm: easy to implement on you own, see Heap's algorithm return type: use an overloaded method Here is the complete code (except for the implementation of the permutations): public class ParallelTest { private static &lt;T&gt; T measure(Supplier&lt;T&gt; func) { long start = System.nanoTime(); T result = func.get(); long elapsed = System.nanoTime() - start; System.out.printf("Execution time %dns\n", elapsed); return result; } private static void measure(Runnable runnable) { measure(() -&gt; { runnable.run(); return ""; }); } private static int sum = 0; // Warning: data race private static void heavyComputation() { Permutations.of("abcdefghij").forEach(i -&gt; ++sum); } public static void main(String... args) { measure(ParallelTest::heavyComputation); System.out.printf("Sum: %s\n", sum); measure(() -&gt; IntStream.range(0, 10).forEach(i -&gt; heavyComputation())); measure(() -&gt; IntStream.range(0, 10).parallel().forEach(i -&gt; heavyComputation())); System.out.printf("Sum: %s\n", sum); } } However, be careful when comparing languages. I recommend using examples, that are based on your daily work. The above example has been made up, and there are a few problems with it. For example: there is a bad data race on the variable sum streams are designed to make light computations on large streams, not heavy computations on small streams the performance is dominated by the implementation of the permutations, a rarely used function
has comment: http://stackoverflow.com/comment/36054057
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23050921
has comment: http://stackoverflow.com/comment/35243639
type: Answer
accepted answer of: http://stackoverflow.com/q/23050921
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35242983

http://stackoverflow.com/comment/35294969
comment on: http://stackoverflow.com/q/23091657
has text: why don't you use ListView with custom Adapter ? btw you may find your solution here http://stackoverflow.com/a/7280804/855843
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35078024
type: QuestionComment
comment on: http://stackoverflow.com/q/22970677
has text: I am getting a little worried about the tendency to try and close questions that cannot be answered by some people. There are unbelievably long answers to some questions right here on SO, and many closed questions have answers are very beneficial to the community. The questions that have been raised in this post, I can see, after two days of researching this on SO, is very useful for several folks! Where else is a beginner supposed to ask questions on such a topic? I can't find any help on Google!
score: 0
type: Comment

http://stackoverflow.com/q/23123277
has comment: http://stackoverflow.com/comment/35351149
has answer: http://stackoverflow.com/a/23123369
has answer: http://stackoverflow.com/a/23123394
downvote count: 0
has answer: http://stackoverflow.com/a/23123365
has answer: http://stackoverflow.com/a/23123342
favorite count: 0
tagged with: java.util.scanner
answer count: 5
tagged with: break
has answer: http://stackoverflow.com/a/49090070
has body: I am taking an online MOOC to learn Java, the only problem i have is it is from the university of Helsinki in Finland i live in the US so there are limited times when i can be awake to ask for help on an exercise. my current exercise is to ask the user for a number and then print each whole number up to that number while using a while { } statement this is the code i have currently public static void main(String[] args) { Scanner reader = new Scanner(System.in); int number = Integer.parseInt(reader.nextLine()); System.out.print("up to what number?:"+ number); while (number&lt;=number){ System.out.println(number); number++; } } and what it looks like it is doing is ignoring the while (number&lt;=number) { System.out.println(number); part of my code and proceeding straight to the number++; portion of my code do i need to declare another int(variable) to store a value? the way the course has the test cases for grading i can't simply declare a variable with a definite value as they run several test cases like positive numbers and negative numbers. is there a way to use the reader to store a value to two separate variables so that they can be compared against each other and only print the numbers up to that number? i also know that i am missing a Break; statement but i am not sure where i would place it in the code i have, i have tried to use } else { break; but get an error stating that i have an else without an if. i am using netbeans as it is required for my course because the server submissions are setup through TMC. thinking about it now i'm sure its not skipping the while statement but simply continues to print because as it prints and increments the users input is incremented as well since i only have the one variable but i am again not sure how i would go about storing the user input value in two different variables where i can compare them with the less than or equal to statement and stop the printing once it reaches the number input by the user, in that case i …
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/23123342
accepted answer: http://stackoverflow.com/a/23123394
has title: How to print each number up to a certain number
upvote count: 3
tagged with: java
type: Question

http://stackoverflow.com/a/23119242
downvote count: 0
has comment: http://stackoverflow.com/comment/35343565
has comment: http://stackoverflow.com/comment/35344503
type: Answer
has comment: http://stackoverflow.com/comment/35344316
score: 5
has comment: http://stackoverflow.com/comment/35344217
has comment: http://stackoverflow.com/comment/35344412
upvote count: 5
has body: You do it the same exact way you are inserting your result variables into the strings... System.out.println(operand1 + " + " + operand2 + " = " + sum); You could also use printf if you wanted to although you have to insert the line break explicitly: System.out.printf("%d + %d = %d%n", operand1, operand2, sum);
answers question: http://stackoverflow.com/q/23119208

http://stackoverflow.com/comment/35298976
type: QuestionComment
score: 2
has text: The elegant solution necessarily depends on the user's view of all the buttons, or alternately what it is the application is attempting to communicate about with the user through buttons. Use lots of drop-downs; have one button generate a list of other buttons, have hierarchies of buttons, don't use buttons, use checkboxes or radio buttons or something that isn't standard -- all possibly good, no way to evaluate until we (or at least you) know what you want to do.
comment on: http://stackoverflow.com/q/23090427
type: Comment

http://stackoverflow.com/a/23043032
has body: Override the method in your Activity class: @Override public void onConfigurationChanged(Configuration newConfig) { // TODO: handle the new configuration }
type: Answer
has comment: http://stackoverflow.com/comment/35210734
score: 0
answers question: http://stackoverflow.com/q/23041975

http://stackoverflow.com/q/23021377
has comment: http://stackoverflow.com/comment/35167731
tagged with: abstract-data-type
has answer: http://stackoverflow.com/a/23021641
has title: Reassign `this` in Java class
has comment: http://stackoverflow.com/comment/35167874
type: Question
has comment: http://stackoverflow.com/comment/137678222
tagged with: java
accepted answer: http://stackoverflow.com/a/23021641
has comment: http://stackoverflow.com/comment/35167701
has comment: http://stackoverflow.com/comment/35167742
has comment: http://stackoverflow.com/comment/35168023
upvote count: 4
answer count: 2
tagged with: this
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/35168151
favorite count: 0
has comment: http://stackoverflow.com/comment/35167993
has body: I'm just fooling around in Java right now, trying to implement something similar to a stack using linked lists. class ListStack { int value; int size; ListStack next; public ListStack (int add) { this.size = 1; this.value = add; this.next = null; } public void push (int add) { this.next = this; this.value = add; this.size++; } public int pop() { if (this.size == 0) { throw new EmptyListStackException(); } int i = this.value; this = this.next; this.size--; return i; } public int size() { return this.size; } public int peek() { return this.value; } } Basically it's an insertion-in-front linked list which also removes from front. NetBeans pops an error when I try to do this = this.next; it says I cannot reassign final value this. I'd like my final implementation to do something like the below: ListStack var = new ListStack(5); //var is now 5 -&gt; null var.push(3); //var is now 3 -&gt; 5 -&gt; null int val = varr.pop(); //var is now 5 -&gt; null, val == 3 Commenting put that this = this.next code, the rest seems to work. ListStack a = new ListStack(5); System.out.println(a.size()); //prints 1 System.out.println(a.peek()); //prints 5 a.push(4); System.out.println(a.size()); //prints 2 System.out.println(a.peek()); //prints 4 a.push(6); System.out.println(a.size()); //prints 3 System.out.println(a.peek()); //prints 6 a.push(1); System.out.println(a.size()); //prints 4 System.out.println(a.peek()); //prints 1 //a is 1 -&gt; 6 -&gt; 4 -&gt; 5 -&gt; null
possible better answer: http://stackoverflow.com/a/23021748
has comment: http://stackoverflow.com/comment/35167797
has answer: http://stackoverflow.com/a/23021748
has comment: http://stackoverflow.com/comment/35168178
tagged with: reference
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35167790
has comment: http://stackoverflow.com/comment/35168668

http://stackoverflow.com/q/23121703
has title: Why can't JRuby use my Java method whose parameter is a RubyArray when it is overloaded?
linked to: http://stackoverflow.com/q/9373104
type: Question
has body: Have a Java class with an overloaded method: public void test(float x) { } public void test(RubyArray array) { } In Ruby, object.test(1.0) Works fine. However: object.test([1.0,2.0]) Will crash with the message: org.jruby.exceptions.RaiseException: (NameError) no method 'test' for arguments (org.jruby.RubyArray) on Java::MyNamespace::MyClass available overloads: (org.jruby.RubyArray) (int) But, as you can see, that doesn't make any sense. It is telling me that there is no method for my argument of type RubyArray, and then it promptly tells me that there is an available overload for arguments of type RubyArray. Interestingly, this works fine if you remove the (int) overload, that is, it works if the method that accepts RubyArray has no other overloads. I have created many overloaded Java methods and used them in Ruby before, so I am guessing that the problem is related mainly to the RubyArray argument itself - although I don't see the issue. Why is that? What am I doing wrong here? I am using JRuby 1.7.11, building for what I think is Java SE 6 on Eclipse Kepler for Mac. To make it easier to test, you can run the following two programs: This works: import javax.script.*; import org.jruby.RubyArray; public class Main { public static void main(String[] args) throws ScriptException, NoSuchMethodException { Main app = new Main(); } public Main() throws ScriptException, NoSuchMethodException { ScriptEngine jruby = new ScriptEngineManager().getEngineByName("jruby"); jruby.eval("include Java;\n" + "def start(main) main.test([1,2,3]); end"); Invocable invocable = (Invocable)jruby; invocable.invokeFunction("start",this); } public void test(RubyArray array) { System.out.println(array); } } This doesn't work: import javax.script.*; import org.jruby.RubyArray; public class Main { public static void main(String[] args) throws ScriptException, NoSuchMethodException { Main app = new Main(); } public Main() throws ScriptException, NoSuchMethodException { ScriptEngine jruby = new Scr…
answer count: 2
has comment: http://stackoverflow.com/comment/35367771
tagged with: jruby
downvote count: 0
favorite count: 0
tagged with: ruby
has answer: http://stackoverflow.com/a/23222019
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23226125
has comment: http://stackoverflow.com/comment/35363119
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/q/23071624
downvote count: 0
possible better answer: http://stackoverflow.com/a/23077920
favorite count: 0
has answer: http://stackoverflow.com/a/23077920
has comment: http://stackoverflow.com/comment/35262192
has body: When using a build manager like Gradle or Maven, my dependencies are being managed correctly, however the Eclipse IDE is unaware of the resolved dependencies so it will still show errors and I cannot build through Eclipse, I have to run a 'build' command through the build manager. How do you get Eclipse to be aware of the resolved dependencies taken care of by a build manager and running the app through the IDE?
has title: Eclipse build errors when using Gradle or Maven?
tagged with: maven
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/23075237
tagged with: java
upvote count: 1
tagged with: gradle
type: Question
accepted answer: http://stackoverflow.com/a/23075237
tagged with: eclipse
answer count: 2

http://stackoverflow.com/comment/35215168
type: Comment
type: QuestionComment
has text: Yes, I know about intents, but I don;t have this data when I want to use an intent. Do you all mean that I have to get rid of all the constructors in the code and use intents instead?
comment on: http://stackoverflow.com/q/23047716
score: 0

http://stackoverflow.com/comment/35311519
has text: With your example, click somewhere on the panel and then resize the window...watch whatever was painted to it disappear...this is one of the reasons why you don't want to use and why we don't want `getGraphics` recommended as a means for performing custom painting...
comment on: http://stackoverflow.com/a/23101397
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23017659
has body: So, i was using some variables in my methods but I get errors and I dont know how to fix this heres my code from my first class: import java.util.Scanner; public class Gerbilfood { public static void main(String[] args) { Gerbil[] gerbil; Scanner scanner = new Scanner(System.in); System.out.println("Please input how many types of food items the gerbils eat as an integer"); String n0 = scanner.nextLine(); int n1 = Integer.parseInt(n0); String[] food = new String[n1]; for (int i = 0; i &lt; n1; i++) { System.out.println("Please enter a food name"); String n2 = scanner.nextLine(); food[i] = n2; int[] maximum = new int[n1]; System.out.println("Please enter maximum amount of food per day"); String n33 = scanner.nextLine(); int n3 = Integer.parseInt(n33); maximum[i] = n3; } System.out.println("Please enter in the number of gerbils in the lab"); String n73 = scanner.nextLine(); int n4 = Integer.parseInt(n73); gerbil = new Gerbil[n4]; int[] combo = new int[n4]; String[] ids = new String[n4]; for (int i = 0; i &lt; n4; i++) { Gerbil g = new Gerbil(n1); System.out.println("Please enter in the lab id for each gerbil"); String n5 = scanner.nextLine(); g.setId(n5); //ids[i] = n5; //String[] names = new String[n4]; System.out.println("Please enter in the name of each gerbil"); String n6 = scanner.nextLine(); // gerbil name g.setName(n6); String[] amountfood = new String[n1]; for (int j = 0; j &lt; n1; j++) { System.out.println("how much of" + food[j] + "did the gerbil eat"); String n8 = scanner.nextLine(); amountfood[i] = n8; } String[] bite = new String[n4]; System.out.println("Does this Gerbil bite? Enter True or False"); String n77 = scanner.nextLine(); bite[i] = n77; String[]escape = new String[n4]; System.out.println("Does this Gerbil escape? Enter True or False"); String n89 = scanner.nextLine(); escape[i] = n89; } System.out.println("What information would you like to know?"); String n55 = scanner.nextLine(); String n33 = "search"; String n34 = "average"; String n35 = "res…
has title: Variables used in my method are showing errors and are unresolved
has comment: http://stackoverflow.com/comment/35160443
score: 0
has comment: http://stackoverflow.com/comment/35160645
answer count: 1
has comment: http://stackoverflow.com/comment/35160392
has comment: http://stackoverflow.com/comment/35160599
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23018024
tagged with: eclipse
tagged with: syntax-error
has comment: http://stackoverflow.com/comment/35160437
has comment: http://stackoverflow.com/comment/35160356
type: Question

http://stackoverflow.com/a/23049550
has comment: http://stackoverflow.com/comment/35218553
has comment: http://stackoverflow.com/comment/35218593
has comment: http://stackoverflow.com/comment/35218338
has body: try this: import java.util.Arrays; . . . String[][] a = { { "john" }, { "jones" } }; System.out.println(Arrays.deepToString(a)); //whole string array System.out.println(Arrays.deepToString(a[0])); //john System.out.println(Arrays.deepToString(a[1])); //jones
has comment: http://stackoverflow.com/comment/35218493
score: 0
answers question: http://stackoverflow.com/q/23049419
type: Answer

http://stackoverflow.com/comment/35142875
comment on: http://stackoverflow.com/a/23008096
has text: Try with this changes
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23083216
upvote count: 3
tagged with: java
tagged with: node-modules
has answer: http://stackoverflow.com/a/23505493
type: Question
has title: Ignore "node_modules" from deployment in Google App Engine Java Project
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23505493
favorite count: 0
tagged with: google-app-engine
has body: Google App Engine java project uses node modules for grunt tasks which is used to build the front end. After we run grunt built, it gives the dist folder to be deployed. We have following folder structure myproject src/ war/ app/ dist/ node_modules/ Gruntfile.js WEB-INF/ We do not want to deploy node-modules directory. I have add following in appengine-web.xml &lt;static-files&gt; &lt;exclude path="/node_modules/*.*" /&gt; &lt;/static-files&gt; But it DOES NOT work. How to exclude them from deployment?
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/22987016
type: AnsweredQuestion
downvote count: 0
has body: How can one achieve a html webpage in vaadin using layout components (new to vaadin) Right now whatever components i add in UI Component only some components appear in the browser... there is no scrolling option to see other components i added below in the hierarchy public class LoginView extends CustomComponent implements View, Button.ClickListener { public static final String NAME = "login"; private TextField user; private PasswordField password; private Button loginButton; NativeSelect select_role; private HorizontalLayout fieldsBottomPanel; private VerticalLayout fieldsLeftPanel; private GridLayout loginPanelGrid; private VerticalLayout filedsTopPanel; private VerticalLayout loginFormLayout; private Label top_header_panel; private VerticalLayout virtualKeyboard; private VerticalLayout fieldsRightPanel; private VerticalLayout footer; private VerticalLayout header; private Window page; public LoginView() { setSizeFull(); addTopPanelToLoginForm(); addLeftPanelToLoginForm(); addBottomPanelToLoginForm(); addRightPanelToLoginForm(); addLoginFormToPage(); addFooterToPage(); addHeaderToPage(); VerticalLayout viewLayout = new VerticalLayout(header,loginFormLayout,footer); viewLayout.setComponentAlignment(loginFormLayout, Alignment.MIDDLE_CENTER); viewLayout.setStyleName(Reindeer.LAYOUT_WHITE); setCompositionRoot(viewLayout); } public void addHeaderToPage(){ header = new VerticalLayout(); header.setStyleName("header-login"); } public void addFooterToPage(){ footer = new VerticalLayout(); footer.addStyleName("footer-login"); } }
has comment: http://stackoverflow.com/comment/35104427
type: Question
score: 3
tagged with: frameworks
tagged with: java
linked to: http://stackoverflow.com/q/22964477
tagged with: vaadin
accepted answer: http://stackoverflow.com/a/22987943
upvote count: 3
answer count: 1
tagged with: web
has answer: http://stackoverflow.com/a/22987943
favorite count: 0
has title: scrollable vaadin view to display all the components in the page
has comment: http://stackoverflow.com/comment/35104524

http://stackoverflow.com/comment/35437200
comment on: http://stackoverflow.com/a/23130889
type: Comment
has text: I am not telling it doesn't work. My code works perfectly, but it is giving an error, where there is none. :) (See my screenshots)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35228975
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23055308
has text: @NimChimpsky Yes, but if I'll install additional subdomain and redirect all requests to second instance it might help

http://stackoverflow.com/a/23038222
type: Answer
has comment: http://stackoverflow.com/comment/35198061
downvote count: 0
answers question: http://stackoverflow.com/q/23038215
has comment: http://stackoverflow.com/comment/35198146
has comment: http://stackoverflow.com/comment/35198109
accepted answer of: http://stackoverflow.com/q/23038215
has body: You can't and shouldn't try to declare an infinite number of anything -- just doesn't make sense. Instead use a collection such as an ArrayList that can hold a variable number of object references. e.g., private List&lt;Rectangle&gt; carList = new ArrayList&lt;&gt;(); This won't work: public Rectange car + carNumber;//if carNumber was one, it would be called car1 because variable names don't work that way, they can't be created by concatenating Strings. But don't worry about this, because the ArrayList will take care of this. The third item in the list would be obtainable easy enough: carList.get(2). To see if any Rectangles in the list contain another Rectangle use a for loop and iterate through the collection: for (Rectangle rect : carList) { if (rect.contains(testRectangle) { // this item contains the test Rectangle } }
has comment: http://stackoverflow.com/comment/35198050
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35216303
upvote count: 5
has comment: http://stackoverflow.com/comment/35198613

http://stackoverflow.com/comment/35204199
type: QuestionComment
comment on: http://stackoverflow.com/q/23042008
has text: Does SQLite really support the non-standard backtick ` quoting?
score: 1
type: Comment

http://stackoverflow.com/comment/35198985
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23038522
has text: The numbers will be entered as space separated strings like 1 2 3 4 5 4 3 4 5 6 7

http://stackoverflow.com/comment/35318581
comment on: http://stackoverflow.com/q/23095273
score: 0
type: Comment
has text: Why are you not including attr2 in the join table A_B ?
type: QuestionComment

http://stackoverflow.com/a/23091608
downvote count: 0
has comment: http://stackoverflow.com/comment/35294960
has body: I believe you can do something like this: ([ ]*+[0-9A-Za-z]++[ ]*+)+ This is 0 or more spaces, followed by at least 1 alphanum char, followed by 0 or more spaces ^^ that whole thing at least once. Using Pshemo's idea of possessive quantifiers to speed up the regex.
has comment: http://stackoverflow.com/comment/35302031
has comment: http://stackoverflow.com/comment/35295008
has comment: http://stackoverflow.com/comment/35294768
has comment: http://stackoverflow.com/comment/35294910
score: 21
has comment: http://stackoverflow.com/comment/35295162
has comment: http://stackoverflow.com/comment/35295150
has comment: http://stackoverflow.com/comment/35301840
accepted answer of: http://stackoverflow.com/q/23091427
has comment: http://stackoverflow.com/comment/35294812
has comment: http://stackoverflow.com/comment/35294934
answers question: http://stackoverflow.com/q/23091427
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35295078
has comment: http://stackoverflow.com/comment/35294968
has comment: http://stackoverflow.com/comment/35295064
has comment: http://stackoverflow.com/comment/35294972
has comment: http://stackoverflow.com/comment/35295499
upvote count: 21
type: Answer
has comment: http://stackoverflow.com/comment/35294626
has comment: http://stackoverflow.com/comment/35295347
has comment: http://stackoverflow.com/comment/35295422
has comment: http://stackoverflow.com/comment/35294903
has comment: http://stackoverflow.com/comment/35302717
has comment: http://stackoverflow.com/comment/35295528
has comment: http://stackoverflow.com/comment/35294936

http://stackoverflow.com/q/23019775
has title: Integration issue on Hibernate, websphere and DB2 database
score: 0
type: UnansweredQuestion
tagged with: spring
type: Question
tagged with: java
tagged with: hibernate
has body: Issue Overview I'm facing an StaleConnectionException, whenever i deploy my Web application on the IBM Websphere v7.0.0.17. I'm using the datasource connection provided by Websphere through a JNDI Lookup. ERROR 10 Apr 2014 01:41:20,101 server.startup : 2 org.hibernate.tool.hbm2ddl.SchemaValidator - could not get database metadata com.ibm.websphere.ce.cm.StaleConnectionException: SEQNAME IS NOT VALID IN THE CONTEXT WHERE IT IS USED. SQLCODE=-206, SQLSTATE=42703, DRIVER=3.51.90 Problem Description Our Webapplication has developed based on GWT+Spring+Hibernate framework and it running on an IBM Websphere v7 and it interacts with IBM DB2 database. We consumes the datasource object(JNDI Lookup) configured on the Websphere App server. From the error logs(attached), we understood that the issue occurs during Database Schema Validation against the DB2 database. But, we have cross checked the Hibernate Configuration and Table Structure(schema) has no issues and it is working fine with a tomcat server. This below error appears only on Websphere while deploying the application. I also followed some suggestion provided on technical forums by reducing the “minimum_connection_size” for the “StaleConnectionException”on the Websphere’s datasource properties, but it doesn’t help me to resolve this error. Error Snippet: 2014-04-11 08:10:47,841 ERROR [SchemaValidator] could not get database metadata com.ibm.websphere.ce.cm.StaleConnectionException: SEQNAME IS NOT VALID IN THE CONTEXT WHERE IT IS USED. SQLCODE=-206, SQLSTATE=42703, DRIVER=3.51.90 at com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.handleStaleStatement(WSJdbcUtil.java:849) at com.ibm.ws.rsadapter.AdapterUtil.mapException(AdapterUtil.java:2125) at com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.mapException(WSJdbcUtil.java:1034) at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.executeQuery(WSJdbcStatement.java:943) at org.hibernate.tool.hbm2ddl.DatabaseMetadata.initSequences(DatabaseMetadata.java:151) at org.hibernate.tool.hbm2ddl.DatabaseMetadata…
has answer: http://stackoverflow.com/a/23020859
tagged with: websphere
answer count: 1
tagged with: db2
has comment: http://stackoverflow.com/comment/35164740
has comment: http://stackoverflow.com/comment/35165959

http://stackoverflow.com/comment/35074712
has text: I am stucked to Create new Android Key in API access. I don't know where to execute this command: keytool -list -v -keystore mystore.keystore
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22969396
type: AnswerComment

http://stackoverflow.com/a/23049332
has comment: http://stackoverflow.com/comment/35218461
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23049314
answers question: http://stackoverflow.com/q/23049314
has comment: http://stackoverflow.com/comment/35218322
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35218410
type: Answer
has body: You're importing the wrong type: import java.awt.List; You should: import java.util.List;

http://stackoverflow.com/a/35481970
score: 5
downvote count: 0
type: Answer
has body: There are QAPlug plugins to manage code quality using PMD, Checkstyle and Findbugs. Ref: http://qaplug.com/ They are also compatible for android studio. Ref: http://qaplug.com/blog/qaplug-for-android-studio/ To add the QA plugins to android studio; 1-) Click File --&gt; Setings 2-) Select 'Plugins' option from left menu. 3-) Click 'Browse repositories' button. 4-) Write 'QAPLug' keyword in the textbox which is searching plugin. You will see QAPlug plugins like Checkstyle, FindBugs, Hammurapi and PMD.. 5-) Select plugins whichever you want and install them. 6-) Click 'Apply' button and restart android studio. You are ready to use plugins which are selected by your side. To use these plugins; 7-) Select your code block or files which have your codes and Right Click --&gt; Analyze --&gt; Analyze Code 8-) At last, Click 'OK' button. Selected plugins work and show you code analysis results on Analysis Tab. More : https://qaplug.com/tutorial/
answers question: http://stackoverflow.com/q/22996215
upvote count: 5

http://stackoverflow.com/comment/35113584
comment on: http://stackoverflow.com/a/22990961
type: AnswerComment
has text: @Octopus I changed to `int i = index.getAndIncrement(); if (++i >= SIZE) index.set(0); value.getAndAdd(preLoaded[i]);` It doesn't work.
score: 0
type: Comment

http://stackoverflow.com/comment/35302119
has text: You iterate over classes from compilationUnit, but You return only bytes from the last class `compiledScriptBytes = groovyClass.getBytes();` I don't know if this is the case, but this looks like a potential bug.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23088401

http://stackoverflow.com/q/23028621
tagged with: yahoo
tagged with: rest
type: UnansweredQuestion
score: 2
downvote count: 0
answer count: 0
tagged with: java
has body: problem is what I want to get information from http://finance.yahoo.com/q/ao?s=AAPL+Analyst+Opinion link , where are tables Analyst Opinion, Upgrades &amp; Downgrades History,Recommendation Trends. Are they available via link http://finance.yahoo.com/d/quotes.csv?s=AAPL+Analyst+Opinion&amp;f=nkqwxyr1l9t5p4 ? It was return table like Apple Inc. 575.14 6-Feb 385.10 - 575.14 NasdaqNM 2.33 13-Feb 519.61 N/A -0.74% ANALYST N/A N/A N/A - N/A N/A N/A N/A 0 N/A 0.00% OPINION N/A N/A N/A - N/A N/A N/A N/A 0 N/A 0.00% I am interested to get information like Buy, Sell , Hold . Which type of query I need to make?
type: Question
tagged with: yahoo-api
upvote count: 2
has title: yahoo finance API, how to get/parse AAPL+Analyst+Opinion in csv or JSON
tagged with: yahoo-finance
favorite count: 0

http://stackoverflow.com/comment/35119840
type: QuestionComment
has text: OK, if I give you an example on a public site, is that enough to get you started?
score: 0
comment on: http://stackoverflow.com/q/22988325
type: Comment

http://stackoverflow.com/comment/35169666
type: AnswerComment
comment on: http://stackoverflow.com/a/23021972
score: 0
type: Comment
has text: http://docs.oracle.com/javase/7/docs/webnotes/install/

http://stackoverflow.com/q/23060562
tagged with: android-layout
tagged with: flipview
answer count: 2
has answer: http://stackoverflow.com/a/33571306
upvote count: 1
has body: I have a RelativeLayout in which there is inside another RelativeLayout I want flip the last layout for entire if possible but i i don't know if possible. The layout is: <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/txt" android:background="@layout/background_card" android:layout_marginRight="10dp" android:layout_marginTop="30dp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:gravity="left" android:layout_toRightOf="@+id/btns" android:fontFamily="sans-serif-light" android:text="" android:textColor="#ff888888" android:textSize="18dp" /> <ImageView android:id="@+id/photo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/list" /> <TextView android:id="@+id/citybox" android:textColor="#63b875" android:fontFamily="sans-serif-condensed" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="City" android:layout_margin="1dp" android:textSize="23sp" /> <ImageView android:id="@+id/imageview_forecast_info" android:layout_width="95dp" android:layout_centerHorizontal="true" android:src="@drawable/clear" android:layout_below="@+id/citybox" android:layout_alignParentLeft="true" android:layout_height="95dp" /> <TextView android:id="@+id/temperaturenow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/imageview_forecast_info" android:fontFamily="sans-serif-light" android:text="@string/ricercacondition" android:layout_margin="1dip" android:textColor="#ff888888" android:textSize="15sp" /> <TextView android:id="@+id/temperatura" android:layout_width="match_parent" android:layout_height="wrap_content" android:fontFamily="sans-serif-light" android:text="" android:gravity="right" android:layout_alignParentRight="true" android:layout_marginRight="1dp" android:layout_marginLeft="5dp" android:layout_toRightOf="@+id/imageview_forecast_info" android:textColor="#ff888888"…
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23060730
has title: Flip a RelativeLayout onClick
downvote count: 0
score: 1
tagged with: java
favorite count: 0
type: Question

timer
tag name: timer
tags question: http://stackoverflow.com/q/22977536
tags question: http://stackoverflow.com/q/23094625
tags question: http://stackoverflow.com/q/23106824
tags question: http://stackoverflow.com/q/22977729
tags question: http://stackoverflow.com/q/23072754
tags question: http://stackoverflow.com/q/22969869
type: Tag
tags question: http://stackoverflow.com/q/22996276
tags question: http://stackoverflow.com/q/23105564
tags question: http://stackoverflow.com/q/23023730
tags question: http://stackoverflow.com/q/23042333
tags question: http://stackoverflow.com/q/23095690
tags question: http://stackoverflow.com/q/23035266
tags question: http://stackoverflow.com/q/23076245
tags question: http://stackoverflow.com/q/23023083
tags question: http://stackoverflow.com/q/23032740
tags question: http://stackoverflow.com/q/23073741
tags question: http://stackoverflow.com/q/22993657
tags question: http://stackoverflow.com/q/23054099

http://stackoverflow.com/comment/35081363
type: QuestionComment
has text: Still needs some tweaking, but yea it is pretty complex. When I get back to my desktop I will see if I can't find the algorithm for you to at least give you somewhere to start.
score: 0
comment on: http://stackoverflow.com/q/22973532
type: Comment

http://stackoverflow.com/comment/69095681
has text: I totally agree with Jules. a static method Stream.of(Iteratable iter) or Stream.of(Iterator iter) should be added, instead of StreamSupport.stream(iter.spliterator(), false);
type: Comment
comment on: http://stackoverflow.com/a/23177907
score: 18
type: AnswerComment

http://stackoverflow.com/q/23082230
upvote count: 12
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8330370
tagged with: java
has answer: http://stackoverflow.com/a/23082332
accepted answer: http://stackoverflow.com/a/23082332
possible better answer: http://stackoverflow.com/a/23082309
type: Question
score: 10
has title: Java Generic argument extends A or B
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/23082309
tagged with: generics
has body: In Java, we have generics and Generic arguments may be specified to have to extends/implement a certain class/interface. class MyClass&lt;T extends Number&gt; One can also specify that it has to implement several interfaces class MyClass&lt;T extends Number &amp; Comparable&gt; My question is; how can I specify that a generic argument must extend one of two classes? Class MyClass&lt;T extends JComponent OR JFrame&gt; What I have is a Propery class, which at this time look like this. public abstract class Property&lt;T&gt; { public abstract void set(JComponent component, T value); public abstract void set(JFrame component, T value); public abstract T get(JComponent component); public abstract T get(JFrame component); public static Property&lt;Integer&gt; HEIGHT = new Property&lt;Integer&gt;() { @Override public void set(JComponent component, Integer value) { component.setSize(component.getWidth(), value); } @Override public Integer get(JComponent component) { return component.getHeight(); } @Override public void set(JFrame component, Integer value) { component.setSize(component.getWidth(), value); } @Override public Integer get(JFrame component) { return component.getHeight(); } }; public static Property&lt;Integer&gt; WIDTH = new Property&lt;Integer&gt;() { @Override public void set(JComponent component, Integer value) { component.setSize(value, component.getHeight()); } @Override public Integer get(JComponent component) { return component.getWidth(); } @Override public void set(JFrame component, Integer value) { component.setSize(value, component.getHeight()); } @Override public Integer get(JFrame component) { return component.getWidth(); } }; ... } Although, more properties, like BACKGROUND_COLOR, and LOCATION. The problem really starts here, as you may be able to se the duplicate code for every property, but it gets worse in the Animation class: public class Animation { public static void callbackAnimation(AnimationCallback callback, double duration, double fps) …
favorite count: 0
duplicate of: http://stackoverflow.com/q/8330370

http://stackoverflow.com/comment/35347363
comment on: http://stackoverflow.com/q/23120644
score: 0
type: Comment
type: QuestionComment
has text: Do you need to wait the LongRunningTask to complete or can't you just wrap it up in a new Thread?

http://stackoverflow.com/q/23008336
tagged with: java
tagged with: javadoc
has comment: http://stackoverflow.com/comment/35143057
linked to: http://stackoverflow.com/q/5915992
answer count: 1
downvote count: 0
favorite count: 0
has body: I want to create a link in Java-Doc for my methods and classes. Some methods use objects of another class. So I want to specify the link in the Java-Doc so that when user clicks on it, it'll open that class directly. I've tried with anchor &lt;a&gt; tag inside comment, but it dosent work. How to do it?
has answer: http://stackoverflow.com/a/23008348
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23008348
upvote count: 1
has title: How to create link in Java-Doc?
type: Question
score: 1

http://stackoverflow.com/q/23015780
has comment: http://stackoverflow.com/comment/35156672
has title: Should I put <?> for the generic type?
has answer: http://stackoverflow.com/a/23015892
score: 0
linked to: http://stackoverflow.com/q/2770321
has answer: http://stackoverflow.com/a/23015896
has body: Consider this snipped code: public class MaxSizeHandler extends AbstractValueHandler&lt;Collection&gt; { } and I use eclipse, and It warns me to add infer generic arguments type for Collection and the code changes like this: public class MaxSizeHandler extends AbstractValueHandler&lt;Collection&lt;?&gt;&gt; { } My question is what's the problem if I don't put it, or what's the advantage if I put it?
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/23015865
has answer: http://stackoverflow.com/a/23016145
tagged with: java
type: Question

http://stackoverflow.com/comment/35119566
has text: In addition to both of those, `context` should be an `Activity`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22995095
score: 0

http://stackoverflow.com/a/22982719
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22980579
has comment: http://stackoverflow.com/comment/35099715
answers question: http://stackoverflow.com/q/22980579
score: 0
type: Answer
has body: Your render attribute needs only @form &lt;r:commandButton action="#searchCriteriaSession.clearSearchCriteria}" value="Reset" render="@form" /&gt;

http://stackoverflow.com/q/22979647
accepted answer: http://stackoverflow.com/a/22980178
tagged with: java
type: Question
has title: Download and save a zip file from httppost response as binary data in ANDROID
answer count: 2
has answer: http://stackoverflow.com/a/22980178
tagged with: binary-data
has body: Thanks in advance.. First, I'm asking this for android. I have to send a http post request with a zip file containing an xml file having list of names in it. now, according to the list of name I sent, the server will send me the binary data of a zip file and I have to save that binary data (response) as a zip file. the problem is, when I'm saving this binary data as a zip file, it is not able to extract the zip then. I think this could be some character set problem too.. that i need to convert the received binary data to some character set and then save it as a zip.. please Help me in this, I'm new to android. and any ASYNC task example for doing the same will be great Help. This is my code.. private class sendMissingImagesToServer extends AsyncTask&lt;String, Integer, byte[]&gt; { @Override protected byte[] doInBackground(String... params) { String uri = params[0]; try { MultipartEntityBuilder entity; File f; FileBody fb; entity = MultipartEntityBuilder.create(); entity.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); f = new File(zipImageFile); fb = new FileBody(f); entity.addPart("orderFile", fb); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(uri); Log.e("Uploload Missing Image URL", "" + uri); httppost.setEntity(entity.build()); HttpResponse response = httpclient.execute(httppost); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); StringBuffer stringBuffer = new StringBuffer(); // byte[] fileBites=null; String line = ""; while ((line = bufferedReader.readLine()) != null) { stringBuffer.append(line); } bufferedReader.close(); // fileBites=stringBuffer.toString().getBytes(); // Log.e("FILE BITES", fileBites+"=&gt;"+fileBites.length); ByteArrayOutputStream bObj = new ByteArrayOutputStream(); bObj.reset(); bObj.write(stringBuffer.toString().getBytes()); return bObj.toByteArray(); // return stringBuffer.toString(); } catch (Exception e) { return e.toString().getBytes(); } } …
favorite count: 0
upvote count: 3
tagged with: android
possible better answer: http://stackoverflow.com/a/22980007
has answer: http://stackoverflow.com/a/22980007
tagged with: android-asynctask
tagged with: http://stackoverflow.com/tag/zip
downvote count: 0
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/35222021
type: QuestionComment
has text: I don't under the post you linked and it doesn't seem to answer my question. It is very generic and I can not apply it to my problem.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23051596

http://stackoverflow.com/q/23064292
tagged with: code-coverage
type: UnansweredQuestion
tagged with: java
tagged with: emma
type: Question
tagged with: tomcat
score: 0
answer count: 2
has body: I have done the following steps. Copied emma.jar into classpath Instrumented the code and got coverage.em Restarted server and checked the tomcat log(No suggestion of Emma collecting coverage data) Started doing some tests on the application Stopped tomcat, I get the below when I stopped tomcat. java.io.FileNotFoundException: coverage.ec (Permission denied) at java.io.RandomAccessFile.open(Native Method) at java.io.RandomAccessFile.&lt;init&gt;(RandomAccessFile.java:236) at com.vladium.emma.data.DataFactory.persist(DataFactory.java:656) at com.vladium.emma.data.DataFactory.persist(DataFactory.java:86) at com.vladium.emma.rt.RTCoverageDataPersister.dumpCoverageData(RTCoverageDataPersister.java:54) at com.vladium.emma.rt.RTExitHook.run(RTExitHook.java:32) at java.lang.Thread.run(Thread.java:701) Exception in thread "EMMA shutdown handler thread" java.lang.RuntimeException: EMMA failed to dump coverage data: java.io.FileNotFoundException: coverage.ec (Permission de at com.vladium.emma.rt.RTCoverageDataPersister.dumpCoverageData(RTCoverageDataPersister.java:71) at com.vladium.emma.rt.RTExitHook.run(RTExitHook at java.lang.Thread.run(Thread.java:701) Does Anyone know what step I am missing. I would greatly appreciate if anyone could help out. Thanks,
has answer: http://stackoverflow.com/a/23064402
has title: EMMA failed to dump coverage data: java.io.FileNotFoundException: coverage.ec (Permission denied)
has answer: http://stackoverflow.com/a/23653559

http://stackoverflow.com/a/23024699
type: Answer
has body: Try running this SQL query and change the tablename to your table name: UPDATE tablename SET `Keahlian` ='W', WHERE NIP=1 AND Nama='A' AND `Keahlian`='Z' this way you will only update the wanted row
score: 0
answers question: http://stackoverflow.com/q/23024643

http://stackoverflow.com/comment/35314506
score: 0
type: Comment
has text: @OlegArsyonov you do not have jdk installed?
comment on: http://stackoverflow.com/a/23034229
type: AnswerComment

http://stackoverflow.com/a/23143980
answers question: http://stackoverflow.com/q/23129212
score: 0
type: Answer
has body: FYI, here is some example code using Joda-Time 2.3. The bundled java.util.Date and .Calendar classes are notoriously troublesome, and should be avoided. Unlike a java.util.Date, a Joda-Time DateTime object has an assigned time zone. When specifying time zones, use a proper time zone name. Avoid the three or four letter codes as they are neither standardized nor unique. java.util.Date date = new java.util.Date(); // Has no time zone. Misnamed, as it contains both a date and a time portions. DateTimeZone timeZone = DateTimeZone.forID( "Asia/Karachi" ); DateTime dateTime = new DateTime( date, timeZone ); DateTime dateTimeUtc = dateTime.withZone( DateTimeZone.UTC ); DateTime fiveSecondsAgo = dateTime.minusSeconds( 5 ); java.util.Date date2 = fiveSecondsAgo.toDate(); Dump to console… System.out.println( "date: " + date ); System.out.println( "dateTime: " + dateTime ); System.out.println( "dateTimeUtc: " + dateTimeUtc ); System.out.println( "fiveSecondsAgo: " + fiveSecondsAgo ); System.out.println( "date2: " + date2 ); When run… date: Thu Apr 17 14:44:01 PDT 2014 dateTime: 2014-04-18T02:44:01.773+05:00 dateTimeUtc: 2014-04-17T21:44:01.773Z fiveSecondsAgo: 2014-04-18T02:43:56.773+05:00 date2: Thu Apr 17 14:43:56 PDT 2014

http://stackoverflow.com/a/23036991
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/35195902
has comment: http://stackoverflow.com/comment/35195670
has comment: http://stackoverflow.com/comment/35195897
has comment: http://stackoverflow.com/comment/35195656
has body: Word is defined by anything non whitespace character. And there is a character class for that: \S. Your regex should therefore be: private static final Pattern PATTERN = Pattern.compile("\\S+"); Note however that the definition of "word" you have is rather large; this will also include punctuation etc. As to your loop, it is correct, since when you have a match, the Matcher's .start() method will indeed contain the index at which the match has started. Taking your code and modifying it a little, this gives: String test = "this that and that"; Matcher matcher = PATTERN.matcher(test); while (matcher.find()) { System.out.println(matcher.start()); }
has comment: http://stackoverflow.com/comment/35195781
has comment: http://stackoverflow.com/comment/35195794
has comment: http://stackoverflow.com/comment/35195837
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23036971
has comment: http://stackoverflow.com/comment/35195707
has comment: http://stackoverflow.com/comment/35195751
has comment: http://stackoverflow.com/comment/35195752
answers question: http://stackoverflow.com/q/23036971
score: 3
has comment: http://stackoverflow.com/comment/35195738

http://stackoverflow.com/comment/35366969
has text: The server is on my mobile, so it is dynamic. I wanted to use the "NO-IP" service, but I thought I try it with the original IP first. Which ports are blocked?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23132091

http://stackoverflow.com/q/23045115
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/23045130
answer count: 1
has comment: http://stackoverflow.com/comment/35209932
has body: I'm trying to loop over a array of brickEnemies and if my condition is true then the brick should be removed from my array. I get the following error IndexOutOfBoundsException. How could I make my for loop keep going after i have removed an element? int lengthofBrickEnemies = brickEnemies.size(); for (int i = 0; i &lt; lengthofBrickEnemies; i++) { Brick brick = brickEnemies.get(i); int newPosition_X = brick.getPositionX() - SPEED; if (newPosition_X &gt; 0) { brick.setPositionX(newPosition_X); } else { brickEnemies.remove(i); } }
has title: Removing an element from ArrayList while looping over it
accepted answer: http://stackoverflow.com/a/23045130
has comment: http://stackoverflow.com/comment/35210217
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35209911
tagged with: java
linked to: http://stackoverflow.com/q/21646912
has comment: http://stackoverflow.com/comment/35209931
type: Question
tagged with: for-loop

http://stackoverflow.com/comment/35159775
has text: yes this is an academic exercise, here's the full question if it helps// A class Foo has a method boolean equals(Object o) that simply returns the answer of the test this == o. Create a subclass Bar so that after the declaration Bar b = new Bar(); the call b.equals(b) returns false. To make this problem difficult, you are not allowed to override the equals method inherited from the superclass Foo.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23017162

android-studio
tags question: http://stackoverflow.com/q/22998698
tags question: http://stackoverflow.com/q/23115751
tags question: http://stackoverflow.com/q/23054364
tags question: http://stackoverflow.com/q/23065842
tags question: http://stackoverflow.com/q/23080265
tags question: http://stackoverflow.com/q/23051981
tags question: http://stackoverflow.com/q/23032740
tags question: http://stackoverflow.com/q/23128208
tags question: http://stackoverflow.com/q/23056804
tags question: http://stackoverflow.com/q/22988376
tags question: http://stackoverflow.com/q/23073655
tags question: http://stackoverflow.com/q/23037732
tags question: http://stackoverflow.com/q/23030663
type: Tag
tags question: http://stackoverflow.com/q/22975408
tags question: http://stackoverflow.com/q/22996215
tags question: http://stackoverflow.com/q/23113668
tags question: http://stackoverflow.com/q/23002620
tags question: http://stackoverflow.com/q/23003618
tag name: android-studio

http://stackoverflow.com/comment/35134278
comment on: http://stackoverflow.com/a/23003375
type: Comment
has text: Thanks Niko, nailed it.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35287064
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23087031
type: Comment
has text: Hi Alexis, -*deleted previous comment for clarity*- I think I need the "playing of the tone" part to be in another thread so that I can play the tone, wait, then stop the tone. I assume I will be able to pass a boolean back that states whether the tone is playing at that time or not to handle the user response?

http://stackoverflow.com/comment/35209625
type: Comment
comment on: http://stackoverflow.com/a/23039278
type: AnswerComment
has text: @user3526114 Very strange... At first glance I can't see anything obviously wrong with your code, but I can take another look later. Did you try outputting the different resized images? Did they come out OK? BTW: You can probably increase performance significantly (and fix the bug) if you don't draw the four different images separately and then stamp them into the corners of a bigger one. Instead, just draw the final image directly! That way, you're also calculating averageRed (and so on) only once rather than 3 times.
score: 0

http://stackoverflow.com/q/23016209
tagged with: java
has answer: http://stackoverflow.com/a/23017646
has comment: http://stackoverflow.com/comment/35157532
has comment: http://stackoverflow.com/comment/35158501
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35158937
score: 0
accepted answer: http://stackoverflow.com/a/23017646
answer count: 1
favorite count: 0
has body: I have an exercise to make a "Find the number" game. One person insert a number that disappear and a second person insert numbers and gets Cold\Warm hints till he find the first person's number and get a message that reveal the number (in case second person didn't pay attention...). My problem is that I don't get error in Eclipse and the Android emulator crashes. Here is my xml <?xml version="1.0" encoding="utf-8"?> <requestFocus /> <TextView android:id="@+id/txtTry" android:layout_width="match_parent" android:layout_height="40dp" android:text="Guess the Number" /> And here is the class code (I try to make the code as simple as I can). public class ActivityPesah3 extends Activity{ protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_pesah3); final EditText txtNum = (EditText)findViewById(R.id.txtNum); final EditText txtFriend = (EditText)findViewById(R.id.txtFriend); Button btnFind = (Button)findViewById(R.id.btnFind); final TextView txtTry = (TextView)findViewById(R.id.txtTry); btnFind.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int a = Integer.valueOf(txtNum.getText().toString()); int b = Integer.valueOf(txtFriend.getText().toString()); txtNum.setVisibility(View.GONE); if (b == a+25 || a== a-25) { txtTry.setText("Cold"); }else if(b == a+10 || b== a-10){ txtTry.setText("Hot"); }else if(b==a){ txtTry.setText("Your friend number is: " + b); } } }); } }
has comment: http://stackoverflow.com/comment/35157739
tagged with: android
has comment: http://stackoverflow.com/comment/35157582
has comment: http://stackoverflow.com/comment/35158006
has title: Why the Android emu crashes?
upvote count: 1
downvote count: 1
tagged with: emulation
type: AnsweredQuestion

http://stackoverflow.com/q/23028512
type: UnansweredQuestion
tagged with: hibernate-mapping
has comment: http://stackoverflow.com/comment/35184334
has comment: http://stackoverflow.com/comment/35184415
score: 0
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/35183593
linked to: http://stackoverflow.com/q/11390445
has body: Consider the classes : Employee.java @Entity @Table(name = "EMPLOYEE") public class Employee { @Id @GeneratedValue @Column(name="employee_id") private Long employeeId; @Column(name="firstname") private String firstname; @Column(name="lastname") private String lastname; @Column(name="birth_date") private Date birthDate; @Column(name="cell_phone") private String cellphone; @ManyToOne @JoinColumn(name="department_id", insertable=false, updatable=false, nullable=false) private Department department; public Employee() { } public Employee(String firstname, String lastname, String phone) { this.firstname = firstname; this.lastname = lastname; this.birthDate = new Date(System.currentTimeMillis()); this.cellphone = phone; } public Department getDepartment() { return department; } public void setDepartment(Department department) { this.department = department; } public Long getEmployeeId() { return employeeId; } public void setEmployeeId(Long employeeId) { this.employeeId = employeeId; } public String getFirstname() { return firstname; } public String getLastname() { return lastname; } public Date getBirthDate() { return birthDate; } public String getCellphone() { return cellphone; } public void setFirstname(String firstname) { this.firstname = firstname; } public void setLastname(String lastname) { this.lastname = lastname; } public void setBirthDate(Date birthDate) { this.birthDate = birthDate; } public void setCellphone(String cellphone) { this.cellphone = cellphone; } } Department.java @Entity @Table(name = "DEPARTMENT") public class Department { @Id @Column(name="DEPARTMENT_ID") @GeneratedValue(strategy=GenerationType.IDENTITY) private Long departmentId; @Column(name="DEPT_NAME") private String departmentName; @OneToMany(cascade={CascadeType.ALL}) @JoinColumn(name="department_id") @IndexColumn(name="idx") private List<Employee> employees; public Long getDepartmentId() { return departmentId; } public void setDepartmentId(Long departmentId) { this.departmentId = department…
has comment: http://stackoverflow.com/comment/35184016
has title: Hibernate with Entities : Exception in thread "main" org.hibernate.exception.GenericJDBCException: Field 'department_id' doesn't have a default value
answer count: 0
has comment: http://stackoverflow.com/comment/35184724
tagged with: exception

http://stackoverflow.com/comment/35115115
has text: You are getting an error because you didn't give it anything to split by. See Documentation: http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#split(java.lang.String)
comment on: http://stackoverflow.com/q/22992681
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23127781
tagged with: java
has comment: http://stackoverflow.com/comment/35775235
upvote count: 1
type: Question
has title: Ant with Eclipse PDE successful build even with compilation errors
tagged with: ant
tagged with: headless-rcp
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35769481
downvote count: 0
favorite count: 0
tagged with: pde
has comment: http://stackoverflow.com/comment/35763791
has body: I'm using Ant to invoke Eclipse PDE Build to make a headless build of an RCP application. As I understand it PDE Build itself calls Ant to build the application, so we're essentially running an Ant build in Ant. The problem is this: when the PDE Build fails due to compilation errors from the Java compiler, the error is not propagated back to my parent Ant script that started the PDE Build. This means that the build is said to have been successful even though it wasn't. However it does fail properly when there are other errors, such as when a plugin is missing so that dependencies can't be resolved. This is the task that I call to build an Eclipse feature: &lt;target name="feature_build"&gt; &lt;exec executable="java" failonerror="true"&gt; &lt;arg value="-Xmx512m" /&gt; &lt;arg value="-jar" /&gt; &lt;arg value="${equinox.launcher}" /&gt; &lt;arg value="-application" /&gt; &lt;arg value="org.eclipse.ant.core.antRunner" /&gt; &lt;arg value="-buildfile" /&gt; &lt;arg value="${pde.build.dir}/scripts/build.xml" /&gt; &lt;/exec&gt; &lt;/target&gt; Am I doing something obviously wrong, or could this be a bug in PDE Build? I'm building for Eclipse E4 M5, and according to the build output the version of PDE Build is 3.9.0-v20131003-1506.
answer count: 0
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/35111263
comment on: http://stackoverflow.com/q/22990290
score: 0
has text: It created a WAR when I click in "Build and Clean". I do not use Maven, at this point I want to launch it manually by using `java -jar jarName` or something similar. I am using jetty for that now, I hope it works !
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35300870
type: QuestionComment
has text: A regex? What do you want to split, what are the expected parts. You need to be more specific.
comment on: http://stackoverflow.com/q/23094942
score: 0
type: Comment

http://stackoverflow.com/q/23083725
type: AnsweredQuestion
downvote count: 0
type: Question
has title: Elegant design for workflow with feedback mechanism
tagged with: oop
has comment: http://stackoverflow.com/comment/35279735
tagged with: java
has answer: http://stackoverflow.com/a/23936935
accepted answer: http://stackoverflow.com/a/23936935
tagged with: class
upvote count: 2
answer count: 1
tagged with: database-design
favorite count: 0
has body: I'm looking for a way to model my Java application code as good as possible, but I can't wrap my head around a good design. I'm trying to import data, process it into a database and send feedback afterwards. I'll also save the state of the import process as an entity in a database, because feedback about the process is an important factor. I came up with this design, but I don't feel good about it. public interface FeedbackService { void startingImport(); void fetchingDataSuccessful(int amountObjectsFetched); void fetchingDataUnsuccessful(Exception e); void addSuccessfulObjectProcess(Object processedObject); void addUnsuccessfulObjectProcess(Object processedObject); void processingDataSuccessful(int amountObjectsProcessed); void processingDataUnsuccessful(Exception e); void sendFeedback(); void finishImport(); } A big concern I have about this design, is that you have different states in which only certain functions can be called. I read somewhere that it's terrible design when your methods depend on calling other methods first. Also, this would call for the State design pattern, which might be overkill for what is basically an extended logging library. I tried to solve this problem by using the Template pattern, that way the workflow and the logging with their sequential dependencies are handled by the super class, while the sub classes can handle the data specific code (processing products, processing catalogs, etc). public void handle(){ registration.startImport(); try { int amount = fetchData(); registration.fetchingDataSuccessful(amount); try { for (Object o : getData()) { if (handleObject(o)) { registration.addSuccessfulObjectProcess(o); } else { registration.addUnsuccessfulObjectProcess(o); } } registration.processingDataSuccessful(getData().size()); } catch (DataHandlingException e) { registration.processingDataUnsuccessful(e); } } catch (DataFetchingException e) { registration.fetchingDataUnsuccessful(e); } registration.sendFeedback(); } fetchData(), getDat…
score: 2

http://stackoverflow.com/comment/126628534
has text: @JinKwon I was merely refering to the fact that `ZoneId.systemDefault()` may not necessarily return the timezon the OP was expecting: `My timezone is Europe/Oslo`. So they should use `ZoneId.of("Europe/Oslo")` instead as suggested in other answers. As for `ZonedDateTime.toInstant()` - its javadoc clearly explains the implementation: `This returns an Instant representing the same point on the time-line as this date-time. The calculation combines the local date-time and offset.`
type: Comment
score: 1
comment on: http://stackoverflow.com/a/40718909
type: AnswerComment

http://stackoverflow.com/comment/35176700
comment on: http://stackoverflow.com/q/23026118
score: 0
type: Comment
type: QuestionComment
has text: You want to reset the score for the Player or you do not want to reset the score for the player? I am confused as to what exactly you want to happen. You want to keep adding scores to the board so you can have duplicates?

http://stackoverflow.com/q/23106319
favorite count: 0
has title: How to change @autowired bean implementations in runtime?
downvote count: 0
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/23114299
type: Question
tagged with: spring-mvc
score: 1
tagged with: java
has body: I'm working on an Spring MVC 3.2 application deployed as an EAR with multiple web applications (WARS) that reuse many common data access and services beans, but can eventually provide a custom implementation for one or more services. Basically each web application is a variation of a common solution, with different UI experience and different business rules in some services. These services are implemented as diverse stateless and stateful beans with dependencies between them. The application has a parent-child structure of application contexts in place, so each web app has it's own context. An approximate idea is as follows: -dao |-services |-one-app-context |-one-servlet-context | |-two-app-context |-two-servlet-context To build this, I have followed instructions given in: http://docs.spring.io/spring/docs/3.2.x/javadoc-api/org/springframework/beans/factory/access/SingletonBeanFactoryLocator.html I'm using XML config + annotation based bean scanning, with default shared singleton bean scope instantiation. There is a global properties file and each web app has its own properties files with new properties or variations on global properties - e.g. different values or strings. Also, all dependencies to services are made through interfaces. My problem is that I'm forced to initialize a concrete implementation for each service to satisfy autowiring requirements when starting the shared context - but for a given web app, I'd like to use a different implementation or a new instance with different settings. EDIT @Prasad gave me a good practical reply - however I should have added the case where both controllers use the same implementation of a stateful service, but these are initialized with different settings/values - known only to each web layer package. I'd like to see a solution (if possible) where I use annotations/scanning and don't need to make instantiation acrobatics to get the right wiring - profiles perhaps? In the end, dependencies would look somehow like this: …
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/22995703
tagged with: applicationcontext

http://stackoverflow.com/a/23042486
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35205800
has comment: http://stackoverflow.com/comment/35257267
upvote count: 1
has comment: http://stackoverflow.com/comment/35279240
has comment: http://stackoverflow.com/comment/35209550
has body: You have to add the permission <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> instead of <uses-permission android:name="android.permission.BOOT_COMPLETED" /> for BOOT_COMPLETED. Checkout the documentation here. As far as I see everything else should be ok. p.s.: if you want to receive a broadcast event for incoming calls, use permission <uses-permission android:name="android.permission.READ_PHONE_STATE" /> and declare your intent filter with <action android:name="android.intent.action.PHONE_STATE" /> Check this nice tutorial for more.
downvote count: 0
answers question: http://stackoverflow.com/q/23042450

http://stackoverflow.com/q/23008467
accepted answer: http://stackoverflow.com/a/23011376
has comment: http://stackoverflow.com/comment/35143238
type: AnsweredQuestion
tagged with: java
tagged with: apache-storm
has title: "java.lang.OutOfMemoryError: unable to create new native thread" while running Storm topology
type: Question
tagged with: apache-kafka
has body: I'm using kafkaspout to read messages from kafka queue into storm topology, It was running fine for a last whole week, but from yesterday it was giving me below error saying Out of memory. I have checked all the memory related parameters and memory leakages in code but all seems to be fine, java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) ~[na:1.7.0_45] at java.lang.Thread.start(Thread.java:713) ~[na:1.7.0_45] at backtype.storm.util$async_loop.doInvoke(util.clj:421) ~[storm-core-0.9.0-rc3.jar:na] at clojure.lang.RestFn.invoke(RestFn.java:559) [clojure-1.4.0.jar:na] at backtype.storm.daemon.executor$eval9473$fn__9474.invoke(executor.clj:732) ~[na:na] at clojure.lang.MultiFn.invoke(MultiFn.java:167) ~[clojure-1.4.0.jar:na] at backtype.storm.daemon.executor$mk_executor$fn__9342.invoke(executor.clj:317) ~[na:na] at backtype.storm.daemon.executor$mk_executor.invoke(executor.clj:316) [na:na] at backtype.storm.daemon.worker$eval9968$exec_fn__6466__auto____9969$iter__9974__9978$fn__9979. invoke(worker.clj:360) [na:na] at clojure.lang.LazySeq.sval(LazySeq.java:42) [clojure-1.4.0.jar:na] at clojure.lang.LazySeq.seq(LazySeq.java:60) [clojure-1.4.0.jar:na] at clojure.lang.Cons.next(Cons.java:39) [clojure-1.4.0.jar:na] at clojure.lang.LazySeq.next(LazySeq.java:92) [clojure-1.4.0.jar:na] at clojure.lang.RT.next(RT.java:587) [clojure-1.4.0.jar:na] at clojure.core$next.invoke(core.clj:64) [na:na] at clojure.core$dorun.invoke(core.clj:2726) [na:na] at clojure.core$doall.invoke(core.clj:2741) [na:na] at backtype.storm.daemon.worker$eval9968$exec_fn__6466__auto____9969.invoke(worker.clj:360) [na:na] at clojure.lang.AFn.applyToHelper(AFn.java:185) [clojure-1.4.0.jar:na] at clojure.lang.AFn.applyTo(AFn.java:151) [clojure-1.4.0.jar:na] at clojure.core$apply.invoke(core.clj:601) [na:na] at backtype.storm.daemon.worker$eval9968$mk_worker__10024.doInvoke(worker.clj:329) [na:na] at clojure.lang.RestFn.invoke(RestFn.java:512) [clojure-1.…
has answer: http://stackoverflow.com/a/23011376
tagged with: memory
score: 0
answer count: 1

http://stackoverflow.com/comment/35174877
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23024851
score: 0
has text: @BhargavB - The answer to that is that you would need to solve a bunch of messy (and in some cases unsolvable) problems. IMO it is better not to try. Do it using JAR files instead. Redesign your UI. Choosing ".class" files from the filesystem in a FileChooser is a BAD IDEA.

http://stackoverflow.com/q/23052170
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35227705
tagged with: facebook-graph-api
favorite count: 0
type: UnansweredQuestion
tagged with: facebook
upvote count: 0
has title: Extracting user details from facebook page
tagged with: java
has body: I am extracting details from a page which I'm administering. I tried using jsoup to extract the links then from that extract names of users but it's not working. It only shows links other than user links. I tried extracting names from this link https://www.facebook.com/plugins/fan.php?connections=100&amp;id=pageid which is working quite well but does not works for this link https://www.facebook.com/browse/?type=page_fans&amp;page_id= Can anyone help me...Below is the code which I tried. doc = Jsoup.connect("https://www.facebook.com/browse/?type=page_fans&amp;page_id=mypageid").get(); Elements els = doc.getElementsByClass("fsl fwb fcb"); Elements link = doc.select("a[href]"); for(Element ele : link) { system.out.println(ele.attr("href")); } }
type: Question
tagged with: jsoup
has comment: http://stackoverflow.com/comment/35223644
score: -1
has answer: http://stackoverflow.com/a/23052364

http://stackoverflow.com/q/23074676
accepted answer: http://stackoverflow.com/a/23122630
tagged with: spring
upvote count: 4
tagged with: amazon-ses
possible better answer: http://stackoverflow.com/a/23074950
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/35305309
has comment: http://stackoverflow.com/comment/35284822
tagged with: java
has answer: http://stackoverflow.com/a/23122630
tagged with: integration-testing
type: Question
answer count: 2
has body: Ok, I know that this sounds simple from the title but it really has me stumped as to why this might be occurring. So, I'm using Spring Batch to generate emails to be sent using Amazon's Simple Email Service. Inside my CustomItemProcessor, I am using @Autowired to wire in my AmazonEmailService service as normal. The AmazonEmailService class implements my EmailSender interface. The AmazonEmailService has an @Autowired AmazonSimpleEmailServiceClient that it uses to actually call the Amazon Simple Email Service to do things. My AmazonSimpleEmailServiceClient bean is defined in my root-servlet.xml: All this works fine. My problem is that when I run my Spring Batch Job integration tests. They hang when trying to send an email. My logging shows that execution just stops at the call to amazonSimpleEmailServiceClient.send(emailRequest) and doesn't proceed. The thing that has me absolutely flummoxed is that if I run the unit tests for the AmazonEmailService prior to running the integration test for my Spring Batch Jobs, then everything completes successfully. I want to know why this is the case. Its worth mentioning that the batch job that actually sends the emails has a TaskExecutor running on a single thread. The integration test for the Spring Batch job, is supposed to verify that the job is successfully generating an email for every input it receives and that those emails can be sent using Amazon SES. It also tests that it is correctly reading and writing objects to queues that are setup, but that isn't relevant to my issue. The unit test for the AmazonEmailService just sends out 3 emails to the Amazon email simulator. I'll post an abridged class diagram below so you can see how things stick together. The EmailService interface is my own interface. The AmazonEmailService is my own service. This service actually performs the sending of the emails using the AmazonSimpleEmailServiceClient which is an object that was given to me by Amazon. The CustomItemProcessor is my own ob…
has comment: http://stackoverflow.com/comment/35273817
has answer: http://stackoverflow.com/a/23074950
tagged with: spring-batch
has title: Integration Test for Spring Batch Job failing
has comment: http://stackoverflow.com/comment/35271638
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35271113

http://stackoverflow.com/comment/49233714
has text: http://stackoverflow.com/questions/2764394/ideal-way-to-set-global-uncaught-exception-handler-in-android/
comment on: http://stackoverflow.com/q/22978245
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23027305
has body: I'm trying to build a book ticket system but my code is not working properly, there is no error just the result I'm expected cannot get here is my code, can any tell me where is wrong with my code? public class Train { public static void book(){ int dest,sno; char[] seat1=new char [9]; Integer Tid=1; Scanner sc= new Scanner(System.in); Scanner sc2=new Scanner(System.in); for(int i=0; i&lt;9; i++) { seat1[i]='A'; } System.out.println("Where do you want to go?"); System.out.println("1. Main Entrerance to Night Safari"); System.out.println("2. Main Enterance to River Safari"); System.out.println("3. River Safari to Main Enterance"); dest=sc.nextInt(); if (dest==1 &amp;&amp; Tid !=null) { System.out.println("_1"+seat1[0]+"_|_2"+seat1[1]+"_|_3"+seat1[2]+"_"); System.out.println("_4"+seat1[3]+"_|_5"+seat1[4]+"_|_6"+seat1[5]+"_"); System.out.println("_7"+seat1[6]+"_|_8"+seat1[7]+"_|_9"+seat1[8]+"_"); System.out.println("Enter seat number to select seat:"); sno=sc.nextInt(); if(sno&gt;=1 &amp;&amp; sno&lt;=9) { if(seat1[sno-1]!='B') { seat1[sno-1]='B'; book();//here is working, it will go back again but when I re enter book(); and select dest1 agn it doesn't changed selected sno to B } else { System.out.println("Seat Already Booked, Choose Another "); book(); } } } else { System.out.println("Invalid Seat Number, Select Again "); book(); } } } the output is show as I expected like 1A|_2A_|3A _4A_|5A|_6A_ 7A|_8A_|9A but when I select a seat and return to it again, it didn't change the selected seat from A to B as I expected
tagged with: java
downvote count: 3
has title: JAVA if statement with array not working
answer count: 1
tagged with: if-statement
tagged with: arrays
score: -3
type: AnsweredQuestion
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23027425
type: Question
accepted answer: http://stackoverflow.com/a/23027425

http://stackoverflow.com/comment/35172863
type: QuestionComment
type: Comment
score: 0
has text: I am known by many things, understand what people tell me at first is not one of them. I had no idea how to fix the problem, but now I know how to ! Thanks for your patience !
comment on: http://stackoverflow.com/q/23012293

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/23066029
type: Tag

http://stackoverflow.com/a/23024925
score: 0
type: Answer
has body: Try this UPDATE table_name set Keahlian ='W', WHERE Keahlian='Z'. it will work fine, if the Keahlian is primary key.
answers question: http://stackoverflow.com/q/23024643

http://stackoverflow.com/q/23068020
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23068151
tagged with: jpanel
answer count: 2
has comment: http://stackoverflow.com/comment/35251995
downvote count: 0
accepted answer: http://stackoverflow.com/a/23068116
favorite count: 0
has body: I need to have three buttons in my program (the last one is an exit button and it already works) the other two need to change the color of the JPanel background between blue and red. I need to know what goes in the AtionListeners so that when the buttons are pressed it changes the background color. This is the class so far : package myPackageNameGoesHere; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JPanel; public class EventPanel extends JPanel { private static final long serialVersionUID = 123796234; private JButton blueButton; private JButton redButton; private JButton exitButton; public EventPanel() { this.setPreferredSize(new Dimension(200, 300)); this.blueButton = new JButton("Blue"); this.add(this.blueButton); this.redButton = new JButton("Red"); this.add(this.redButton); this.exitButton = new JButton("Exit"); this.exitButton.addActionListener(new ExitListener()); this.add(this.exitButton); } private class BlueListener implements ActionListener { @Override public void actionPerformed(ActionEvent blue) { // What goes here????? } } private class RedListener implements ActionListener { @Override public void actionPerformed(ActionEvent red) { // What goes here???? } } private class ExitListener implements ActionListener { @Override public void actionPerformed(ActionEvent exit) { System.exit(0); } } }
linked to: http://stackoverflow.com/q/4219919
has title: How do I change the background color of a JPanel with a JButton?
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/23068151
tagged with: jbutton
type: Question
has answer: http://stackoverflow.com/a/23068116
tagged with: actionlistener
type: AnsweredQuestion

digital-signature
tags question: http://stackoverflow.com/q/23092549
tags question: http://stackoverflow.com/q/23004397
tag name: digital-signature
type: Tag
tags question: http://stackoverflow.com/q/23095051

cglib
tags question: http://stackoverflow.com/q/23090350
tag name: cglib
type: Tag

http://stackoverflow.com/comment/35194945
score: 0
has text: Yep that was the problem, I was defining methods for my class, and then was calling ArrayLists which don't have those methods defined, sorry I'm still new to this
type: Comment
comment on: http://stackoverflow.com/q/23031886
type: QuestionComment

http://stackoverflow.com/q/23014928
score: 0
has answer: http://stackoverflow.com/a/23356419
type: UnansweredQuestion
has body: I am trying to work with a native library in java. The vendor provided me with the appropriate java file (can be found here under 'latest JNI implementation') Furthermore i have set -Djava.library.path="D:\*absolutePathToDLLFolder*" and I tried a relative path too, with the same result. Now when running my small app I get the following error: java.lang.UnsatisfiedLinkError: com.neurosky.thinkgear.ThinkGear.GetDriverVersion()I at com.neurosky.thinkgear.ThinkGear.GetDriverVersion(Native Method) at eu.expandable.mindwave.Start.main(Start.java:23) and here is my main-class: package eu.expandable.mindwave; import com.neurosky.thinkgear.ThinkGear; /** * * @author Andre */ public class Start { public static void main(String[] args){ System.out.println("Mindwave Test"); //testing if os is 32bit //otherwise it wont work (under windows) int arc = Integer.valueOf(System.getProperty("sun.arch.data.model")); if(arc != 32) { System.err.println("Sorry, only 32bit platforms are supported"); System.exit(0); } try { System.out.println("Mindwave Driver version: " + ThinkGear.GetDriverVersion()); }catch(UnsatisfiedLinkError e){ System.err.println("Are you sure the library is existing?"); System.out.println("Will exit now"); e.printStackTrace(); System.exit(-1); } System.out.println("Trying to build a connection..."); int connID = ThinkGear.GetNewConnectionId(); System.out.println("Done. Connection ID is: " + connID); System.out.println("Release connection"); ThinkGear.FreeConnection(connID); System.out.println("Connection is freed"); System.out.println("Exit"); } } I would consider my code as correct, but for some reason it still crashes. I am running under Windows 7 64bit and Java 8 (32bit).
has answer: http://stackoverflow.com/a/23356348
has title: JNI UnsatisfiedLinkError while everything seems fine
tagged with: java-native-interface
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/a/23035280
answers question: http://stackoverflow.com/q/23035218
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23035218
type: Answer
upvote count: 4
downvote count: 0
has body: You can access to it, using super: System.out.println(super.j); but you can use super inside the class A, so you can do something like this: public class A extends B { int j = 10; public void print() { System.out.println(super.j); } public static void main(String[] args) { A obj = new A(); System.out.println(obj.j); // 10 obj.print(); // 15 } }
score: 4

http://stackoverflow.com/comment/126088712
type: AnswerComment
has text: mjaggard, I was unable to import org.eclipse.persistence.tools.weaving.jpa.StaticWeaveProcessor even after adding local jars as dependencies. Do you mind sharing code snippet of how you added jars to classpath?
comment on: http://stackoverflow.com/a/71238763
type: Comment
score: 0

http://stackoverflow.com/a/22985318
type: Answer
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/22985156
has comment: http://stackoverflow.com/comment/35105757
upvote count: 0
has comment: http://stackoverflow.com/comment/35104752
has comment: http://stackoverflow.com/comment/35105670
has body: Yes, it is possible in some manner.You can either use sqlite database present in android device to store various types of data in table form and data retreive from same. Another way is to use Parse cloud as a server or backend of your client application.It allows your app to run even when you are not connected to internet.It stores the data in cache memory with its api and then uploads data to the server cloud as soon as you get connected to Intenet. You can ask if you have any further queries. :)

http://stackoverflow.com/q/22986494
tagged with: swt
accepted answer: http://stackoverflow.com/a/23010429
has title: Jruby+swt. Can't execute the application on Amazon server
has body: I try to launch jruby application which use swt library on Amazon EC2 server (linux 32-bit) but get this error: NameError: missing class or uppercase package name (`org.eclipse.swt.widgets.Display') get_proxy_or_package_under_package at org/jruby/javasupport/JavaUtilities.java:54 method_missing at file:/tmp/jruby222146559887633660extract/jruby-core-complete-1.7.10.jar!/jruby/java/java_package_module_template.rb:14 Widgets at jar:file:/home/user/test.jar!/gems/swt-0.18/lib/swt/minimal.rb:12 Swt at jar:file:/home/user/test.jar!/gems/swt-0.18/lib/swt/minimal.rb:11 (root) at jar:file:/home/user/test.jar!/gems/swt-0.18/lib/swt/minimal.rb:6 require at org/jruby/RubyKernel.java:1083 (root) at jar:file:/tmp/jruby222146559887633660extract/jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1 require at jar:file:/tmp/jruby222146559887633660extract/jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55 require at org/jruby/RubyKernel.java:1083 (root) at jar:file:/home/user/test.jar!/gems/swt-0.18/lib/swt.rb:2 (root) at ./main.rb:2 load at org/jruby/RubyKernel.java:1099 (root) at jar:file:/tmp/jruby222146559887633660extract/jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1 require at org/jruby/RubyKernel.java:1083 require at jar:file:/tmp/jruby222146559887633660extract/jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:135 (root) at file:/home/user/test.jar!/META-INF/main.rb:1 error: org.jruby.embed.EvalFailedException: (NameError) missing class or uppercase package name (`org.eclipse.swt.widgets.Display') Does anyone already faced with this error?
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23010429
tagged with: linux
tagged with: jruby
answer count: 1

http://stackoverflow.com/comment/35351733
has text: @ Aire did you follow the comment by Jesper in the accepted answer
type: Comment
comment on: http://stackoverflow.com/a/23123813
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35252233
score: 0
comment on: http://stackoverflow.com/q/23067851
type: Comment
type: QuestionComment
has text: there is no exceptions on exit, I think it remains somewhere on the memory

http://stackoverflow.com/a/22987960
accepted answer of: http://stackoverflow.com/q/22987623
type: AcceptedAnswer
downvote count: 0
score: 5
type: Answer
has body: There is a saying: A man with a clock knows the time; a man with two clocks is forever uncertain... There are a host of issues synchronizing deveices with milisecond accurracy: network latency, different per-device dates, different delays in devices starting these tasks... I'd suggest using Tim's method, but first poll the devices 2-3 times to find out a) their network latency, b) their local time poll the devices with a dummy task you want to execute (play a 0-length sound f.e. if you want to play sounds), and find out that delay send to each device its own time to start based on the above.
answers question: http://stackoverflow.com/q/22987623
upvote count: 5

http://stackoverflow.com/comment/35262074
type: Comment
has text: Classic tail recursion, meaning you shouldn't write it as recursion but as a simple loop. (A good compiler may save you from this mistake, or may not.)
comment on: http://stackoverflow.com/q/23073284
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35318195
type: Comment
type: QuestionComment
score: 1
has text: Good to hear you found it. Please can you also post your solution as an answer to help other users with the same kind of problem?
comment on: http://stackoverflow.com/q/23083583

http://stackoverflow.com/comment/35084197
comment on: http://stackoverflow.com/a/22974519
type: Comment
has text: @user3517167, That is an unrelated issue. I'll update in an hour or two. Currently on a phone.
score: 1
type: AnswerComment

http://stackoverflow.com/a/23156064
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23097037
answers question: http://stackoverflow.com/q/23097037
has body: It turns out I must of accidently deleted c:\windows\system32 from the PATH variable and so it could not find the cmd command. Added the path c:\windows\system32 back in and I no longer receive the Ant error.

http://stackoverflow.com/comment/35215314
score: 0
has text: @Monica `IPrintPanelActivity` is an Activity class and you have a constructor for the same. get rid of it. Well i still not sure what you want.
type: Comment
comment on: http://stackoverflow.com/q/23047716
type: QuestionComment

http://stackoverflow.com/a/23079176
has comment: http://stackoverflow.com/comment/35294159
has comment: http://stackoverflow.com/comment/35276141
upvote count: 1
has comment: http://stackoverflow.com/comment/35272800
has comment: http://stackoverflow.com/comment/35274704
has comment: http://stackoverflow.com/comment/35274134
type: Answer
has comment: http://stackoverflow.com/comment/35272559
has comment: http://stackoverflow.com/comment/35276253
has comment: http://stackoverflow.com/comment/35272360
downvote count: 0
score: 1
has body: It is unclear what "non generic versions of binary search" you are talking about. If you are talking about the versions of binarySearch that take arrays of primitive types, it's because generics only apply to reference types, so a generic binary search method could not possibly handle arrays of primitive types. If you are talking about the versions of binarySearch that take Object[]: public static int binarySearch(Object[] a, Object key) public static int binarySearch(Object[] a, int fromIndex, int toIndex, Object key) How would they make it generic? Option 1: public static &lt;T&gt; int binarySearch(T[] a, T key) In this case, there is no benefit to making it generic. The following two method signatures would be equivalent -- any set of arguments that you can pass to one, you can pass to the other: public static int binarySearch(Object[] a, Object key) public static &lt;T&gt; int binarySearch(T[] a, T key) This is because 1) T can be chosen to be Object, so the generic version includes the non-generic version; and 2) any reference array type is a subtype of Object[], and any reference type is a subtype of Object, so the non-generic version includes the generic version. Since they are equivalent, and thus the T is useless, the simpler version (without the generic type parameter) is better. Option 2: they could have made it public static &lt;T extends Object &amp; Comparable&lt;? super T&gt;&gt; int binarySearch(T[] a, T key) but this would break compatibility with old code depending on it taking Object[] and Object (without any constraint on it being a type that is comparable to itself). APIs that take previously non-generic classes that now take a parameterized type do not break compatibility, because old code would still work with raw types. However, in this case, raw types do not help because arrays are reified both before and after generics.
has comment: http://stackoverflow.com/comment/35273765
has comment: http://stackoverflow.com/comment/35278076
has comment: http://stackoverflow.com/comment/35273470
answers question: http://stackoverflow.com/q/23056755

http://stackoverflow.com/q/23033782
has comment: http://stackoverflow.com/comment/35190668
has body: I must send datetime value from my app to API on hosting server and get all dates value later datetime (which was sent from app) from database table on my hosting to String and show it dates in Log. DB_Functions.php /** * Get dates from database */ public function getDate_of_upload_file($date_of_upload_file) { $result = mysql_query("SELECT * FROM docs WHERE created_at = '$date_of_upload_file_phone'") or die(mysql_error()); // check for result $no_of_rows = mysql_num_rows($result); if ($no_of_rows &gt; 0) { $result = mysql_fetch_array($result); } return $result; } index.php // Checking dates of documents if ($tag == 'date_of_documents') { $date_of_upload_file = $_POST['date_of_upload_file']; // check for documents $date_of_upload_file = $db-&gt;getDate_of_upload_file($date_of_upload_file); if ($date_of_upload_file != false) { // documents found // echo json with success = 1 $response["success"] = 1; $response["user"]["date_of_upload_file"] = $user["date_of_upload_file"]; echo json_encode($response); } else { // documents not found // echo json with error = 1 $response["error"] = 1; $response["error_msg"] = "Incorrect date_of_upload_file!"; echo json_encode($response); } } UserFunctions.java /** * Function to Get Date of Document **/ public JSONObject get_data_of_upload_file(){ // Building Parameters List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("tag", documents_tag)); params.add(new BasicNameValuePair("date_of_upload", date_of_upload)); JSONObject json = jsonParser.getJSONFromUrl(loginURL, params); return json; } Main.java @Override protected JSONObject doInBackground(String... args) { UserFunctions userFunction = new UserFunctions(); JSONObject json = userFunction.get_data_of_upload_file(); return json; }
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: mysql
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35190144
type: UnansweredQuestion
tagged with: android
has title: How can I get datetime value from MYSQL database on my hosting

http://stackoverflow.com/a/23134909
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23109181
downvote count: 0
has body: Check lib-gwt-file and maybe also upload4gwt.

http://stackoverflow.com/a/22992207
answers question: http://stackoverflow.com/q/22991726
has body: I would do it like this: class Box { private String color; public Box(String color) { this.color = color; } public void printAfter(Box previousBox) { System.out.print("\n color is " + color); if (previousBox != null &amp;&amp; previousBox.color.equals("green")) { System.out.print("and goes after a green box"); } } } Box previousBox; for(Box box : queue){ box.printAfter(previousBox); previousBox = box; } The decision about printing after green color is contained within Box object.
type: Answer
score: 0

http://stackoverflow.com/q/23083629
tagged with: java
has comment: http://stackoverflow.com/comment/35279655
has answer: http://stackoverflow.com/a/23084108
type: Question
has answer: http://stackoverflow.com/a/23083830
answer count: 2
upvote count: 0
tagged with: awt
tagged with: changelistener
accepted answer: http://stackoverflow.com/a/23083830
favorite count: 0
has title: Java: mouseClicked event not always firing
tagged with: mouselistener
downvote count: 2
has comment: http://stackoverflow.com/comment/35279755
has comment: http://stackoverflow.com/comment/35279797
tagged with: swing
has body: I have the following code to listen for mouseclicks, but it appears to not always fire. nameList.addChangeListener( new MouseAdapter(){ @Override public void mouseClicked(MouseEvent me) { nameListUpdated(); } } ); nameListUpdated() will run some of the times, but for whatever reason it seems that it will not run on every click like i want. Does anyone know why? Or is there more information to find the problem?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23084108
score: -2

http://stackoverflow.com/comment/35161831
has text: do you mean that this code: return pc.ValidateCredentials(strUsername_, strPassword_); will return false if the password is wrong ?
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/23013544
type: Comment

http://stackoverflow.com/q/23016224
tagged with: session
tagged with: java
tagged with: servlets
score: 0
upvote count: 1
downvote count: 1
answer count: 1
tagged with: jsp
has title: Session - servlets, in a sevlet i set a static variable to something and this remains the same for all the sessions
favorite count: 0
has comment: http://stackoverflow.com/comment/35157726
has answer: http://stackoverflow.com/a/23016442
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35158343
has body: i have a simple Jsp page that hits to servlet and in the servlet i call a method from another class and in this method i am declaring a static variable globally and setting a value to it and then the servlet's task is over so the control is back to the jsp page (or to a page that i forward the request and response to). so wat just happened is termed a session??? the value set to that static variable remains the same for all the sessions that are coming next!! why is this happening. dint the earlier session end ?? if it has ended, then why is the value for the static variable that i have set is still remaining like that only in my subsequent sessions?? please correct me if i am wrong. Help me to learn! stackoverflow has never let me down!!!! thanks in advance
has comment: http://stackoverflow.com/comment/35157864
has comment: http://stackoverflow.com/comment/35157603
linked to: http://stackoverflow.com/q/3106452
type: Question

http://stackoverflow.com/a/23127621
has comment: http://stackoverflow.com/comment/35359145
has comment: http://stackoverflow.com/comment/35359081
accepted answer of: http://stackoverflow.com/q/23127386
has comment: http://stackoverflow.com/comment/35358965
upvote count: 2
answers question: http://stackoverflow.com/q/23127386
has comment: http://stackoverflow.com/comment/35358896
type: AcceptedAnswer
has body: Mutate is spelled without the double tt. Your code will never mutate the last position because of the way you call random. The problem is substring(start, end) returns a string that does not include the end index character. So you're losing one character. The whole if block is unneeded as well. If you're trying to mutate, you could write a function like this: public void mutate() { Random rand = new Random(); int mutPos = rand.nextInt(valueString.length()); valueString = valueString.substring(0, mutPos) + rand.nextInt(10) + valueString.substring(mutPos+1); } Here's some tips: Given string "ABC". substring(1,2) returns "B", index 1 inclusive to index 2 exclusive. substring(0, string.length()) return whole string. substring(0) returns whole string. substring(i, i) returns "" Substring also returns "" if it starts (and ends) at index one past the last character (at string.length() index. This allows you to easily handle corner cases without if sentences as demonstrated in the code I wrote above.
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/35171076
comment on: http://stackoverflow.com/a/23018626
score: 0
has text: I hoped that was it. Back Monday.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35323940
comment on: http://stackoverflow.com/a/23108688
has text: Have you considered performance of your solution? I believe not.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23076905
score: 0
answers question: http://stackoverflow.com/q/23062079
type: Answer
has body: The error description org.omg.CORBA.TRANSIENT: initial and forwarded IOR inaccessible vmcid: IBM minor code: E07 is very vague and happens under many, not directly connected circumstances. In my case it had nothing to do with RMI/IIOP security settings, but it was a classpath problem. I was still using old version of com.ibm.ws.webservices.thinclient. Switching to thinclient 8.5.0, as well as setting the launch JRE to standard (Oracle) JVM has fixed the problem.

http://stackoverflow.com/a/22971675
type: Answer
has comment: http://stackoverflow.com/comment/35077773
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35077643
has body: This is not recursion. In a constructor, calling super(); calls the superclass constructor, not itself. If you were to say this(); inside that constructor, then the compiler would catch "recursive constructor invocation" as a compiler error.
answers question: http://stackoverflow.com/q/22971653
has comment: http://stackoverflow.com/comment/35077173
downvote count: 0

http://stackoverflow.com/a/23008737
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/35144435
has comment: http://stackoverflow.com/comment/35149486
has comment: http://stackoverflow.com/comment/35144301
has comment: http://stackoverflow.com/comment/35247153
answers question: http://stackoverflow.com/q/23008540
has body: You should use XWPFDocument instead of HWPFDocument. The documentation states: The partner to HWPF for the new Word 2007 .docx format is XWPF. Whilst HWPF and XWPF provide similar features, there is not a common interface across the two of them at this time. Change your code to: XWPFDocument doc = new XWPFDocument(new FileInputStream("...")); XWPFDocument doc2 = new XWPFDocument(new FileInputStream("...")); XWPFDocument doc3 = new XWPFDocument(new FileInputStream("..."));
upvote count: 2
type: Answer

http://stackoverflow.com/comment/35202358
type: Comment
type: QuestionComment
has text: can we see `UserController` (imports and around line 92)?
comment on: http://stackoverflow.com/q/23040620
score: 0

http://stackoverflow.com/comment/35089436
type: Comment
has text: You won't need the for loop, but something more like `if (buttonCounter == ROWS * COLUMNS) { // You win }`
score: 0
comment on: http://stackoverflow.com/a/22977502
type: AnswerComment

http://stackoverflow.com/comment/35114887
type: Comment
comment on: http://stackoverflow.com/a/22992641
type: AnswerComment
score: 0
has text: It does not really matter. It is just a bit cleaner IMO just to get what you need.

http://stackoverflow.com/q/23087527
has comment: http://stackoverflow.com/comment/35287376
type: Question
has body: I wrote a DAL following this guide. In particular this is my DALConfig.java configuration file package my.pack; import java.util.Properties; import javax.annotation.Resource; import javax.sql.DataSource; import org.apache.commons.dbcp2.BasicDataSource; import org.apache.commons.dbcp2.BasicDataSourceFactory; import org.hibernate.ejb.HibernatePersistence; import org.hibernate.jpa.HibernatePersistenceProvider; import org.springframework.beans.factory.annotation.Autowired; 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.context.annotation.PropertySources; import org.springframework.core.env.Environment; import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean; import org.springframework.data.repository.Repository; import org.springframework.orm.hibernate4.HibernateExceptionTranslator; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; @Configuration @ComponentScan(basePackages = { "my.pack" }) @PropertySource("classpath:dbconnection.properties") @EnableJpaRepositories("my.pack.repository") @EnableTransactionManagement public class DALConfig { private static final String PROPERTY_NAME_DATABASE_DRIVER = "db.driver_class"; private static final String PROPERTY_NAME_DATABASE_PASSWORD = "db.password"; private static final String PROPERTY_NAME_DATABASE_URL = "db.url"; private static final String PROPERTY_NAME_DATABASE_USERNAME = "db.username"; private static…
tagged with: jpa
downvote count: 0
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring
score: 2
tagged with: java
tagged with: hibernate
has title: Spring Data - NoSuchMethodError JpaRepositoryFactoryBean.setMappingContext()

http://stackoverflow.com/q/22993407
has body: Writing a class that reads n .csv file and creates the objects "Account". This is a test. Code: import java.io.File; import java.util.Scanner; import java.io.FileNotFoundException; public class AccountTest { public static void main(String[] args) throws FileNotFoundException { File file = new File("1234567890989.csv"); Scanner scanner; try { scanner = new Scanner(file); while(scanner.hasNext()) { scanner.nextLine(); scanner.next("Account"); String pp = scanner.next(); System.out.println(pp); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } File: Account Info - 14-03-2014 Account ;1234567890989 ; EUR ;POUPANCA ;SavingsAccount ; Start Date ;31-10-2013 End Date ;03-01-2014 Date ;Value Date ;Description ;Draft ;Credit ;Accounting balance ;Available balance 31-10-2013 ;31-10-2013 ;SUMMARY ;0.0 ;200.0 ;2600.0 ;2600.0 30-11-2013 ;30-11-2013 ;SUMMARY ;0.0 ;200.0 ;2800.0 ;2800.0 31-12-2013 ;31-12-2013 ;SUMMARY ;0.0 ;200.0 ;3000.0 ;3000.0 02-01-2014 ;02-01-2014 ;TRANSF ;0.0 ;300.0 ;3300.0 ;3300.0 02-01-2014 ;02-02-2014 ;TRANSF ;0.0 ;300.0 ;3600.0 ;3600.0 03-01-2014 ;03-01-2014 ;TRANSF ;0.0 ;300.0 ;3900.0 ;3900.0 Returns ';1234567890989' but I want to have only '1234567890989' and format it to Long.
tagged with: file
type: Question
tagged with: long-integer
possible better answer: http://stackoverflow.com/a/22993599
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/22993599
tagged with: string
has answer: http://stackoverflow.com/a/22993778
favorite count: 0
accepted answer: http://stackoverflow.com/a/22993621
has comment: http://stackoverflow.com/comment/35116462
has comment: http://stackoverflow.com/comment/35116095
type: AnsweredQuestion
tagged with: java.util.scanner
downvote count: 0
has comment: http://stackoverflow.com/comment/35116415
has answer: http://stackoverflow.com/a/22993621
has title: Using Scanner in Java
score: 1
tagged with: java

http://stackoverflow.com/q/23006536
tagged with: java
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35183450
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35141150
has answer: http://stackoverflow.com/a/23006634
has comment: http://stackoverflow.com/comment/35141324
has comment: http://stackoverflow.com/comment/35140964
score: 0
has comment: http://stackoverflow.com/comment/35139805
has title: Wireshark hex dump analyzer possible to do in Java?
tagged with: wireshark
has answer: http://stackoverflow.com/a/23007349
favorite count: 0
tagged with: hex
type: UnansweredQuestion
has body: I have a pcap file and I can view the hex and human-readable string equivalent of the hexdump using wireshark. However, I want to do the same but in Java. Here is a screenshot from Wireshark application. Taking the highlighted string, this is what i've come but the output is not what I've expect. Can someone help me? Thank you very much String hex = "a106020110020138"; byte[] bts = new byte[hex.length() / 2]; for (int i = 0; i &lt; bts.length; i++) { bts[i] = (byte) Integer.parseInt(hex.substring(2 * i, 2 * i + 2), 16); } String c = new String(bts, StandardCharsets.US_ASCII); System.out.println(c); This is the output:
has comment: http://stackoverflow.com/comment/35146791
has comment: http://stackoverflow.com/comment/35184994
has comment: http://stackoverflow.com/comment/35141224

http://stackoverflow.com/q/23061938
tagged with: sockets
has answer: http://stackoverflow.com/a/23072590
has title: Dynamic Java Socket server Port
has body: I am asked to build a server client chat application with dynamic ports Allocation ,my problem is that i can't retrieve the dynamic port from the client class , i tried several methods :Static members ,Singleton Design Patterns..but without success .Is there a method to do this ? This is my server Constructor : public Serveur() throws IOException{ listen=new ServerSocket(0); port=listen.getLocalPort(); System.out.println("Le serveur est demarre"); } when i acces the variable port from the client class ,it returns the next free port ,which is incorrect ,please Help!!
tagged with: ports
score: 0
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/35241126
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35241198
has comment: http://stackoverflow.com/comment/35241110
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/22996935
score: 3
answers question: http://stackoverflow.com/q/22996614
has body: Regardless of which encryption you use between the client and the server, there must be a point for the client where the data can be read. That is in the browser, which is exposed to javascript, and therefore to Firebug. Bson is bynary Json (http://bsonspec.org/), and, unless javascript reads and writes the stream by itself (without parsing it into a clear text object), you would fall into the same problem.
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/a/23068164
type: Answer
has comment: http://stackoverflow.com/comment/35252293
has comment: http://stackoverflow.com/comment/35252399
score: 2
downvote count: 0
upvote count: 2
has body: For your first example, try it out in your favorite IDE: public class Test { public static void main(String[] args) { ArrayList&lt;Integer&gt; foo = new ArrayList&lt;Integer&gt;(); for (int i=0; i &lt; 100; i++) { foo.add(i); } int i = 0; do while (i &lt; foo.size()) System.out.println("foo[" + i + "]=" + i++); } } You'll get a red squiggly (if using Eclipse) on the semi-colon at the end of: System.out.println("foo[" + i + "]=" + i++); Its an invalid construct per the Eclipse Java compiler (Sun's javac I can't say): Syntax error, insert "while ( Expression ) ;" to complete
answers question: http://stackoverflow.com/q/23068033

http://stackoverflow.com/q/23022244
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/2725102
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/28504480
has comment: http://stackoverflow.com/comment/35192075
upvote count: 2
tagged with: java
type: Question
has body: Currently I am designing how to deal with routing in a versioned rest API where the version is not part of the url, but sent via a header variable. I have considered/seen things like: Re-writing the url based on the header variable i.e. the request /orders {X-Media-Type: v1} would rewrite to /v1/orders and then we could have a @Path("/v1/orders") OrderV1Resource {} and thus making v2 would be trivial @Path("/v2/orders") OrderV2Resource {}. (my first preference) How to use a servlet filter in Java to change an incoming servlet request url? Having a Single @Path("/orders") OrderResource {} where each of it's methods have an injected HeaderParam and I could check the header variable and then decide which Order API implementation I wanted to use (which seems very messy to me) // pseudo-java code @Path("/orders") OrderResource { OrderV1Impl v1Impl; OrderV2Impl v2Impl; @GET public List&lt;Order&gt; findAll(@HeaderParam header) { version = header.get("accepts") if(version.equals("v1")) { return v1Impl.findAll() } else if(version.equals("v2")) { return v2Impl.findAll() } return error } } Or just bundling them up in seperated JARS and having a service look at the header and route to the correct version. (seems to make sense if the app grows to be really large)
has comment: http://stackoverflow.com/comment/45262880
has title: Dropwizard Multiple Rest API versions
score: 2
has answer: http://stackoverflow.com/a/28504480
tagged with: dropwizard

http://stackoverflow.com/q/23003874
has comment: http://stackoverflow.com/comment/35135148
has comment: http://stackoverflow.com/comment/35135171
tagged with: arrays
tagged with: string
has answer: http://stackoverflow.com/a/72286583
favorite count: 0
accepted answer: http://stackoverflow.com/a/23003938
has answer: http://stackoverflow.com/a/23003914
tagged with: arraylist
has body: I'm working on Java project - Playing Cards. And, in this Card.java class, I've declared and initialized variables and array list. I've come across this error. These errors are under each getter and setter methods. error: incompatible types: String cannot be converted to String[] error: incompatible types: int[] cannot be converted to int public class Card { // private String suit; //private String name; //private int value; private String[] suit = {"spades","hearts","clubs","diamonds"}; private String[] name = {"Ace","Jack","Queen","King"}; private int[] value = {1,2,3,4,5,6,7,8,9,10,11,12,13}; public Card(String s, String n, int v) { suit = s; name = n; value = v; } public String getSuit() { return suit; } public String getName() { return name; } public int getValue() { return value; } public String toString() { return "&lt;"+suit+" "+name+"&gt;"; } This is the whole class. Hope anyone knows and can help me out, thanks! (: If you don't understand what i'm trying to get at, let me know, try my best to explain
tagged with: int
has comment: http://stackoverflow.com/comment/35135260
upvote count: 4
possible better answer: http://stackoverflow.com/a/23004085
has answer: http://stackoverflow.com/a/23003938
has answer: http://stackoverflow.com/a/23004088
downvote count: 2
has answer: http://stackoverflow.com/a/23004037
has comment: http://stackoverflow.com/comment/35135108
has answer: http://stackoverflow.com/a/23004062
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23004055
tagged with: java
has title: JAVA - Error incompatible types: String cannot be converted to String[ ]
has answer: http://stackoverflow.com/a/23004085
type: Question
answer count: 8

http://stackoverflow.com/a/22987713
has comment: http://stackoverflow.com/comment/35106894
type: Answer
has comment: http://stackoverflow.com/comment/35107713
score: 20
upvote count: 20
has comment: http://stackoverflow.com/comment/35106259
answers question: http://stackoverflow.com/q/22987170
downvote count: 0
has body: Based on my testing, Tailer will only print a line when you've added a newline to the file. So try sudo echo "Hello\n" &gt;&gt; log.txt Also note that if you call create, you start a thread but have no handle on it. Hence why you had to have a while/true loop. You could try this instead: public static void main(String[] args) { TailerListener listener = new MyListener(); Tailer tailer = new Tailer(new File("log.txt"), listener, 500); tailer.run(); }

http://stackoverflow.com/a/22986788
accepted answer of: http://stackoverflow.com/q/22985892
score: 0
type: AcceptedAnswer
has body: All your publish-subscribe-channel should have apply-sequence="true". Of course, if you don't use custom correlation and release strategies. With apply-sequence="true" the Framework populates standard correlation MessageHeaders and they are stored in the Stack: the nested aggregator gets deal with correlation of its scope and pop them from stack to be ready for the outer aggregation. And the nested aggregator should send its result to the input channel of outer aggregator. For the last one it will look like just a result of a service.
type: Answer
answers question: http://stackoverflow.com/q/22985892

http://stackoverflow.com/comment/35190217
score: 0
has text: Without the full structure of your project and without the full pom files it's hard to guess what you are doing in your build.
comment on: http://stackoverflow.com/q/23026183
type: QuestionComment
type: Comment

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/23039311
tag name: android-actionbar
tags question: http://stackoverflow.com/q/22980313
tags question: http://stackoverflow.com/q/23026264

http://stackoverflow.com/comment/35217520
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23048997
score: 0
has text: Do you have 1 entry with a bunch of ---- or do you have multiple entries with --s? You want to remove any entry that is only -?

http://stackoverflow.com/q/22980564
type: UnansweredQuestion
tagged with: maven
tagged with: java
tagged with: google-docs
type: Question
has answer: http://stackoverflow.com/a/23070100
has title: how to add facility like google docs has in my project
answer count: 1
has body: I want to create maven project like compare to office docs with it syntax. So I think to download Google docs API. But I didn't find any link to download it. so any API that do this or download link and sample for achieve it using Google docs or other.
score: 0

http://stackoverflow.com/comment/35086170
comment on: http://stackoverflow.com/a/22976443
has text: Thanks a lot!!!! Currently iam a beginner in Java. Thanks for your help and your patience.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35260314
comment on: http://stackoverflow.com/a/23051688
has text: It should work if you're doing it right. Please show the code you've tried so I can review it.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22976378
score: 1
tagged with: java
has title: How do I serialize a complex Class in GWT?
answer count: 2
has answer: http://stackoverflow.com/a/22987070
downvote count: 0
tagged with: javascript
favorite count: 0
possible better answer: http://stackoverflow.com/a/22978087
has answer: http://stackoverflow.com/a/22978087
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/22987070
type: AnsweredQuestion
has body: I want to serialize the following class with AutoBeans. public class GetResults&lt;T extends Dto&gt; implements Result { List&lt;T&gt; results; protected GetResults() { } public GetResults(List&lt;T&gt; results) { this.results = results; } public List&lt;T&gt; getResults() { return results; } public void setResults(List&lt;T&gt; results) { this.results = results; } } Here is what I tried but failed: public class AutoBeanSerializer { private final AutoBeanFactory factory; public AutoBeanSerializer(AutoBeanFactory factory) { this.factory = factory; } public String &lt;T&gt; encodeData(T data) { AutoBean&lt;T&gt; autoBean = AutoBeanUtils.getAutoBean(data); return AutoBeanCodex.encode(autoBean); } public &lt;T&gt; T decodeData(Class&lt;T&gt; dataType, String json) { AutoBean&lt;T&gt; bean = AutoBeanCodex.decode(factory, dataType, json); return bean.as(); } } The above code does not work the line with public String encodeData(T data) { Has these errors: - T cannot be resolved to a type - The type String is not generic; it cannot be parameterized with arguments &lt;T&gt; How do I serialize the above class with abstract types in GWT?
upvote count: 1
type: Question
tagged with: gwt

http://stackoverflow.com/comment/35178766
comment on: http://stackoverflow.com/q/23027382
type: QuestionComment
type: Comment
has text: @fge He doesn't even need to call it, let alone check the result.
score: 0

http://stackoverflow.com/comment/35198115
score: 1
type: AnswerComment
has text: @user3482560: no, you should be the one to debug it and isolate the problem. This site really doesn't work well as a debug service.
type: Comment
comment on: http://stackoverflow.com/a/23038217

http://stackoverflow.com/q/23001374
possible better answer: http://stackoverflow.com/a/23004299
has title: How to use two different font sizes for button text in Android?
has comment: http://stackoverflow.com/comment/35131835
has answer: http://stackoverflow.com/a/23004299
has comment: http://stackoverflow.com/comment/35133868
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23008167
has comment: http://stackoverflow.com/comment/35135836
tagged with: android-layout
upvote count: 5
tagged with: java
score: 4
type: Question
has body: How could I implement a button background for ImageButton or Button which contains 2 textview each using different font sizes ? I can't use static images as background and I need to achieve this either using XML or programmatically. This is a numeric keypad and it carries a numeric value and a set of alphabets each of which uses different font sizes and needs to be set as button text. Here are some of the suggestions that pop-up on my brain but this seems to have limitations since I want to reuse the UI component and avoid code repetition. Create a layout XML containing 2 textfields and set that as background on the button. But how can I get a reference of these textview fields to set the value on them in the MyActivity.java? Use a layeredlist? Still same problem reference of textviews Or create a custom view and inflate layout mentioned in step 1. This solution resolves my problem. Does any other solution exist for this UI requirement?
linked to: http://stackoverflow.com/q/12048862
tagged with: textview
favorite count: 0
accepted answer: http://stackoverflow.com/a/23008167
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/79390812

controllers
tags question: http://stackoverflow.com/q/23048500
tag name: controllers
type: Tag

http://stackoverflow.com/a/23010034
score: 4
upvote count: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35146347
type: Answer
has body: Your Comparator is comparing Files, you are comparing Strings, hence passing an invalid generic type, which won't compile. You may not even need a Comparator passed to your sort method in this case, if you're using the default String lexicographic comparison. If your songList variable is an ArrayList&lt;HashMap&lt;String, String&gt;&gt; however, you would need to use a Comparator&lt;HashMap&lt;String, String&gt;&gt;, which to me sounds like a potential design issue.
has comment: http://stackoverflow.com/comment/35147023
has comment: http://stackoverflow.com/comment/35146613
answers question: http://stackoverflow.com/q/23009993
has comment: http://stackoverflow.com/comment/35146835
accepted answer of: http://stackoverflow.com/q/23009993
downvote count: 0

http://stackoverflow.com/a/23059982
type: Answer
accepted answer of: http://stackoverflow.com/q/23059688
has comment: http://stackoverflow.com/comment/35241265
upvote count: 4
has comment: http://stackoverflow.com/comment/35240112
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23059688
score: 4
has comment: http://stackoverflow.com/comment/35238253
has body: There are probably many ways of achieving the desired output. Assume you have an app.properties with default values that should get deployed with your application. Assume further, that you have many libraries to ship with your application, too. What we do in such a case is assembling a zip file with the following content: <root> | +--- lib/ | | | +--- [all your libraries here] | +--- application.jar (of course named as you want) | +--- app.properties There is maybe also a properties file for configuring your logging framework, which you could also place into the root directory. Your application.jar then correctly refers to all JARs and the root dir in the Class-Path section of its manifest file. This ZIP file can be assembled with the maven-assembly-plugin. At least, this is what we do. This could be done in an own project that only exists for this purpose. This project then contains the app.properties file with the defaults in a directory that you think is suitable. If you want to test your project by running main classes directly from your IDE (like we do with Eclipse), you can got with an app.properties in the src/test/resources directory. This will usually be on the class path while running from an IDE, but will not end up in the JAR file. And it also is on the class path when running tests. Does this fit your needs? EDIT as per the request: You should place the app.properties file into the project directory src/test/resources. This way, it will be in the class path when running main classes from the IDE (for testing purposes). This way it also will be in the class path of running tests with Maven. Second, you should not load the app.properties file with new File(...). Always use a class loader for this purpose, as this is the correct way to load resources in your program: ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL appResourceURL = loader.getResource("app.properties"); Note, that you don't provide a path (or package, or whatever) wh…

http://stackoverflow.com/comment/35336474
has text: This is a different IDE, but similar issue (Java issue after 10.9 upgrade) so it might provide some useful information: http://stackoverflow.com/questions/20075717/having-issues-with-android-studio-project-after-os-x-10-9-upgrade-error-with-ca, Specifically, "The problem seems to be a bad install of Java 1.6. When you upgrade to Mavericks, you normally have to reinstall Java 1.6 as it's not bundled with the OS as it was in previous OS X releases." (replace with your Java version)
comment on: http://stackoverflow.com/q/23115508
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35091181
comment on: http://stackoverflow.com/q/22979389
score: 0
type: Comment
type: QuestionComment
has text: Does the benchmark take into account the effects of disk cache and JIT compilation?

http://stackoverflow.com/comment/35157861
comment on: http://stackoverflow.com/q/23016274
score: 0
has text: Are you sure line 90 is s.hasNextLine()? Why doesn't Scanner.hasNextLine() appear in your stacktrace?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35089270
comment on: http://stackoverflow.com/a/22978248
type: Comment
type: AnswerComment
score: 0
has text: @user2748947 I edited it with a quick note about the logic you should take a look at.

http://stackoverflow.com/comment/35143930
type: AnswerComment
has text: Also how do I access the random values on other methods??
comment on: http://stackoverflow.com/a/23000529
type: Comment
score: 0

http://stackoverflow.com/q/23121353
upvote count: 4
tagged with: java-7
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/45206166
answer count: 5
has answer: http://stackoverflow.com/a/53188647
has answer: http://stackoverflow.com/a/23205663
accepted answer: http://stackoverflow.com/a/23205663
possible better answer: http://stackoverflow.com/a/40846993
type: AnsweredQuestion
tagged with: oracle-sqldeveloper
type: Question
has title: Cannot launch SQL Developer 4.0.1
tagged with: java
has body: Brand new machine, new install of SQL Developer (x64 w/out JRE), when I try to launch sqldeveloper.exe, it gets stuck at about 10%. What logs, if any, should I be looking at for errors? Version info: SQL Developer 4.0.1 JDK 1.7.0_55 Windows 7 Professional x64 I ran sqldeveloper64.exe, and hit Ctrl+Pause/Break when the launcher started hanging. This is the output: 2014-04-17 10:26:08 Full thread dump Java HotSpot(TM) 64-Bit Server VM (24.55-b03 mixed mode): "Flushing caches" prio=2 tid=0x000000000cf4b000 nid=0x2408 in Object.wait() [0x00000000104af000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x00000000ce69ea98> (a org.netbeans.Stamps$Worker) at org.netbeans.Stamps$Worker.run(Stamps.java:824) - locked <0x00000000ce69ea98> (a org.netbeans.Stamps$Worker) "Thread-3" daemon prio=6 tid=0x000000000cf4a000 nid=0x1d60 in Object.wait() [0x000000000e21f000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x00000000f2053220> (a java.util.LinkedList) at java.lang.Object.wait(Object.java:503) at java.util.prefs.AbstractPreferences$EventDispatchThread.run(AbstractPreferences.java:1476) - locked <0x00000000f2053220> (a java.util.LinkedList) "Framework Event Dispatcher" daemon prio=6 tid=0x000000000cf49800 nid=0x2744 in Object.wait() [0x000000000e07f000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x00000000f4043468> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread) at java.lang.Object.wait(Object.java:503) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.getNextEvent(EventManager.java:400) - locked <0x00000000f4043468> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:336) "State Saver" prio=6 tid=0x000000000cf48800 nid=0x265c in Object.wait() [0x000000000df0f000] j…
score: 4
has answer: http://stackoverflow.com/a/40846993
has answer: http://stackoverflow.com/a/43657524

http://stackoverflow.com/comment/35127581
type: Comment
type: QuestionComment
has text: @MadProgrammer, should make it an answer so I can accept.
comment on: http://stackoverflow.com/q/22999391
score: 0

http://stackoverflow.com/q/23117281
tagged with: alarmmanager
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35340514
tagged with: time
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23117501
has answer: http://stackoverflow.com/a/23117400
tagged with: java
has answer: http://stackoverflow.com/a/23117684
linked to: http://stackoverflow.com/q/4459058
has body: I have been trying to figure out how to get the current time in android and I would like to figure how to run a segment of code when the clock hits a certain time. Ultimately what I am trying to do is when the clock is 9:30 pm. Do something or run a piece of code. I have never dealt with time before on android or java.
type: Question
linked to: http://stackoverflow.com/q/2992882
has title: Android: Get system time and schedule a task

http://stackoverflow.com/comment/35102561
score: 0
has text: Okay, I stylize part of the question and the examples again.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22982570

http://stackoverflow.com/a/23067780
score: 0
answers question: http://stackoverflow.com/q/23065743
type: Answer
has body: I don't know about using swig but I do know that if you change your mind and want don't mind using JNI, then the following will work: On the C++ side: extern "C" jbyteArray JNIEXPORT Java_myPackageName_MyClassName_getByteArray(JNIEnv* env, jobject obj) { jbyteArray byte_arr = env-&gt;NewByteArray(size); jbyte bytes[25]; //Some byte array you want to give to java. Could be an unsigned char[25]. for (int i = 65; i &lt; 90; ++i) //filling it with some A-Z ASCII characters. { bytes[i - 65] = i; } env-&gt;SetIntArrayRegion(byte_arr, 0, 25, &amp;bytes[0]); //Fill our byte array return byte_arr; //return the byte array.. } on the Java side: package myPackageName; class MyClassName { static { System.loadLibrary("myByteArrayModule"); } public static native byte[] getByteArray(); }

http://stackoverflow.com/comment/35358735
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23127020
type: QuestionComment
has text: If he declared `read` (and other methods) without the exception then the following would hold true: `Reader r = new StringReader; r.read();` would require exception handling. `StringReader r = new StringReader;r.read();` would not require exception handling.

http://stackoverflow.com/comment/35354466
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23125418
has text: constructor for a Activity class? remove it.
type: Comment

http://stackoverflow.com/q/23048613
favorite count: 0
has comment: http://stackoverflow.com/comment/35216795
has comment: http://stackoverflow.com/comment/35216674
has answer: http://stackoverflow.com/a/23048674
type: UnansweredQuestion
has body: So ok here's the what's up. I need to create a method that accepts three variables as an argument (a, b, and c) and somehow swaps string c with string b which is in string a. This has to be done WITHOUT the replace methods as that's the point of creating this method. So examples would be "Hello my friend, how are you?", "h", "y" Result: "Yello my friend, yow are you?" or "Computer programming is great!", "great", "awesome" Result: "Computer programming is awesome!" We are given charAt(), string.substring, string.length(), and string.IndexOf() to solve this. Any ideas?
downvote count: 2
has comment: http://stackoverflow.com/comment/35216730
tagged with: regex
has answer: http://stackoverflow.com/a/23048734
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35216633
type: Question
has comment: http://stackoverflow.com/comment/35216698
has comment: http://stackoverflow.com/comment/35216652
score: -2
has title: How to swap strings within strings with other strings without replace methods
has comment: http://stackoverflow.com/comment/35216703
tagged with: replace
answer count: 2
tagged with: string
has comment: http://stackoverflow.com/comment/35216655

http://stackoverflow.com/q/22977986
has body: I was trying for face detection using opencv in java .My code to do it is : String CASCADE_FILE ="C:/Users/admin/Desktop/javacv/src/javacv/lbpcascade_frontalface.xml"; String OUT_FILE = "markedFaces.jpg"; IplImage origImg = cvLoadImage("C:/Users/admin/Desktop/javacv/src/javacv/lena.png", 1); //IplImage origImg = cvLoadImage(args[0]); // convert to grayscale IplImage grayImg = IplImage.create(origImg.width(),origImg.height(), IPL_DEPTH_8U, 1); cvCvtColor(origImg, grayImg, CV_BGR2GRAY); // scale the grayscale (to speed up face detection) IplImage smallImg = IplImage.create(grayImg.width()/SCALE,grayImg.height()/SCALE, IPL_DEPTH_8U, 1); cvResize(grayImg, smallImg, CV_INTER_LINEAR); // equalize the small grayscale IplImage equImg = IplImage.create(smallImg.width(),smallImg.height(), IPL_DEPTH_8U, 1); cvEqualizeHist(smallImg, equImg); // create temp storage, used during object detection CvMemStorage storage = CvMemStorage.create(); // instantiate a classifier cascade for face detection CvHaarClassifierCascade cascade =new CvHaarClassifierCascade(cvLoad(CASCADE_FILE)); System.out.println("Detecting faces..."); CvSeq faces = cvHaarDetectObjects(equImg, cascade, storage,1.1, 3, CV_HAAR_DO_CANNY_PRUNING); cvClearMemStorage(storage); // draw thick yellow rectangles around all the faces int total = faces.total(); System.out.println("Found " + total + " face(s)"); for (int i = 0; i &lt; total; i++) { CvRect r = new CvRect(cvGetSeqElem(faces, i)); cvRectangle(origImg, cvPoint( r.x()*SCALE, r.y()*SCALE ),cvPoint( (r.x() + r.width())*SCALE,(r.y() + r.height())*SCALE ),CvScalar.RED, 6, CV_AA, 0); String strRect = String.format("CvRect(%d,%d,%d,%d)", r.x(), r.y(), r.width(), r.height()); System.out.println(strRect); //undo image scaling when calculating rect coordinates } if (total &gt; 0) { System.out.println("Saving marked-faces version of " + " in " + OUT_FILE); cvSaveImage(OUT_FILE, origImg); } Where i kept the xml and the origImg on their specified locations.But it gives an exc…
score: 2
has title: Face detection using opencv giving an exception
upvote count: 3
tagged with: java
tagged with: image-processing
downvote count: 1
has answer: http://stackoverflow.com/a/22980670
type: Question
tagged with: javacv
answer count: 2
has answer: http://stackoverflow.com/a/33705852
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35128916
type: Comment
comment on: http://stackoverflow.com/a/23000037
has text: I did not use any other editor, and I edited the strings.xml using eclipse and in that xml file. When I go into an activity and type R.string then Crtl + space (which shows the possible strings), nothing shows up except this and class.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35163401
has text: Thank you so much for all this help! I did not expect such quick help! Thank you!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23019201
type: AnswerComment

http://stackoverflow.com/comment/35279001
type: QuestionComment
has text: Thank you very much problem is solved ,now i have another problem ,i have clear button in that i used to cleare the sharedpreference.cleared there but when i open activity shows privious data i used like this editor.clear(); editor.commit();
comment on: http://stackoverflow.com/q/23081003
score: 0
type: Comment

http://stackoverflow.com/a/23136190
type: Answer
has body: I'd recommend starting with Spring Boot which will handle all of that for you. As others have mentioned, pick a build tool (Maven or Gradle) and follow the guide we provide on building a batch application here: http://spring.io/guides/gs/batch-processing/.
score: 0
answers question: http://stackoverflow.com/q/23113674

http://stackoverflow.com/comment/35099773
has text: @MadProgrammer The main UI is a frame with toolbar and desktop pane to display internal frame. The components of the Internal frame for different classes are a table and 2 buttons. Kind of like a log report.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22981777
type: AnswerComment

http://stackoverflow.com/comment/35309650
has text: @TBM ActitivityInstrumentationTestCase2 is the main class which is used for testing different functionality in Robotium. So i have imported the class in this test. i dont know whether it has the same constructor. Please check this [link](http://www.cs.sfu.ca/CourseCentral/276/bfraser/other/TestAndroidSampleApp-3_0.pdf)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23100148
type: QuestionComment

http://stackoverflow.com/q/22969844
answer count: 1
has comment: http://stackoverflow.com/comment/35073905
favorite count: 0
score: -3
has comment: http://stackoverflow.com/comment/35075838
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22969868
tagged with: java
downvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/35074177
has comment: http://stackoverflow.com/comment/35074638
has title: Else If is not working
has body: else if statement doesn't work. Tells me. "Syntax error, delete the on token "if" delete this token" If i get rid of the "if" my guessed.add(goat) is unnreachable. I commented where in the code. I'm not sure what to try. package edu.htc.java1.phrasegame; import edu.htc.java1.phrasegame.model.*; import java.util.ArrayList; public class PhraseGameController { private Phrase currentPhrase; private ArrayList&lt;Character&gt; guessed; public boolean doPlayerGuess(Character play) { Character goat = Character.toUpperCase(play); if (guessed.contains(play)) { throw new IllegalStateException("the letter was already guessed"); } else if (String.valueOf(play).matches("[A-Z]")) { throw new IllegalStateException( "the guess should be a letter from A­Z"); guessed.add(goat); // Unreachable Code return currentPhrase.guessLetter(goat); return false; } } public PhraseGameController() { currentPhrase = new Phrase("This is only a test"); guessed = new ArrayList&lt;Character&gt;(); } public Phrase getCurrentPhrase() { return currentPhrase; } public void setCurrentPhrase(Phrase currentPhrase) { this.currentPhrase = currentPhrase; } public void setGuessed(ArrayList&lt;Character&gt; guessed) { this.guessed = guessed; } public ArrayList&lt;Character&gt; getGuessed() { return guessed; } }
has comment: http://stackoverflow.com/comment/35076032
has answer: http://stackoverflow.com/a/22969868
upvote count: 0

http://stackoverflow.com/a/71932470
has body: In summary YES. You can use the @Value to load the environment variables from the application.yml or application.properties Additionally, you can load variables and cast them automatically if you need different data types to perform your validations and business logic. server: address: ${OPENSHIFT_DIY_IP} port: ${OPENSHIFT_DIY_PORT} Load information @Value(&quot;${server.address}&quot;) private String serverAddress; @Value(&quot;${server.port}&quot;) private Integer serverPort;
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23027315

http://stackoverflow.com/comment/35316724
type: QuestionComment
type: Comment
score: 0
has text: _I don't want to show my URL in browser, since in am passing the id in it_ - this is a very bad design, security-wise. Just because the URL is not shown in the browser, it doesn't mean that it's not visible to the end-user.
comment on: http://stackoverflow.com/q/23102862

http://stackoverflow.com/a/23039118
has body: This can be helpful: http://docs.oracle.com/javase/tutorial/uiswing/components/list.html#creating Manipulating JList after declaring It's model can be very effective.
type: Answer
answers question: http://stackoverflow.com/q/23038978
score: 0

http://stackoverflow.com/q/23107807
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23108085
has title: SQL statement (Oracle) that selects rows from tbl NOT IN pattern (selected from joined tables)
has comment: http://stackoverflow.com/comment/35322320
score: 0
tagged with: oracle-database
tagged with: sql
accepted answer: http://stackoverflow.com/a/23108085
has comment: http://stackoverflow.com/comment/35322099
possible better answer: http://stackoverflow.com/a/23108046
has answer: http://stackoverflow.com/a/23108046
has body: I have two tables: tblAPARTMENT and tblRESERVATION. I want a list of all apartmentID's which are not in the reservation-table with those dates. I have tried: SELECT apartmentID, apartmentNAME FROM tblAPARTMENT NOT IN (SELECT apartmentID FROM tblRESERVATION WHERE tblRESERVATION.startDate &gt; _a-date_ AND tblRESERVATION.endDate &lt; _a-date_ I know there is a better way to write this, I just cant figure it out.
type: AnsweredQuestion

http://stackoverflow.com/comment/35190258
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23029983
type: QuestionComment
has text: @khmarbaise you really think that would be necessary?

http://stackoverflow.com/a/23113079
downvote count: 0
answers question: http://stackoverflow.com/q/23112507
has body: In general, you should only be deploying your internal artifacts to your internal Nexus. 3rd party artifacts should be obtained via your internal Nexus that acts as a Proxy Repository to the public Nexus repositories. These days, you can normally find most 3rd party artifacts in a public repository somewhere. When it comes to Maven, it uses what's called transitive dependencies, which in short means that if artifact A depends on artifact B and you create a new artifact that depends on A, you'll also depend on B. For this to work it's important that artifact A is built with Maven because the dependencies are captured at build time. The alternative is that you manually deploy the pre-built artifact, in which case the dependency information has been lost and you'll have to define it yourself by creating a pom for the 3rd party artifact. Assuming the dependencies are correct (you can list them with mvn dependency:list), when you build a WAR with Maven, all the compile and runtime dependencies will be included in the WEB-INF/lib directory.
type: Answer
has comment: http://stackoverflow.com/comment/35369601
upvote count: 2
score: 2

http://stackoverflow.com/a/23079210
upvote count: 1
downvote count: 1
has body: In the above case 1000 object will be created, string pooling will not work. On regarding the OutOfMemory error it depend on the memory configuration. When you create string as below only one object will be created. for(int i = 0; i&lt; = 1000 ; i++){ String s = "Hello"; }
type: Answer
has comment: http://stackoverflow.com/comment/35272153
answers question: http://stackoverflow.com/q/23078525
score: 0

http://stackoverflow.com/comment/79384444
type: AnswerComment
comment on: http://stackoverflow.com/a/23041574
type: Comment
has text: Classic explanation :)
score: 0

http://stackoverflow.com/q/22976440
tagged with: bluetooth
has comment: http://stackoverflow.com/comment/35287624
has title: BluetoothChat example tranmission errors when sending larger data
favorite count: 0
has body: I am trying to write an App for Android that exchanges data in between 2 phones. (Android 4.2.1 and 4.4.2) As a basis I used the BluetoothChat example from the android tutorial section. My problem is this: when writing larger amounts of data (>1kB) the receiving side often gets the wrong data. Sometimes it receives seemingly unrelated data, often it receives sections of many consecutive 0s, or sometimes it even receives parts that where received before in the same message. The way the transmissions are handled is as follows: First I send a 4 byte header, which provides the length of the following message and it's messagetype (just a single byte indicating how the message is to be understood by the program) Then the actual message. I used the ConnectedThread from the BluetoothChat but implemented as an AsyncTask, otherwise it is exactly the same apart from the receiving which is handled as follows: (and as mentioned above) //code inside the doInBackground() section, and enclosed in a while + try block byte[] header = new byte[4]; inputStream.read(header); int messagelength = readHeader(header); // readHeader is the function that analyzes the 4 bytes header byte[] message = new byte[messagelength]; inputStream.read(message); // read exactly that amount of bytes readMessage(message); // this function takes the byte[] and transfers it into whatever is needed. // in this example simply calling new String(message) and printing to the Log The sending side is exactly the same write(byte[] bytes) { outputStream.write(bytes); // I excluded the try/catch here } Testing multiple Strings and converting by simply calling string.getBytes(), resulted in: 130 byte String being transmitted correctly, 1443 byte String being transmitted correctly, 51948 byte String failing after about ~900 bytes. the Log would write the String correctly up until a point where it would only print the weird "question mark in a diamond" - symbol. The moment of failure is variable though. Is there a limit …
upvote count: 2
type: UnansweredQuestion
tagged with: android
score: 2
answer count: 0
tagged with: java
tagged with: stream
type: Question
downvote count: 0
tagged with: transmission

http://stackoverflow.com/comment/35104382
has text: NO sir , i dnt have to use any library . its a requirment.. i have to made it recursively
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22986975

http://stackoverflow.com/q/22989887
has comment: http://stackoverflow.com/comment/35110049
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35110034
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/9066288
type: Question
has body: I have read a lot about this problem on stackoverflow but any solution works for me. Could anybody please tell me why it's not working since I have described all children object properly - or maybe not ? This are my dependency for jackson <context:annotation-config/> org.codehaus.jackson jackson-mapper-asl 1.9.10 com.fasterxml.jackson.core jackson-annotations 2.3.2 Main class with my abstract object as property (MLMObject) public class MLMResponse { private int errorCode; private String errorMessage; private MLMObject object; public MLMResponse() { } public int getErrorCode() { return errorCode; } public void setErrorCode(int errorCode) { this.errorCode = errorCode; } public String getErrorMessage() { return errorMessage; } public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public MLMObject getObject() { return object; } public void setObject(MLMObject object) { this.object = object; } } abstract class implementation import com.fasterxml.jackson.annotation.*; @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value=Person.class, name="person"), }) public abstract class MLMObject { public MLMObject() { super(); } } Child class implementation import com.fasterxml.jackson.annotation.JsonTypeName; @JsonTypeName("person") public class Person extends MLMObject{ private String name; private String secondName; public Person() { super(); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSecondName() { return secondName; } public void setSecondName(String secondName) { this.secondName = secondName; } } and json text I'm going to read - this is only test for real message. String msg = "{\"errorCode\": 0,\"errorMessage\":\"\",\"object\":{\"type\":\"person\",\"name\":\"Jan\",\"secondName\":\"Jan\"}}"; I'm trying to read it with following code ObjectMapper objectMapper = new ObjectMapper(); MLMRespons…
accepted answer: http://stackoverflow.com/a/22990181
tagged with: jackson
answer count: 1
downvote count: 0
score: 8
favorite count: 0
upvote count: 8
has answer: http://stackoverflow.com/a/22990181
has title: Json and abstract class 'Can not construct instance'

http://stackoverflow.com/comment/35082064
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22973010
has text: Im sorry that still doesn't make sense to me, I am trying to figure out how to specify the location of the applicationContext.xml in the `@ContextConfiguration(locations = {})` annotation. Can you please explain how to do that?

list
type: Tag
tags question: http://stackoverflow.com/q/23015214
tags question: http://stackoverflow.com/q/22991725
tags question: http://stackoverflow.com/q/23112874
tags question: http://stackoverflow.com/q/23079930
tags question: http://stackoverflow.com/q/23081806
tags question: http://stackoverflow.com/q/23113106
tags question: http://stackoverflow.com/q/23043643
tags question: http://stackoverflow.com/q/23063410
tags question: http://stackoverflow.com/q/23045859
tags question: http://stackoverflow.com/q/23096368
tags question: http://stackoverflow.com/q/22972624
tags question: http://stackoverflow.com/q/23073807
tags question: http://stackoverflow.com/q/23118791
tags question: http://stackoverflow.com/q/23065814
tags question: http://stackoverflow.com/q/22997381
tags question: http://stackoverflow.com/q/23052259
tags question: http://stackoverflow.com/q/23073562
tag name: list
tags question: http://stackoverflow.com/q/23111649
tags question: http://stackoverflow.com/q/23103844
tags question: http://stackoverflow.com/q/22978307
tags question: http://stackoverflow.com/q/22989806
tags question: http://stackoverflow.com/q/23001189
tags question: http://stackoverflow.com/q/23029833
tags question: http://stackoverflow.com/q/22995619
tags question: http://stackoverflow.com/q/23049314
tags question: http://stackoverflow.com/q/23013685
tags question: http://stackoverflow.com/q/22987541
tags question: http://stackoverflow.com/q/23091752
tags question: http://stackoverflow.com/q/23104778
tags question: http://stackoverflow.com/q/22985429
tags question: http://stackoverflow.com/q/23005898
tags question: http://stackoverflow.com/q/22969067
tags question: http://stackoverflow.com/q/23036740
tags question: http://stackoverflow.com/q/23074847
tags question: http://stackoverflow.com/q/22975964

http://stackoverflow.com/q/23070438
has answer: http://stackoverflow.com/a/23070508
upvote count: 1
downvote count: 1
type: Question
has title: Creating a coordinate out of two ints Java
has comment: http://stackoverflow.com/comment/35256664
has answer: http://stackoverflow.com/a/23070472
has comment: http://stackoverflow.com/comment/35256687
has comment: http://stackoverflow.com/comment/35256622
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35256696
has comment: http://stackoverflow.com/comment/35256583
favorite count: 0
has comment: http://stackoverflow.com/comment/35256595
accepted answer: http://stackoverflow.com/a/23070472
has body: just a quick question. If i'm trying to instantiate an object which takes 3 ints, and 2 coordinates, why does eclipse complain when I do the following... private int x,y; private int x1, y1; public Objects(int xo, int yo, int zo, (int x1, int y1), (int x2, y2)){ this.(x,y) = (x1, y1); this.(x1,y1) = (x2, y2); }
has answer: http://stackoverflow.com/a/23070587
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35256580
has comment: http://stackoverflow.com/comment/35256599
possible better answer: http://stackoverflow.com/a/23070508
tagged with: java

http://stackoverflow.com/a/23039863
has comment: http://stackoverflow.com/comment/35201118
upvote count: 5
has body: To compare Strings containing timestamps you need to first parse them to long Long.parseLong(timestamp) and then compare numeric value using Long.compare(x,y). So try maybe with Collections.sort(yorList, yourOwnComparator) like Collections.sort(temp, new Comparator&lt;SMS&gt;() { @Override public int compare(SMS o1, SMS o2) { return Long.compare(Long.parseLong(o1.timestamp), Long.parseLong(o2.timestamp)); } }); If you can change type of timestamp to long this code could look like Collections.sort(temp, new Comparator&lt;SMS&gt;() { @Override public int compare(SMS o1, SMS o2) { return Long.compare(o1.timestamp, o2.timestamp); } }); In Java8 you can even use lambdas to shorten code even more Collections.sort(temp, (SMS o1, SMS o2) -&gt; Long.compare(o1.timestamp, o2.timestamp)); or even Collections.sort(temp, (o1, o2) -&gt; Long.compare(o1.timestamp, o2.timestamp));
has comment: http://stackoverflow.com/comment/35200855
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23039744
answers question: http://stackoverflow.com/q/23039744
type: Answer

twitter4j
tags question: http://stackoverflow.com/q/23037654
tags question: http://stackoverflow.com/q/23055407
type: Tag
tag name: twitter4j
tags question: http://stackoverflow.com/q/23037326

http://stackoverflow.com/a/23006665
answers question: http://stackoverflow.com/q/23005896
downvote count: 0
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35148703
has body: You are trying to execute something like this: NodeList list = (NodeList) XPathFactory.newInstance() .newXPath() .evaluate("/xml", "&lt;xml /&gt;", XPathConstants.NODESET); However, String is not a supported argument. The implementation expects a Node. Provide an InputSource: Reader xml = new StringReader("&lt;xml /&gt;"); InputSource src = new InputSource(xml); NodeList list = (NodeList) XPathFactory.newInstance() .newXPath() .evaluate("/xml", src, XPathConstants.NODESET); Assuming the XML is a file, supply a binary InputStream and let the XML parser detect the character encoding.
type: Answer

javascript
tags question: http://stackoverflow.com/q/23018796
tags question: http://stackoverflow.com/q/23097819
tags question: http://stackoverflow.com/q/23062268
tags question: http://stackoverflow.com/q/23054471
tags question: http://stackoverflow.com/q/23076242
tags question: http://stackoverflow.com/q/22976378
tags question: http://stackoverflow.com/q/23094452
tags question: http://stackoverflow.com/q/23077812
tags question: http://stackoverflow.com/q/23027175
tags question: http://stackoverflow.com/q/23090411
tags question: http://stackoverflow.com/q/23008757
tags question: http://stackoverflow.com/q/22993781
tags question: http://stackoverflow.com/q/23083606
tags question: http://stackoverflow.com/q/23038936
tags question: http://stackoverflow.com/q/23015492
tags question: http://stackoverflow.com/q/23102103
tag name: javascript
tags question: http://stackoverflow.com/q/22984284
tags question: http://stackoverflow.com/q/23041579
tags question: http://stackoverflow.com/q/22985727
tags question: http://stackoverflow.com/q/22970681
tags question: http://stackoverflow.com/q/22987560
tags question: http://stackoverflow.com/q/23074558
tags question: http://stackoverflow.com/q/23013115
tags question: http://stackoverflow.com/q/22986541
tags question: http://stackoverflow.com/q/23005822
tags question: http://stackoverflow.com/q/22988844
tags question: http://stackoverflow.com/q/23072623
tags question: http://stackoverflow.com/q/23031984
type: Tag
tags question: http://stackoverflow.com/q/23098478
tags question: http://stackoverflow.com/q/23066125
tags question: http://stackoverflow.com/q/23084165
tags question: http://stackoverflow.com/q/23023304
tags question: http://stackoverflow.com/q/23069839
tags question: http://stackoverflow.com/q/23093947
tags question: http://stackoverflow.com/q/22993282
tags question: http://stackoverflow.com/q/23032772
tags question: http://stackoverflow.com/q/23124361
tags question: http://stackoverflow.com/q/23023213
tags question: http://stackoverflow.com/q/23048048
tags question: http://stackoverflow.com/q/23110967
tags question: http://stackoverflow.com/q/23050430
tags question: http://stackoverflow.com/q/23089938
tags question: http://stackoverflow.com/q/22982246
tags question: http://stackoverflow.com/q/23053426
tags question: http://stackoverflow.com/q/23076169
tags question: http://stackoverflow.com/q/23055284
tags question: http://stackoverflow.com/q/23121059
tags question: http://stackoverflow.com/q/22977358
tags question: http://stackoverflow.com/q/23092549
tags question: http://stackoverflow.com/q/23038388
tags question: http://stackoverflow.com/q/23100392
tags question: http://stackoverflow.com/q/22986533
tags question: http://stackoverflow.com/q/22978025
tags question: http://stackoverflow.com/q/22996614
tags question: http://stackoverflow.com/q/22973051
tags question: http://stackoverflow.com/q/23119314
tags question: http://stackoverflow.com/q/22985846

http://stackoverflow.com/q/23023010
downvote count: 0
has body: I'm using Spring in a Java Web Application with Thymeleaf on standard HTML pages (not JSP). I have forms on several pages with several text inputs. I would like to reference some variable for maxlength on the text inputs. For example: Current: &lt;input id='name' type='text' maxlength='20' /&gt; Goal: &lt;input id='name' type='text' maxlength='${nameMaxlength}' /&gt; I would prefer to put these in a file somewhere that my Java code can access, so that the client-side and server-side validation can reference the same values. Are there any best practices for this sort of functionality?
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/35177238
favorite count: 0
has answer: http://stackoverflow.com/a/23031376
has title: Reference a variable on HTML pages across Java Web Application
has answer: http://stackoverflow.com/a/23031277
tagged with: spring
has comment: http://stackoverflow.com/comment/35185307
accepted answer: http://stackoverflow.com/a/23031376
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23031277
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: thymeleaf
answer count: 2

http://stackoverflow.com/comment/35132212
score: 0
type: Comment
has text: when you are in a fragment you need to get the activity to know the context, if you are using Activities you can change "getActivity()" for "this." or even discard it.
comment on: http://stackoverflow.com/a/23001179
type: AnswerComment

http://stackoverflow.com/q/23022863
type: Question
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/23249261
downvote count: 0
tagged with: sip
favorite count: 0
has body: I've been doing some research on Phonegap and Cordova, it seems there is no support for creating apps that have SIP and VOIP functionality since HTML5 and Javascript have little or no support for these protocols (webRTC and websockets are not yet supported on most mobile phone browsers). However I found out it is possible to create and use Plugins in order to use native functionality of the Operating Systems (iOS and Android in this case). My question is that, if for example I write native JAVA codes for my Android-Phonegap application, will I be able to use it as a plugin to stream audio and video in my Android-Phonegap application? what are the limitations of using a plugin (with native functionality) in Phonegap or Cordova? Most of the plugin codes I checked online had a "Result" in the end, does this effect streaming of Audio and Video? Thanks in advance.
answer count: 3
tagged with: android
accepted answer: http://stackoverflow.com/a/23249261
possible better answer: http://stackoverflow.com/a/25276030
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25276030
tagged with: cordova
has answer: http://stackoverflow.com/a/28634843
upvote count: 7
has title: Java SIP Plugin for Cordova or Phonegap for Audio and Video streaming

http://stackoverflow.com/q/22986039
has answer: http://stackoverflow.com/a/22986340
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22986190
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35102550
has body: The click of the button should make the current form invisible but nothing happens.Can anyone help me with this if(e.getSource = b5) { int r = JOptionPane.showConfirmDialog(null, "Exit", "Exit?", JOptionPane.YES_NO_OPTION); if(r == JOptionPane.YES_OPTION) { encoder cc= new encoder() // this is the frame i am currently working in cc.setVisible(false); // this should make the form invisible but that is not happening cc.dispose(); } } please help
has comment: http://stackoverflow.com/comment/35102614
has title: Unable to close one frame on the click of a button
accepted answer: http://stackoverflow.com/a/22986340
possible better answer: http://stackoverflow.com/a/22986190
tagged with: joptionpane
type: AnsweredQuestion

http://stackoverflow.com/a/22972944
has comment: http://stackoverflow.com/comment/35080906
score: 0
has comment: http://stackoverflow.com/comment/35079977
type: Answer
answers question: http://stackoverflow.com/q/22972647
accepted answer of: http://stackoverflow.com/q/22972647
has body: Well with a JLabel you can use an HTML superscript but JTextField does not do HTML. So if you don't need to take input, use a JLabel. It is as simple as " 123 ". You can still display some characters as superscript in a JTextField through some special UTF characters, the locations of which are: 2, 3, 1 in Latin-1 Supplement (\u00B2, \u00B3 and \u00B9). 0, 4-9 and some symbols in Superscripts and Subscripts. Wikipedia has a pretty complete looking list of other superscripts and subscripts at Unicode subscripts and superscripts#Other superscript and subscript characters. Some of what you are asking (like about extending the root symbol) seems a little too much to ask. A JTextField can't do that. I am sure there would be TeX/LaTeX/etc typesetting libraries for Java though if you want real mathematical notation.
has comment: http://stackoverflow.com/comment/35080675
type: AcceptedAnswer

http://stackoverflow.com/comment/35097854
type: QuestionComment
has text: That's because the Eclipse console uses a [monospaced font](http://en.wikipedia.org/wiki/Monospaced_font), whereas the `Label` doesn't. Have a look at [this](http://stackoverflow.com/questions/221568/swt-os-agnostic-way-to-get-monospaced-font) question to find out how to use a monospaced font in SWT.
comment on: http://stackoverflow.com/q/22983422
score: 0
type: Comment

http://stackoverflow.com/q/23041570
favorite count: 0
tagged with: exception
has answer: http://stackoverflow.com/a/23041614
type: UnansweredQuestion
downvote count: 0
tagged with: java
score: 7
has answer: http://stackoverflow.com/a/23041599
type: Question
has answer: http://stackoverflow.com/a/23041601
has title: Throw exception inside catch clause
has comment: http://stackoverflow.com/comment/35216477
upvote count: 7
has answer: http://stackoverflow.com/a/23041672
has body: I have two snippet of code : class PreciseRethrow { public static void main(String[] str) { try { foo(); } catch (NumberFormatException ife) { System.out.println(ife); } } static private void foo() throws NumberFormatException { try { int i = Integer.parseInt("ten"); } catch (Exception e) { throw e; } } } and : class PreciseRethrow { public static void main(String[] str) { try { foo(); } catch (NumberFormatException ife) { System.out.println(ife); } } static private void foo() throws NumberFormatException { try { int i = Integer.parseInt("ten"); } catch (Exception e) { throw new Exception(); } } } In second case I got compile error "Unhandled exception type Exception" when I throw new Exception () in catch clause. Can You explain me Why in first case everything is ok but in second i get compile error ? In both case I throw Exception but in second case i create new instance of exception (this in only difference beetwen this two examples). Thanks for help.
has answer: http://stackoverflow.com/a/23042119
answer count: 7
has answer: http://stackoverflow.com/a/23041603
has comment: http://stackoverflow.com/comment/35208243
has answer: http://stackoverflow.com/a/23041616

http://stackoverflow.com/comment/35099681
comment on: http://stackoverflow.com/q/22983715
score: 0
type: Comment
type: QuestionComment
has text: Ah. Now I see. Very bad design, I would say. You obviously are facing the problem, which is the problem, why overridable methods should never be called in constructors. There is no real way out.

http://stackoverflow.com/comment/35654169
score: 0
type: AnswerComment
has text: +1 for the help but it's still giving out the same error. I've updated my question by the command Intellij is trying to execute.
comment on: http://stackoverflow.com/a/23126396
type: Comment

http://stackoverflow.com/a/23014217
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/93557978
accepted answer of: http://stackoverflow.com/q/23012697
has body: Does this link help you? Anyway, you will need an account at Oracle. The categories are "core-libs" (components) and "java.time" (subcomponent). Am just curious, what would you like to change? UPDATE: I have now got a closer look. It seems the bug report website is not quite uptodate with Java 8, missing the possibility to specify the java.time-package. So I would instead try to choose the subcategory "java.util.*" or "JDK/JRE documentation, API, tutorials (doc)" dependent on the kind of your RFE. The categoriy should probably be "Java Platform Standard Edition (JDK/JRE)". And notice that you can only file bug reports or RFEs, but not request for changing the API in a backwards incompatible manner. Bug: A behavior that violates the specification. RFE: A feature that should be added to the product. Another idea: You can try to send an issue on Threeten/Github.
has comment: http://stackoverflow.com/comment/93539100
answers question: http://stackoverflow.com/q/23012697
has comment: http://stackoverflow.com/comment/93558651

http://stackoverflow.com/a/25585346
score: 149
answers question: http://stackoverflow.com/q/23057549
has comment: http://stackoverflow.com/comment/82542778
has body: List&lt;Integer&gt; intList = strList.stream() .map(Integer::valueOf) .collect(Collectors.toList());
upvote count: 149
has comment: http://stackoverflow.com/comment/88309370
type: Answer
has comment: http://stackoverflow.com/comment/41555349
downvote count: 0

http://stackoverflow.com/q/22968893
has answer: http://stackoverflow.com/a/23057585
score: 0
has body: I have maven project and assume it looks like that pom-parent --pom child1 --pom child2 In pom parent I have defined plugin configuration for surfire plugin in default build. In pom parent I have defined profile integration-test with surfire plugin but different configuration. In childs pom I override configuration of surfire plugin in default build(not in profile section), by adding combine.self in configuration tag default build(not in profile section). My question is if I run mvn clean install -Pintegration-test what configuration for surfire plugin on each level will be applyied? pom parent =>(default or that from profile?) pom pom child1 =>(profile configuration will be overrited by default childs configuration?) pom child2 => (same as for child1?)
has title: Override plugins configuration in poms.xml on a different level
type: AnsweredQuestion
tagged with: maven
accepted answer: http://stackoverflow.com/a/23057585
type: Question
tagged with: java
answer count: 1
tagged with: maven-3

http://stackoverflow.com/comment/35080471
has text: Well i am looking for a solution , that just passes the file name.
type: Comment
comment on: http://stackoverflow.com/q/22973135
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35341070
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23117622
has text: Not all exceptions are caused by bugs or programming faults. Consider SqlExceptions. You can't *fix* them.

http://stackoverflow.com/a/23071295
score: 0
has comment: http://stackoverflow.com/comment/35274243
answers question: http://stackoverflow.com/q/23071226
type: Answer
has comment: http://stackoverflow.com/comment/35258875
has comment: http://stackoverflow.com/comment/35258773
has comment: http://stackoverflow.com/comment/35271712
has comment: http://stackoverflow.com/comment/35258664
has body: The conditon to check the range is incorrect, it should be : if(date.after(startDate) &amp;&amp; date.before(endDate)){ // valid date } Your previous condition will return true if the date is less than startDate or if its greater than endDate which is the opposite of what you want.
has comment: http://stackoverflow.com/comment/35258980
has comment: http://stackoverflow.com/comment/35261086

http://stackoverflow.com/comment/35106745
score: 0
type: Comment
has text: The target path does not exist.
comment on: http://stackoverflow.com/a/22988462
type: AnswerComment

http://stackoverflow.com/q/23017844
has answer: http://stackoverflow.com/a/23027196
tagged with: liferay-6
has comment: http://stackoverflow.com/comment/35171495
accepted answer: http://stackoverflow.com/a/23027196
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jakarta-ee
has title: Build Failed in Liferay 6.2
tagged with: liferay
has comment: http://stackoverflow.com/comment/35161462
tagged with: ant
has comment: http://stackoverflow.com/comment/35176725
score: 0
possible better answer: http://stackoverflow.com/a/23517477
has comment: http://stackoverflow.com/comment/35176612
answer count: 2
has answer: http://stackoverflow.com/a/23517477
has body: I am getting Build Failed, while deploying the Portlets,Themes and Layouts in liferay 6.2 on ubuntu OS . The console messages are: The Build Failed Message on Console: BUILD FAILED /opt/scrum-6.2/plugins/layouttpl/20x80-layouttpl/build.xml:7: The following error occurred while executing this line: /opt/scrum-6.2/plugins/layouttpl/build-common-layouttpl.xml:5: The following error occurred while executing this line: /opt/scrum-6.2/plugins/build-common-plugin.xml:5: The following error occurred while executing this line: /opt/scrum-6.2/plugins/build-common.xml:47: The following error occurred while executing this line: /opt/scrum-6.2/plugins/build-common-ivy.xml:17: The specified destination is a directory Can any one help me?

http://stackoverflow.com/q/23101133
has comment: http://stackoverflow.com/comment/35310922
type: UnansweredQuestion
has body: I am setting ERROR_HOLDER in session attribute in Controller.And showing error message on Jsp, when i am coming back to same jsp page from other tab or jsp page.Error message is still showing their at jsp.But i want to remove that error message from jsp page when you come back other page. I tried with remove attribut on jsp but it didn't work. want to remove ERROR_HOLDERA from session once jsp page is display.
tagged with: java
has comment: http://stackoverflow.com/comment/35310955
type: Question
has answer: http://stackoverflow.com/a/23102038
has answer: http://stackoverflow.com/a/23101207
has title: How to remove session attribute for jsp page
score: 0
answer count: 2

http://stackoverflow.com/comment/35120356
comment on: http://stackoverflow.com/q/22995045
type: Comment
type: QuestionComment
score: 0
has text: The code is a sample/work in progress.

http://stackoverflow.com/comment/35348684
comment on: http://stackoverflow.com/q/23121963
type: QuestionComment
has text: it seems you dont have a password set for root user. If it is so, try sending a null string or `""` as the password.
score: 0
type: Comment

http://stackoverflow.com/a/22981000
downvote count: 0
answers question: http://stackoverflow.com/q/22980848
upvote count: 2
type: Answer
has body: In your case this might be good enough. But think of it as you want to do this to Strings longer than five characters... than it will be a very long if-statement and much more work to do. I'd rather suggest to use a loop, then you dont need to fix the length of your String. I.e. boolean sorted = true; for(int i = 0; i &lt; newStr.length()-1; i++){ if(newStr.charAt(i) &gt;= newStr.charAt(i+1)){ sorted = false; break; } } if(sorted){ System.out.println("In order"); }else{ System.out.println("NOT in order"); }
score: 2

http://stackoverflow.com/q/23011833
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23011982
score: 2
upvote count: 2
linked to: http://stackoverflow.com/q/3341563
tagged with: java
has answer: http://stackoverflow.com/a/23012143
tagged with: parameter-passing
has answer: http://stackoverflow.com/a/23011966
type: Question
has body: I have a peculiar business case where I am trying to pass parameters(both variables and arrays) from a java class to a servlet and invoke a servlet from the java class. What I did is, just made the parameters global assigned their values inside the java class and then invoked the servlet from the Java class. But this doesn't seem to be good idea. Hers is my sample code: /* Assigning all the variables and array values inside a java class */ JavaClass.java ... var1 = value1; var2 = value2; arr1 = {val1, val1, val3}; ... I am referring URLCOnnection in Oracle's documentation found here The thing is I m not understanding the way in which we can send the parameters. URL url = new URL("http://localhost:8080/ProjectCharterApproval2/CharterApprover"); URLConnection connection = url.openConnection() ; connection.setDoOutput(true); /** After this how should I pass parameter to the servlet as an input object or output object ? **/ Any help will highly be appreciated. Thanks in advance.
has title: java - passing parameter from a java class to a servlet
answer count: 3
downvote count: 0
tagged with: urlconnection
favorite count: 0

http://stackoverflow.com/q/23117824
type: Question
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/35660614
tagged with: stored-procedures
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/33269895
answer count: 1
tagged with: oracle10g
has body: Attempting to call a java stored function and get a java object back and convert it to an oracle type. This is a 10g database and we are using Java 1.4.2. ( I know upgrade is the answer, unfortunately I am constrained to this environment.) Code and errors listed below. Any help would be greatly appreciated. TestMapping.java public class TestMapping { public static TestObject getResponse(){ TestObject testObject = new TestObject(); testObject.setMyTestValue("TEST"); return testObject; } } TestObject.java import java.sql.SQLData; import java.sql.SQLException; import java.sql.SQLInput; import java.sql.SQLOutput; public class TestObject implements SQLData { private String myTestValue; private String sqlTypeName; public String getSQLTypeName() throws SQLException { return sqlTypeName; } public void readSQL(SQLInput stream, String typeName) throws SQLException { sqlTypeName = typeName; myTestValue = stream.readString(); } public void writeSQL(SQLOutput stream) throws SQLException { stream.writeString(myTestValue); } public String getMyTestValue() { return myTestValue; } public void setMyTestValue(String myTestValue) { this.myTestValue = myTestValue; } } Command Line: javac TestObject.java javac TestMapping.java loadjava -user user/pass@server:1521:instance -t -r TestObject.class loadjava -user user/pass@server:1521:instance -t -r TestMapping.class Oracle Type: create or replace type test_object as object( myTestValue varchar2(50)); Publish Java Function: create or replace FUNCTION test_mapping RETURN test_object AS LANGUAGE JAVA NAME 'TestMapping.getResponse() return TestObject'; Anonymous Block to Test: set serveroutput on; declare response test_object; begin response := test_mapping(); DBMS_OUTPUT.PUT_LINE('myTestValue : ' || response.myTestValue); end; Error: Error report: ORA-00932: inconsistent datatypes: expected a return value that is an instance of a user defined Java class convertible to an Oracle type got an object that could not be converted ORA-06512: at "USER…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35557998
tagged with: sql
score: 3
downvote count: 0
has title: Oracle Java Stored Function - ORA-00932: inconsistent datatypes
favorite count: 0

http://stackoverflow.com/comment/35214810
score: 0
type: Comment
has text: Ok I changed it now. So what should I do with the action listeners now?
type: AnswerComment
comment on: http://stackoverflow.com/a/23046409

http://stackoverflow.com/a/23109226
score: 0
has comment: http://stackoverflow.com/comment/35325532
answers question: http://stackoverflow.com/q/23108887
type: Answer
has comment: http://stackoverflow.com/comment/35354984
has body: You can use following simple line of codes. yourItems.remove(poss); yourAdapter.clear(); yourListView.setAdapter(yourAdapter);

http://stackoverflow.com/q/23046136
tagged with: java
has answer: http://stackoverflow.com/a/23047317
tagged with: authentication
type: Question
has body: I try this code to perform login to my app using fb. public class FacebookLogin2Activity extends BaseActivity { private String TAG = "MainActivity"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.facebook_login); Session session = Session.getActiveSession(); if (session != null &amp;&amp; session.isOpened()) { fetchUserDetails(session); } LoginButton authButton = (LoginButton) findViewById(R.id.authButton); authButton.setOnErrorListener(new OnErrorListener() { @Override public void onError(FacebookException error) { Log.e(TAG, "Error " + error.getMessage()); } }); // set permission list, Don't forget to add email authButton.setReadPermissions(Arrays.asList("basic_info", "email", "birthday")); // option A // Session.openActiveSession(this, true, new Session.StatusCallback() { // // // callback when session changes state // @Override // public void call(Session session, SessionState state, // Exception exception) { // fetchUserDetails(session); // } // }); // // option B // session state call back event authButton.setSessionStatusCallback(new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { fetchUserDetails(session); } } }); } private void fetchUserDetails(Session session) { Log.i(TAG, "Access Token" + session.getAccessToken()); Request.newMeRequest(session, new Request.GraphUserCallback() { @Override public void onCompleted(GraphUser user, Response response) { //some code } } }).executeAsync(); } but i get this error what should i check? {Session state:CLOSED_LOGIN_FAILED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[]}, appId:131390430364547} and I have verified Facebook developers has my android hash code in the website. public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activit…
tagged with: facebook-login
score: 0
answer count: 2
has title: facebook login fails: {Session state:CLOSED_LOGIN_FAILED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[]}, appId:131***64547}
tagged with: android
tagged with: facebook
has answer: http://stackoverflow.com/a/23046428
accepted answer: http://stackoverflow.com/a/23046428
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23047317

http://stackoverflow.com/comment/35249484
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23062569
has text: I've looked into JSONViews, but I'm not using a serializer, just JAX-RS annotations. From those annotations Enunciate constructs the docs, so I'm not really solving the initial problem.
score: 0

http://stackoverflow.com/q/23051903
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/14792374
accepted answer: http://stackoverflow.com/a/23062588
score: 0
has comment: http://stackoverflow.com/comment/35223585
upvote count: 1
answer count: 1
downvote count: 1
has body: I have read the questionHow can I create a singleton in Apache Tomcat startup carefully.But my problem is that the singleton is not an instance of a class I defined myself.It nedds to be an instance of an external jar.How should I create an singleton from a external jar? My case is that I want to use Jena to create an OWLModel,which need to be a singleton and will be used by all servlets.But the OWLModel class is from an external jar,not a class created by myself. I'm fresh to Tomcat,I hope to get help.Thank you!
tagged with: java
type: AnsweredQuestion
tagged with: jena
has answer: http://stackoverflow.com/a/23062588
has title: How can I create a singleton (a class from an exernal jar) in Apache Tomcat startup
tagged with: tomcat

selenium-webdriver
tags question: http://stackoverflow.com/q/23007472
tags question: http://stackoverflow.com/q/23010058
tags question: http://stackoverflow.com/q/23054032
tags question: http://stackoverflow.com/q/23012219
tags question: http://stackoverflow.com/q/23087724
tags question: http://stackoverflow.com/q/22987155
tags question: http://stackoverflow.com/q/23128743
tags question: http://stackoverflow.com/q/23055718
tags question: http://stackoverflow.com/q/23081743
tags question: http://stackoverflow.com/q/23076434
tags question: http://stackoverflow.com/q/23052417
tags question: http://stackoverflow.com/q/23066554
tags question: http://stackoverflow.com/q/22995038
tags question: http://stackoverflow.com/q/23052480
tags question: http://stackoverflow.com/q/23102350
tags question: http://stackoverflow.com/q/23055168
tags question: http://stackoverflow.com/q/23009455
tags question: http://stackoverflow.com/q/23100688
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/23081901
tags question: http://stackoverflow.com/q/23050885
tags question: http://stackoverflow.com/q/23043873
tags question: http://stackoverflow.com/q/23076073
tags question: http://stackoverflow.com/q/23062268
tags question: http://stackoverflow.com/q/23098045
tags question: http://stackoverflow.com/q/23108774
tags question: http://stackoverflow.com/q/22987586
type: Tag
tags question: http://stackoverflow.com/q/23004807
tags question: http://stackoverflow.com/q/23085971
tags question: http://stackoverflow.com/q/22978074
tags question: http://stackoverflow.com/q/23084193

logging
tags question: http://stackoverflow.com/q/23008711
tag name: logging
tags question: http://stackoverflow.com/q/23114018
tags question: http://stackoverflow.com/q/23059749
tags question: http://stackoverflow.com/q/23123934
tags question: http://stackoverflow.com/q/23080351
tags question: http://stackoverflow.com/q/22968958
tags question: http://stackoverflow.com/q/23034315
tags question: http://stackoverflow.com/q/23128852
tags question: http://stackoverflow.com/q/23042306
tags question: http://stackoverflow.com/q/23007799
tags question: http://stackoverflow.com/q/23067252
tags question: http://stackoverflow.com/q/22969288
tags question: http://stackoverflow.com/q/23115189
tags question: http://stackoverflow.com/q/23049083
type: Tag
tags question: http://stackoverflow.com/q/23037462

http://stackoverflow.com/comment/35139854
has text: Actually it is doable, jus put two annotations on one method. See above. Thanks a lot Rohit!!!
type: Comment
comment on: http://stackoverflow.com/a/22984669
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35130085
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23000946
has text: Which thread gets access next after the first is up to the Thread scheduler.

http://stackoverflow.com/comment/35255476
score: 1
comment on: http://stackoverflow.com/q/23069740
has text: @zgc7009 better yet, serialize the array as XML and then search for the text. Everything is better with XML :-)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23128615
has title: Iterator hasnext gives second value
has answer: http://stackoverflow.com/a/23128901
tagged with: arrays
has body: In my case I want to delete the duplicate Strings in leveranciers with the new HashSet set. After debugging that seems to be working but when I call it.hasNext..It will directly use 0230 instead of 6023...please need some help, I'm not used to work with Iterator and HashSet. String[] leveranciers = new String[wdContext.nodeShoppingCart().size()]; //Filledin leveranciers with '6023', '6023' and '0230' //Remove duplicates from array Set set= new HashSet(Arrays.asList(leveranciers)); for (Iterator it = set.iterator(); it.hasNext(); ) { PdfPTable table = GetTable(""+ it.next()); byte[] pdf = wdThis.wdGetAchatsIndirectController().GetPDFFromFolder("/intranetdocuments/docs/AchatsIndirect", table); wdThis.wdGetAchatsIndirectController().PrintPDF(pdf); }
has comment: http://stackoverflow.com/comment/35360277
score: 0
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23128659
has comment: http://stackoverflow.com/comment/35360377
tagged with: java
type: Question
tagged with: iterator

http://stackoverflow.com/comment/35190533
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23034174
score: 0
has text: No idea what you're doing. First, you need to JDK installed and not the JRE. Second, you do not need to copy that JDK to anywhere.

http://stackoverflow.com/q/22998891
tagged with: jtextpane
tagged with: swing
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23001645
accepted answer: http://stackoverflow.com/a/23001645
has body: I am redirecting System.out and System.err in a textPane enclosed in a scrollPane to show a log of what is happening to the user. I have also implemented a simple button that when pressed it sets the textPane text to "" in order to clear it. What I have found now is that .setText("") actually keeps the formatting of whatever was shown earlier and also it keeps the line breakers. For example I have the System.err being shown in red and if in my clear button I replace .setText("") with .setText("test") and then if I have red text in the textPane then the text will be replaced by test but the word test will be red! Now what my problem is, is that if I press the clear button even once, every time a new message comes to the textPane it will have an unnecessary permanent blank line at the start. So here are my questions: Why is this even happening, how can it somehow preserve the format from before? How do I fix this? Pressing a button that will use System.out Pressing the clear button Pressing the button at step 1 again Clearing and pressing a button that will use System.err Clearing and pressing the same button that will use System.err So as you can see if I use System.out and then .setText("") then System.out gets bugged. if I use System.err and then .setText("") then System.err gets bugged.
score: 0
tagged with: settext
answer count: 2
has title: jtextPane.setText("") is keeping the format from whatever was previously in it
possible better answer: http://stackoverflow.com/a/22999426
has answer: http://stackoverflow.com/a/22999426
tagged with: jframe

http://stackoverflow.com/q/23072188
has comment: http://stackoverflow.com/comment/35259929
has title: Java: ClassCastException; Same ClassLoader?
answer count: 1
accepted answer: http://stackoverflow.com/a/23072283
has body: I am having troubles with casting, and I cannot figure it out. According to my research, what causes a ClassCastException when you cast a superclass to your class, the reason is they both use different Class Loaders. I did a simple System.out.println() to check if the class loaders are different, but they both print out the same result, @11cb01a. To get to the point on what I'm trying to accomplish, what I am attempting is creating a simple API for myself to make minigames with (I am using the Bukkit API) and I have found errors at two locations of having a ClassCastException. First off, I have two classes, the ArenaBase and ArenaManagerBase. I have a class called ArenaManager that extends ArenaManagerBase, and Arena that extends ArenaBase. When I get my error for a ClassCastException for ArenaManager, it's from calling ArenaManager.getInstance() and casting (ArenaManager) to it. When it first starts, I initialize my ArenaManager. ArenaManager.init(this); Then, inside of the init I call a few things. public static void init(JavaPlugin instance) { am = new ArenaManagerBase(); // What is returned when calling getInstance() am.plugin = instance; am.ac = new ArenaConfigBase(am.plugin); am.init(); // Separate initializer for any subclass that might need it. } The part that throws the error is this: ArenaManager am = (ArenaManager) ArenaManager.getInstance(); So just from this, I have a class that I am trying to cast to that is a superclass of the other. They both seemingly have the same ClassLoader. What am I doing wrong, and how could I fix it? Edit: Here's the stacktrace. It's weird, because at the top it says null and then at the bottom it contemplates a CastClassException. [18:36:10 ERROR]: null org.bukkit.command.CommandException: Unhandled exception executing command 'cast ledefend' in plugin DefendTheCastle vAlpha at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[cra ftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at org.bukkit.command.SimpleComma…
favorite count: 0
tagged with: classloader
tagged with: classcastexception
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35259977
tagged with: bukkit
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35259858
has answer: http://stackoverflow.com/a/23072283
score: 0

http://stackoverflow.com/comment/35388390
score: 2
type: AnswerComment
has text: *Using the acrokeys we got from test pdfs, can we get the related acrokeys from the respective prod pdf?* - How are they *related*?
type: Comment
comment on: http://stackoverflow.com/a/23107047

http://stackoverflow.com/q/23032662
has body: I have a function that is returning null. Example input: String alice=table.get("Alice","Smith"); Here's my code: public void setTab() { table.put("Alice","Smith","Manager"); ... } // get all persons with a surname of Smith final Collection&lt;String&gt; smiths = table.column("Smith").values(); // get all persons with a firstName of Bob final Collection&lt;String&gt; bobs = table.row("Bob").values(); // get a specific person final String alice=table.get("Alice", "Smith"); public void printSpecial() { System.out.println(alice); System.out.println(smiths); System.out.println(bobs); } public void prinTab() { for (Cell&lt;String, String,String&gt; cell: table.cellSet()){ System.out.println(cell.getRowKey()+" "+cell.getColumnKey()+" "+cell.getValue()); } }
upvote count: 0
accepted answer: http://stackoverflow.com/a/23032816
downvote count: 4
answer count: 1
has title: Hash based table returning null
favorite count: 0
type: AnsweredQuestion
tagged with: guava
tagged with: java
score: -4
type: Question
has answer: http://stackoverflow.com/a/23032816

http://stackoverflow.com/comment/35214915
comment on: http://stackoverflow.com/a/23046409
has text: Ok thank you for the advice. Could you please still help when I encounter a problem because I don't have much time left so I can't keep making new posts on this site. You respond really quickly and have good advice and it would be much more efficient if you could just keep helping me on this thread. I also would like to apologize for taking so much of your time.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23046619
accepted answer: http://stackoverflow.com/a/23046873
has title: How to create a Java Hexadecimal Array
favorite count: 0
has answer: http://stackoverflow.com/a/23046911
tagged with: hex
tagged with: bit-manipulation
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/35214142
possible better answer: http://stackoverflow.com/a/23046911
has comment: http://stackoverflow.com/comment/35213015
linked to: http://stackoverflow.com/q/19450452
type: AnsweredQuestion
has body: This does not seem to be appropriate. Is there a way to create a hexadecimal array? float[] bitBytes = {0x80, 0x40, 0x20, 0x10, 8, 4, 2, 1}; for (int k = 0; k &lt; alot; k++) { BitSet.set(increment++, ((array[k] &amp; (bitBytes[k%8]&amp; 0xff)) != 0)); }
has answer: http://stackoverflow.com/a/23046873
tagged with: java
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/140131
has comment: http://stackoverflow.com/comment/85500095
score: -1
has comment: http://stackoverflow.com/comment/35213196

http://stackoverflow.com/q/22976654
favorite count: 0
has title: Maven doesn't look in the local repository
has answer: http://stackoverflow.com/a/22977215
answer count: 1
tagged with: dependencies
upvote count: 3
type: UnansweredQuestion
tagged with: maven
score: 3
tagged with: java
has body: I'm trying to manage several projects with Maven, which have a number of interdependencies. This is what I did: I built one project with mvn package. I tried to build another project that depends on the other with mvn package. That produces this output: [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building classj 0.5-SNAPSHOT [INFO] ------------------------------------------------------------------------ Downloading: http://repo.maven.apache.org/maven2/com/tbodt/jrestack/1.0/jrestack-1.0.pom [WARNING] The POM for com.tbodt:jrestack:jar:1.0 is missing, no dependency information available Downloading: http://repo.maven.apache.org/maven2/com/tbodt/jrestack/1.0/jrestack-1.0.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.332 s [INFO] Finished at: 2014-04-09T17:45:17-08:00 [INFO] Final Memory: 3M/58M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project classj: Could not resolve dependencies for project com.tbodt:classj:jar:0.5-SNAPSHOT: Failure to find com.tbodt:jrestack:jar:1.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -&gt; [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionExcept…
type: Question
downvote count: 0

http://stackoverflow.com/a/23051194
score: 1
has comment: http://stackoverflow.com/comment/35222436
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35221236
answers question: http://stackoverflow.com/q/23051105
type: Answer
accepted answer of: http://stackoverflow.com/q/23051105
upvote count: 1
has body: You are incrementing i after the while loop in actionPerformed()! If you had formatted your code better, this would have been obvious: btnnext.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int i = 0; while (i&lt;dataArrayMaxIndex) { dataArrayCurrentIndex = i; websitetxt.setText(dataArray[i].getWebsitename()); usernametxt.setText(dataArray[i].getUsername()); passwordtxt.setText(dataArray[i].getPassword()); notestxt.setText(dataArray[i].getNotes()); } i++; } }); And this would have been even better: btnnext.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { for (int i = 0; i&lt;dataArrayMaxIndex; i++) { dataArrayCurrentIndex = i; websitetxt.setText(dataArray[i].getWebsitename()); usernametxt.setText(dataArray[i].getUsername()); passwordtxt.setText(dataArray[i].getPassword()); notestxt.setText(dataArray[i].getNotes()); } } });

http://stackoverflow.com/comment/35337932
score: 0
type: Comment
type: QuestionComment
has text: @user3495562 the compareTo method usually output an int (-1, 0, and 1), you need to modify your if statement accordingly.
comment on: http://stackoverflow.com/q/23116143

http://stackoverflow.com/comment/35159414
comment on: http://stackoverflow.com/q/23016960
type: QuestionComment
has text: possible duplicate of [Variable might not have been initialized error](http://stackoverflow.com/questions/2448843/variable-might-not-have-been-initialized-error)
type: Comment
score: 0

http://stackoverflow.com/comment/35341360
comment on: http://stackoverflow.com/q/23117989
score: 0
has text: What do you mean by "maximum" latitude and longitude? A single point that somehow embodies some concept of maximum, or two distinct points. In the first case you haven't provided enough information to tell us what "max" means. In the second, "max" is just r meters north and r meters west, and then you have to decide what you want if you cross the north pole or the 180-degree line. In other words, "max" has no meaning without a lot more context.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22992623
accepted answer: http://stackoverflow.com/a/22992648
answer count: 2
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/10951333
score: 0
tagged with: java
duplicate of: http://stackoverflow.com/q/10951333
has answer: http://stackoverflow.com/a/22992675
tagged with: contains
has answer: http://stackoverflow.com/a/22992648
has title: Why my contains and replace method doesn't work right?
possible better answer: http://stackoverflow.com/a/22992675
tagged with: replace
type: AnsweredQuestion
has body: I was trying to make something then i couldn't write an if method with contains and replace method. What was i missing? import java.util.Scanner; public class replacesomething { public static void main(String[] args) { Scanner cumle = new Scanner(System.in); System.out.println("Enter the sentence u want to replace "); String str1 = cumle.next(); if (str1.contains("replace")) { str1.replace("replace", "Hi"); System.out.println("Replaced Sentence: " + str1); } else { System.out.println("Sentence doesn't contains that..."); } } }
tagged with: string
has comment: http://stackoverflow.com/comment/35114734
favorite count: 0
type: Question

http://stackoverflow.com/q/22975032
type: AnsweredQuestion
has title: What is the information wasted for a 2-3 node of a tree?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22975152
accepted answer: http://stackoverflow.com/a/22975152
score: 0
answer count: 1
has body: Assume I have a node class for a 2-3 tree. Every node can store 2 data elements and at most 3 children. If there is one node in the tree store 1 data element and have no children. what is the storage wasted for this node?

http://stackoverflow.com/comment/35245223
type: AnswerComment
comment on: http://stackoverflow.com/a/23063644
type: Comment
has text: Okay, according to the equation p(n)−1= 2−1/n−1 = 1−1/n = 1−p(1/n), it would seen that p = 1, as the last 2 parts are identical, except that the 1/n is multiplied by p in the last one. So Ci is my input array? Thanks, that's another hurdle done with. So then I'm supposed to add up all the floats in the array, do I understand that right? And somehow I'm supposed to use p (i.e. 1) for each float? So am I supposed to add 1 to the tally for each item in the array?
score: 0

http://stackoverflow.com/q/23109200
type: Question
answer count: 2
has body: I have used File.createTempFile() method to create temp file but as its output it appends the garbage value with the file name too. I used the method for uploading zipfile, but unable to delete those appended garbage value. For further functionality I need the exact name of file. Kindly help... Highly appreciate your response. My concern is, as code stated by niiraj874u, I am getting the the File name : tmp4501156806082176909.txt But I want only tmp.txt How can I remove appended numeric value?
score: 0
has comment: http://stackoverflow.com/comment/35679159
has comment: http://stackoverflow.com/comment/35324770
has answer: http://stackoverflow.com/a/23306373
has answer: http://stackoverflow.com/a/23109561
linked to: http://stackoverflow.com/q/23192701
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35324768
has title: How to remove garbage value from a file name which has been created by using createTempFile() method
tagged with: java

http://stackoverflow.com/a/23119827
has comment: http://stackoverflow.com/comment/35344966
has comment: http://stackoverflow.com/comment/35344870
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/35344887
has comment: http://stackoverflow.com/comment/35345005
answers question: http://stackoverflow.com/q/23119711
has comment: http://stackoverflow.com/comment/35344952
has comment: http://stackoverflow.com/comment/35344770
has comment: http://stackoverflow.com/comment/35344790
score: 4
has body: Although there is a data race in your code, it might be impossible to see any problems, that are caused by this data race. Most likely, the JIT compiler will transform the method somethingElse into something like this: public long somethingElse() { String reg = failField; // load failField into a CPU register if (reg == null) { return -1; } return reg.length(); } That means, the compiler will not load the reference failField after the condition. And it is impossible to trigger the NullPointerException. Update: I have compiled the method somethingElse with GCJ to see some real and optimized assembler output. It looks as follows: long long BuggyClass::somethingElse(): movq 8(%rdi), %rdi testq %rdi, %rdi je .L14 subq $8, %rsp call int java::lang::String::length() cltq addq $8, %rsp ret .L14: movq $-1, %rax ret You can see from this code, that the reference failField is loaded once. Of course, there is no guarantee, that all implementations will use the same optimization now and forever. So, you shouldn't rely on it.
type: Answer

http://stackoverflow.com/comment/35157175
comment on: http://stackoverflow.com/q/23015792
has text: what is the version of struts , you are using?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23084363
downvote count: 1
has answer: http://stackoverflow.com/a/23085106
has answer: http://stackoverflow.com/a/23084627
linked to: http://stackoverflow.com/q/11227809
has answer: http://stackoverflow.com/a/23084508
upvote count: 4
tagged with: arraylist
tagged with: capacity
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/23084527
has comment: http://stackoverflow.com/comment/35281026
has answer: http://stackoverflow.com/a/23084527
favorite count: 0
has title: What is the best practice for setting the initial capacity of an ArrayList that is not always used?
has answer: http://stackoverflow.com/a/23084582
accepted answer: http://stackoverflow.com/a/23084627
has comment: http://stackoverflow.com/comment/35280735
tagged with: constructor
type: Question
has body: I have some classes that have ArrayList fields that are only sometimes used. I generally initialize these fields like so: private List&lt;Widget&gt; widgets = new ArrayList&lt;&gt;(); I understand about using the overload constructors to set the initial capacity, so I'm wondering if I should declare these fields as such: private List&lt;Widget&gt; widgets = new ArrayList&lt;&gt;(0); The dilemma, is that if I initialize the list with 0 then the list will always have to re-initialize itself for adding even one item. But, if I use the default constructor, which gives a default capacity of 10, then I may have a bunch of items (and there can be many) that are wasting memory with unused capacity. I know some of you are going to push back asking 'how often' and 'how many items are you expecting' but I'm really looking for the "best practices" approach. All things being ~equal, should one initialize with (0) or () on a list that is sometimes used? It's our department policy to always initialize lists, so I may not simply leave the lists as null, besides, that would just side-step the question.
linked to: http://stackoverflow.com/q/15430247
answer count: 6
has answer: http://stackoverflow.com/a/23084589
tagged with: java

subclipse
type: Tag
tag name: subclipse
tags question: http://stackoverflow.com/q/22999865

gxt
tags question: http://stackoverflow.com/q/23057291
tags question: http://stackoverflow.com/q/23025115
tag name: gxt
type: Tag
tags question: http://stackoverflow.com/q/23074667
tags question: http://stackoverflow.com/q/23054936

http://stackoverflow.com/q/23087482
linked to: http://stackoverflow.com/q/6258047
tagged with: aes
has comment: http://stackoverflow.com/comment/35287609
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23101320
tagged with: encryption
has title: Android use CFB
tagged with: java
has body: I'm trying to encode my String with AES and CFB. If im doing this Cipher cipher = Cipher.getInstance("AES/CFB/NoPadding"); , it works fine. But if i'm using "AES/CFB/NoPadding" instead of "AES", then the same String with the same password is different. Here is my Code: SecretKeySpec key = new SecretKeySpec(cryptPassword.getBytes(), "AES"); byte[] cryptByte = cryptString.getBytes("UTF8"); Cipher cipher = Cipher.getInstance("AES/CFB/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, key); byte[] hans = cipher.doFinal(cryptByte); cryptString = Base64.encodeToString(hans,Base64.DEFAULT); Can someone help me? Thanks a lot!!!
type: Question
answer count: 1
score: 0
tagged with: android

http://stackoverflow.com/comment/35096363
score: 0
comment on: http://stackoverflow.com/q/22982295
type: QuestionComment
has text: @Computernerd and each of LayoutManagers (custom too) handling diferrently with min, max and PreferredSize, for some required, and for some ignored
type: Comment

http://stackoverflow.com/a/22987945
score: 0
accepted answer of: http://stackoverflow.com/q/22987868
type: AcceptedAnswer
has body: Try this: if (line.lenght() &gt; 44) { String temp = line.substring(44); }
type: Answer
answers question: http://stackoverflow.com/q/22987868

http://stackoverflow.com/comment/35121712
comment on: http://stackoverflow.com/q/22996325
type: Comment
type: QuestionComment
has text: Here is a starter: [Fibonacci Dynamic Programming solution](http://en.wikipedia.org/wiki/Dynamic_programming#Fibonacci_sequence)
score: 0

http://stackoverflow.com/comment/64596241
comment on: http://stackoverflow.com/q/23127392
score: 0
type: Comment
type: QuestionComment
has text: [What is a seed in terms of generating a random number?](http://stackoverflow.com/q/14914595/995714)

http://stackoverflow.com/a/22990826
upvote count: 1
type: Answer
downvote count: 0
has body: Using java regex here is the a working method public String getOnlyNumberOfItems(String text) { Pattern pattern = Pattern.compile("^[0-9]+ items found, displaying*"); Matcher textVerifyMatcher = pattern.matcher(text); if(textVerifyMatcher.find()){ System.err.println("The text is not in the correct format"); return null; } Pattern numPattern = Pattern.compile("^[0-9]+ "); Matcher m = numPattern.matcher(text); if(m.find()){ text = m.group(0); System.out.println("Number: " + m.group(0)); } return text; } if the given text is not in the right format the method will return null, it would be better to return an exception though.
score: 1
answers question: http://stackoverflow.com/q/22987524

http://stackoverflow.com/comment/35295447
score: 0
type: AnswerComment
has text: Thanks. I've done that, and as I understand it that will prevent the list view from being used. Now I need to generate a new list of folders from within the fragment? Where should I put the code to generate the new list, and how would I then give that to the adapter to make a fresh list?
type: Comment
comment on: http://stackoverflow.com/a/23091901

http://stackoverflow.com/q/23096329
tagged with: return
has comment: http://stackoverflow.com/comment/35303369
has comment: http://stackoverflow.com/comment/35303546
has answer: http://stackoverflow.com/a/23096596
has comment: http://stackoverflow.com/comment/35303668
possible better answer: http://stackoverflow.com/a/23096392
has answer: http://stackoverflow.com/a/23096392
accepted answer: http://stackoverflow.com/a/23096599
has comment: http://stackoverflow.com/comment/35303486
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35303433
tagged with: java
has comment: http://stackoverflow.com/comment/35303412
tagged with: search
type: Question
has comment: http://stackoverflow.com/comment/35303534
has comment: http://stackoverflow.com/comment/35303551
tagged with: arrays
has body: I'm attempting to return the index of where an object appears in an array of objects. public static int search(WordCount[] list,WordCount word, int n) { int result = -1; int i=0; while (result &lt; 0 &amp;&amp; i &lt; n) { if (word.equals(list[i])) { result = i; break; } i++; } return result; } WordCount[] is the array of objects. word is an instance of WordCount. n is the number of objects in WordCount[] It runs, but isn't returning the index correctly. Any and all help is appreciated. Thanks for your time. CLASS class WordCount { String word; int count; static boolean compareByWord; public WordCount(String aWord) { setWord(aWord); count = 1; } private void setWord(String theWord) { word=theWord; } public void increment() { count=+1; } public static void sortByWord() { compareByWord = true; } public static void sortByCount() { compareByWord = false; } public String toString() { String result = String.format("%s (%d)",word, count); return result; } } How I'm calling it... for (int i=0;i&lt;tokens.length;i++) { if (tokens[i].length()&gt;0) { WordCount word = new WordCount(tokens[i]); int foundAt = search(wordList, word, n); if (foundAt &gt;= 0) { wordList[foundAt].increment(); } else { wordList[n]=word; n++; } } } }
has comment: http://stackoverflow.com/comment/35303525
score: 0
has answer: http://stackoverflow.com/a/23096599
has comment: http://stackoverflow.com/comment/35303471
answer count: 4
has answer: http://stackoverflow.com/a/23096410
has title: Searching through an Array of Objects

http://stackoverflow.com/comment/35160576
has text: In order to use reflection on a class, it must be loaded first. Using reflection may not work in this case if you're evaluating classes outside the packages and you may get problems when trying to load them. The best scenario would be parsing the Java file and get the desired info.
comment on: http://stackoverflow.com/a/23017727
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35244249
comment on: http://stackoverflow.com/a/23063777
score: 3
type: AnswerComment
has text: why is this better than an IF ?
type: Comment

http://stackoverflow.com/q/22977099
answer count: 1
tagged with: arrays
accepted answer: http://stackoverflow.com/a/22977174
favorite count: 0
downvote count: 1
type: AnsweredQuestion
has body: I am using the split() function to fill an array and I am trying to enter each element into a Mysql table. What is the best way to do this? How can I make the loop iterate until it reaches the end of the array? I was thinking I might need a scanner object that reads from the array which would allow me to use the .hasNext() function. Is there a better way than this? String text = "This is my example text string"; String array[] = text.split(" "); Thanks
has title: How to enter array elements into Mysql table? Java
tagged with: java
score: -1
tagged with: mysql
has answer: http://stackoverflow.com/a/22977174
type: Question
upvote count: 0

http://stackoverflow.com/comment/35225465
has text: Yes I saw it. Look at AndrewThompson's answer for some useful tips.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23053306

http://stackoverflow.com/comment/35256912
type: Comment
type: QuestionComment
has text: Imagine a piece of code fails. Would you rather get debug info in the form of `null` or `-1` or something more informative like `ArrayIndexOutOfBounds` which can show you when and where the problem occurred.
score: 0
comment on: http://stackoverflow.com/q/23070388

http://stackoverflow.com/comment/35342452
type: QuestionComment
has text: I want to get all the points that are far from my position within a certain radius. My idea is to get all places around me within that radius (in DB I have all places with the relative coordinates).
comment on: http://stackoverflow.com/q/23117989
score: 0
type: Comment

http://stackoverflow.com/q/23080426
type: UnansweredQuestion
tagged with: java
has body: I have two classes and one of them contains animation I want to apply. But due unknown reason it not works. My main class: package com.example.tachles; import android.os.Bundle; import android.text.Html; import android.text.Spanned; import android.view.Menu; import android.view.MenuItem; public class History_01_01 extends TextSet { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String formattedText = getString(R.string.zionut01); Spanned result = Html.fromHtml(formattedText); text.setText(result); } public void sizeUp(MenuItem item) { super.sizeUp(item); } public void sizeDown(MenuItem item) { super.sizeDown(item); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.textbar, menu); return true; } @Override protected void onStart() { super.onStart(); } @Override protected void onStop() { super.onStop(); } } The class I want to extend package com.example.tachles; import android.app.ActionBar; import android.app.Activity; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.Bundle; import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; public class TextSet extends Activity { TextView text; float size; ActionBar actionBar; private final String TEXT_SIZE = "textsize"; final String MyPref = "preference"; SharedPreferences settings; Editor editor; int onStartCount = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.textpage); text = (TextView) findViewById(R.id.textView1); settings = this.getSharedPreferences(MyPref, 0); text.setTextSize(settings.getFloat(TEXT_SIZE, 15)); editor = settings.edit(); onStartCount = 1; if (savedInstanceState == null) { this.overridePendingTransition(R.anim.anim_slide_in_left, R.anim.anim…
type: Question
has title: After extending a class animation not called
has comment: http://stackoverflow.com/comment/35276091
score: 0
has comment: http://stackoverflow.com/comment/35277549
has comment: http://stackoverflow.com/comment/35274246
tagged with: android
tagged with: animation
answer count: 0

http://stackoverflow.com/q/23015494
has title: @BeanParam CDIExtension WebApplication null
has comment: http://stackoverflow.com/comment/35157091
has body: With wildfly 8.0.0.Final and an EAR project we keep getting nullpointer exception. By hitting corresponding entry point with @beanparam annotation, this happens as many times as we have @queryparam or @pathparam annotations in the @beanparam annotated class. After that the app works fine. Any hints on how to solve this. What is the component that eventually initializes the the CDIExtension's webapplication? exception: org.jboss.resteasy.spi.BadRequestException: Failed processing arguments of org.jboss.resteasy.spi.metadata.ResourceMethod@2991850d at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:103) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:111) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:280) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:234) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:221) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [resteasy-jaxrs-3.0.6.Final.jar:] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final] at io.undertow.servlet.handlers.Serv…
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: wildfly
tagged with: annotations
has comment: http://stackoverflow.com/comment/35210484
type: Question

http://stackoverflow.com/comment/35329173
type: QuestionComment
score: 0
has text: You would have to add a cast to it. `((ArrayList<String)list.get(0)).get(1);`
comment on: http://stackoverflow.com/q/23111649
type: Comment

http://stackoverflow.com/comment/126242411
comment on: http://stackoverflow.com/a/49207551
type: Comment
score: 1
has text: This should be the accepted solution. Really helped. Thanks @Hett
type: AnswerComment

http://stackoverflow.com/comment/35143215
has text: I am trying to get plain/text response from another server which I call using https. After parsing the response, I will need to extract data and update some db tables.
comment on: http://stackoverflow.com/q/23007239
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35204904
comment on: http://stackoverflow.com/a/23042406
score: 0
type: AnswerComment
type: Comment
has text: Thank you this is a bit beyond me at the moment as I am only in year 1 of java but it is nice to know it can be cut down.

http://stackoverflow.com/q/23007044
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35140940
has comment: http://stackoverflow.com/comment/35140753
has comment: http://stackoverflow.com/comment/35140697
type: Question
tagged with: java
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/35140884
has body: I have an error ,and i'm seeking it since yesterday .It seems to be a broblem of size in an array. This is the function when the exception seems to happen : private XYMultipleSeriesDataset getTruitonBarDataset() { XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); int [] classObject =new int[] {-70,-56,-45,-80,-47,-55,-80,-50,-75,-85,-35,-45};//Signal strength receiver from each access point for (int j=0;j&lt;classObject.length;j++){ values.add(new int[] { classObject[j]}); //every serie will concern an access point and contain one RSSI } final int nr = classObject.length; ArrayList&lt;String&gt; legendTitles = new ArrayList&lt;String&gt;(); for (int k = 0; k &lt; classObject.length; k++) { legendTitles.add("Sales"+k);//every serie will have a legend } SERIES_NR = classObject.length ;//number of access point for (int i = 0; i &lt; SERIES_NR; i++) {//Loop for every series CategorySeries series = new CategorySeries(legendTitles.get(i)); int[] v = values.get(i); int seriesLength = v.length; dataset.addSeries(series.toXYSeries()); for (int k = 0; k &lt; seriesLength; k++) { Log.i("STOOP SERIES_NR",SERIES_NR+""); Log.i("STOOP ii",i+""); Log.i("STOOP",k+""); Log.i("STOOP",v[k]+""); Log.i("STOOP",v[k] / 10+""); /* XYSeries tempSerie = dataset.getSeriesAt(i); tempSerie.add(i, 40 - v[k] %10);*/ switch (v[k] / 10){ case -8 : //series.add(classObject[k]); if (v[k] %10 == 0) //series.add(40); {XYSeries tempSerie = dataset.getSeriesAt(i); tempSerie.add(i, 40); } else //series.add(40 - v[k] %10); {XYSeries tempSerie = dataset.getSeriesAt(i); tempSerie.add(i, 40 - v[k] %10); } break; case -7 : //series.add(classObject[k]); if (v[k] %10 == 0) { XYSeries tempSerie = dataset.getSeriesAt(i); tempSerie.add(i, 50); tempSerie.addAnnotation("text *** "+i, 0, 50); } else // EDITED //series.add(50 - v[k] %10); {XYSeries tempSerie = dataset.getSeriesAt(i); // ERROR LINE 100 tempSerie.add(i, 7.5,50 - v[k] %10); tempSerie.add(i,50 - v[k] %10);//right line // series.toXYSeries().a…
has comment: http://stackoverflow.com/comment/35141133
has title: Android : IndexOutOfBoundsException: Invalid index 8, size is 0
score: 0
has comment: http://stackoverflow.com/comment/35143798
tagged with: android
has comment: http://stackoverflow.com/comment/35146833
has comment: http://stackoverflow.com/comment/35145741
has comment: http://stackoverflow.com/comment/35140773
answer count: 0

mysql
tags question: http://stackoverflow.com/q/23115538
tags question: http://stackoverflow.com/q/23100389
tags question: http://stackoverflow.com/q/23024603
tags question: http://stackoverflow.com/q/23112653
tags question: http://stackoverflow.com/q/22981619
tags question: http://stackoverflow.com/q/23108916
tags question: http://stackoverflow.com/q/23032981
tags question: http://stackoverflow.com/q/23030646
tags question: http://stackoverflow.com/q/23062340
tags question: http://stackoverflow.com/q/22982527
tags question: http://stackoverflow.com/q/22991050
tags question: http://stackoverflow.com/q/22982884
tags question: http://stackoverflow.com/q/23043646
tag name: mysql
tags question: http://stackoverflow.com/q/22978397
tags question: http://stackoverflow.com/q/23033782
tags question: http://stackoverflow.com/q/23044713
tags question: http://stackoverflow.com/q/23015761
tags question: http://stackoverflow.com/q/22979602
tags question: http://stackoverflow.com/q/22972426
tags question: http://stackoverflow.com/q/23020857
tags question: http://stackoverflow.com/q/23044197
tags question: http://stackoverflow.com/q/22986398
tags question: http://stackoverflow.com/q/22981849
tags question: http://stackoverflow.com/q/23007711
tags question: http://stackoverflow.com/q/23064017
tags question: http://stackoverflow.com/q/23118918
tags question: http://stackoverflow.com/q/23042503
tags question: http://stackoverflow.com/q/23125279
tags question: http://stackoverflow.com/q/23088708
tags question: http://stackoverflow.com/q/22980917
tags question: http://stackoverflow.com/q/22985547
tags question: http://stackoverflow.com/q/23006999
tags question: http://stackoverflow.com/q/23104274
tags question: http://stackoverflow.com/q/22971149
tags question: http://stackoverflow.com/q/23109342
tags question: http://stackoverflow.com/q/23019969
tags question: http://stackoverflow.com/q/23074886
tags question: http://stackoverflow.com/q/23125760
tags question: http://stackoverflow.com/q/23024643
tags question: http://stackoverflow.com/q/23005071
tags question: http://stackoverflow.com/q/22977931
tags question: http://stackoverflow.com/q/23029991
tags question: http://stackoverflow.com/q/23079988
tags question: http://stackoverflow.com/q/23075850
tags question: http://stackoverflow.com/q/22970314
tags question: http://stackoverflow.com/q/22985904
tags question: http://stackoverflow.com/q/23078302
tags question: http://stackoverflow.com/q/23094877
tags question: http://stackoverflow.com/q/23045690
tags question: http://stackoverflow.com/q/23111142
tags question: http://stackoverflow.com/q/23003179
tags question: http://stackoverflow.com/q/22990388
tags question: http://stackoverflow.com/q/23114806
tags question: http://stackoverflow.com/q/23084372
tags question: http://stackoverflow.com/q/23036714
type: Tag
tags question: http://stackoverflow.com/q/23079792
tags question: http://stackoverflow.com/q/23070187
tags question: http://stackoverflow.com/q/23017376
tags question: http://stackoverflow.com/q/23021351
tags question: http://stackoverflow.com/q/23106063
tags question: http://stackoverflow.com/q/23038940
tags question: http://stackoverflow.com/q/23121963
tags question: http://stackoverflow.com/q/23064748
tags question: http://stackoverflow.com/q/23052039
tags question: http://stackoverflow.com/q/23102747
tags question: http://stackoverflow.com/q/23104610
tags question: http://stackoverflow.com/q/23085302
tags question: http://stackoverflow.com/q/23096123
tags question: http://stackoverflow.com/q/23124576
tags question: http://stackoverflow.com/q/23127915
tags question: http://stackoverflow.com/q/23062341
tags question: http://stackoverflow.com/q/23037117
tags question: http://stackoverflow.com/q/23047200
tags question: http://stackoverflow.com/q/22977099
tags question: http://stackoverflow.com/q/22986878
tags question: http://stackoverflow.com/q/23124610
tags question: http://stackoverflow.com/q/23022912
tags question: http://stackoverflow.com/q/23087230

http://stackoverflow.com/q/22997430
tagged with: java
has body: I am trying to write some data into an Excel file with format (.xlsx). But the thing is that the first row of it is written into the file correctly and when I am trying to retrieve the number of rows and then increment the rows so that I could write more rows into the file, I am getting an exception of "Invalid format exception" and sometimes my code is getting executed but I am getting row count as 1. Please solve my issue and I am even attaching the code am working with. public static int getRows(String memail,String testid) throws FileNotFoundException,IOException, InvalidFormatException{ int rc; FileInputStream file = new FileInputStream(new File("email1.xlsx")); XSSFWorkbook wb = new XSSFWorkbook (file); WorkbookFactory.create(file); XSSFSheet sheet = wb.getSheet(testid); rc = sheet.getLastRowNum(); return rc; }
tagged with: excel
type: Question
has answer: http://stackoverflow.com/a/23031275
has title: Why am I getting the number of rows in an Excel sheet as 0 using JAVA?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22997556
tagged with: apache-poi
type: UnansweredQuestion

http://stackoverflow.com/a/23057370
has body: If you only want the pak_id value using only the standard library: InputStream is = ... String line; StringBuilder text = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); while((line = reader.readLine()) != null) { text.append(line).append(" "); } String pakId = text.toString().replaceAll(".*\"pak_id\": \"([^\"]+)\".*", "$1");
score: 0
has comment: http://stackoverflow.com/comment/35237067
answers question: http://stackoverflow.com/q/23057064
type: Answer
has comment: http://stackoverflow.com/comment/35232770

http://stackoverflow.com/comment/35340919
type: AnswerComment
comment on: http://stackoverflow.com/a/23117713
score: 0
type: Comment
has text: `null` means nothing, can really release it. But if you are talking about gc eligible objects, gc is smart enough collect it as early as possible.

http://stackoverflow.com/comment/35154691
has text: Oups, I hadn't seen that part. I fixed but there is probably a better solution
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23014588

http://stackoverflow.com/comment/35209063
type: Comment
type: QuestionComment
has text: As it stands this question is too broad for this site. You will get a great response here when you start coding, get stuck, then come back and and ask a specific question about a problem in that specific piece of code. Best of luck with the project. Oh and to point you in the right direction you are on the right track with separating out your concerns. Check out MVC and consider writing a REST Based API to access your DB data. That way you will be able to write mulitple clients on differing platforms to access that data.
score: 4
comment on: http://stackoverflow.com/q/23044622

http://stackoverflow.com/q/23094696
answer count: 1
has answer: http://stackoverflow.com/a/23098767
score: 0
linked to: http://stackoverflow.com/q/21837843
tagged with: mime
accepted answer: http://stackoverflow.com/a/23098767
has body: Using JavaMail, I am able to read unread emails from the server. If a mail contains a thread of previous replies, is it possible to somehow distinguish between each message in the thread? (The emails are HTML encoded)
tagged with: mime-types
has comment: http://stackoverflow.com/comment/35300669
type: AnsweredQuestion
tagged with: java
has title: JavaMail: distinguish between each message in an email thread
type: Question
tagged with: jakarta-mail

http://stackoverflow.com/a/23111586
has comment: http://stackoverflow.com/comment/35329485
has comment: http://stackoverflow.com/comment/35332896
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23110983
type: Answer
has comment: http://stackoverflow.com/comment/35332539
has comment: http://stackoverflow.com/comment/35329634
has body: The first error is: java.lang.ClassCastException: java.lang.String cannot be cast to android.database.Cursor Issue is your trying to type cast the String to Cursor at this line Cursor detalhes = (Cursor) l.getItemAtPosition(position); getItemAtPosition will return the data associated with the specified position in the list. So, in your case your have passed List&lt;String&gt; data as the data for the list items. so each item will have as string object String name = (String) l.getItemAtPosition(position); If you need to pass the email of that items. You can create a ArrayList for email and add it from database like this. List&lt;String&gt; emailLists = new ArrayList&lt;String&gt;(); And, add the emails into the list data.add(cursor.getString(cursor.getColumnIndex("email"))); Now, When the item selected, get the email from the ArrayList String email = emailLists.get(position);
has comment: http://stackoverflow.com/comment/35331186
answers question: http://stackoverflow.com/q/23110983
has comment: http://stackoverflow.com/comment/35345771
has comment: http://stackoverflow.com/comment/35330271

http://stackoverflow.com/comment/35347842
comment on: http://stackoverflow.com/a/23118133
has text: that was it! Gotta love when its so simple. Thanks so much
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35219345
type: QuestionComment
comment on: http://stackoverflow.com/q/23050097
has text: Have a look [here](http://stackoverflow.com/questions/22663112/java-8-streams-while-does-this-compile-part-2-or-what-is-a-method-reference) also; what you can actually use as a "lambda" is... Broad.
score: 1
type: Comment

http://stackoverflow.com/q/22979199
score: -1
has answer: http://stackoverflow.com/a/22989630
has comment: http://stackoverflow.com/comment/35109450
has comment: http://stackoverflow.com/comment/35092625
has comment: http://stackoverflow.com/comment/35090749
answer count: 4
has answer: http://stackoverflow.com/a/22980722
favorite count: 0
tagged with: timezone
type: UnansweredQuestion
has body: I need to convert 9 Apr 2014 20:36:13 GMT to france timezone 9 Apr 2014 21:36:13 CEST. i come across this function but was unable to adapt it to my code. long ts = System.currentTimeMillis(); Date localTime = new Date(ts); String format = "dd MMMM yyyy HH:mm"; SimpleDateFormat sdf = new SimpleDateFormat(format); // Convert Local Time to UTC (Works Fine) sdf.setTimeZone(TimeZone.getTimeZone("GMT")); Date gmtTime = new Date(sdf.format(localTime)); System.out.println("Local:" + localTime.toString() + "," + localTime.getTime() + " --&gt; UTC time:" + gmtTime.toString() + "," + gmtTime.getTime()); // **** YOUR CODE **** END **** // Convert UTC to Local Time Date fromGmt = new Date(gmtTime.getTime() + TimeZone.getDefault().getOffset(localTime.getTime())); System.out.println("UTC time:" + gmtTime.toString() + "," + gmtTime.getTime() + " --&gt; Local:" + fromGmt.toString() + "-" + fromGmt.getTime()); Any idea please.
tagged with: android
has answer: http://stackoverflow.com/a/22981271
has answer: http://stackoverflow.com/a/22996475
upvote count: 0
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/35091334
has title: Convert 9 Apr 2014 20:36:13 GMT to France timezone 9 Apr 2014 21:36:13 CEST
type: Question

http://stackoverflow.com/q/23036995
tagged with: netbeans
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/35196067
upvote count: 1
tagged with: swing
has title: java web start unknown source exception
type: Question
tagged with: java
tagged with: java-web-start
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I have created a GUI in netbeans using java swing. The main frame opens a DesktopPane with menu options where the user can choose to open internal frames within the main frame. In order to run this GUI, I have to use 'Run file' in the mainframe.java file rather than use the green 'Run project' button. I am new to netbeans and java web start but I followed the instructions on netbeans.org on how to configure the project to enable web start. However, I get an error when I launch stating an 'unknown source' exception message. I presume my error is caused by the fact that the GUI does not run from the 'run project' as stated above but I am not sure. Can anyone advise me? Many thanks

http://stackoverflow.com/q/22979990
answer count: 1
has comment: http://stackoverflow.com/comment/35111936
has answer: http://stackoverflow.com/a/22991592
has body: I am creating a program that gets the serial input, converts it into an int and then sets a pin to HIGH for however long the input says, such as if I print "9000" to the Arduino serial port it will set pin 13 to HIGH for 9000 milliseconds. However, it sets the pin to HIGH for the initial "handshake" at the start of the connection. Is there any way of eliminating this, or countering it? Here is my current Arduino code: int Relay = 13; //The pin that the relay is attached to int time; //Creates temp variable void setup() { //Initialize the Relay pin as an output: pinMode(Relay, OUTPUT); //Initialize the serial communication: Serial.begin(9600); } void loop() { while(true) { //Check if data has been sent from the computer: if (Serial.available()) { //Assign serial value to temp time = Serial.parseInt(); //Output value to relay delay(4000); digitalWrite(Relay, HIGH); delay(time); digitalWrite(Relay, LOW); } } } If there is any way could you let me know how I could do it? Thanks :) Edit 1: int Relay = 13; //The pin that the relay is attached to int time; byte byte_1; byte byte_2; //Creates temp variable void setup() { pinMode(Relay, OUTPUT); //Initialize the serial communication: Serial.begin(9600); digitalWrite(Relay, LOW); delay(250); } void loop() { //Check if data has been sent from the computer: if (Serial.available() == 2) { byte_1 = Serial.read(); delay(100); byte_2 = Serial.read(); } if(byte_1 == 16) { digitalWrite(Relay, HIGH); delay(byte_2); digitalWrite(Relay, LOW); } byte_1 = 0; byte_2 = 0; } Edit 3: package net.arduino; import java.io.OutputStream; import gnu.io.CommPort; import gnu.io.CommPortIdentifier; import gnu.io.SerialPort; public class Main { public static void main(String[] args) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM3"); if(portIdentifier.isCurrentlyOwned()) { System.out.println("ERROR!!! -- Port already in use!"); }else{ CommPort commPort = portIdentifier.open("XBell", 0); if(commPort insta…
type: UnansweredQuestion
tagged with: serial-port
score: 0
tagged with: java
tagged with: arduino
type: Question
has title: Eliminate line noise on Arduino Serial

http://stackoverflow.com/comment/35287474
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23074844
has text: `orderDate.getTime()` returns a `long` so you wouldn't see that. What is it you are _actually_ doing? Add an edit to your question
score: 0

http://stackoverflow.com/q/23109389
tagged with: opencv
has answer: http://stackoverflow.com/a/23109535
has comment: http://stackoverflow.com/comment/35325056
has comment: http://stackoverflow.com/comment/35324946
tagged with: java
has title: adaptivethreshold gives an error (opencv, java)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35325598
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/23109535
favorite count: 0
type: Question
tagged with: adaptive-threshold
has body: I am trying to do adaptiveThresholding on an image but it gives me this error: OpenCV Error: Assertion failed (src.type() == CV_8UC1) in adaptiveThreshold I can't seem to understand why, here is my code: Mat source = Highgui.imread("camera.jpg", Highgui.CV_LOAD_IMAGE_COLOR); Mat destination = new Mat(source.rows(),source.cols(),source.type()); Imgproc.cvtColor(source, destination, Imgproc.COLOR_RGB2GRAY); Highgui.imwrite("grayscale.jpg", destination); Mat source2 = Highgui.imread("grayscale.jpg", Highgui.CV_LOAD_IMAGE_COLOR); Mat destination2 = new Mat(source.rows(),source.cols(),source.type()); Imgproc.adaptiveThreshold(source2, destination2, 255, Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY_INV, 15, 4);
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/35170218
type: Comment
type: QuestionComment
has text: @MadProgrammer I've used that while statement as a 'pause' while another thread updates the variable used to add the chars to the arraylist. And yes I am using multiple threads. `lookReplyGUIPanel` is added initially when the program is first run, but not after every update. I thought thats what invalidate, validate and repaint did after reading other questions.
comment on: http://stackoverflow.com/q/23022341
score: 0

http://stackoverflow.com/comment/35300920
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23094942
has text: sorry, now its better
score: 0

http://stackoverflow.com/comment/35164968
type: QuestionComment
comment on: http://stackoverflow.com/q/23019988
score: 0
has text: Which line in `onItemClick()` is line 55 in `DashboardGridActivity.java`?
type: Comment

http://stackoverflow.com/comment/35278528
score: 0
has text: Subclassing an external class in your model is not your best option, especially for inheriting such few attributes and methods... you can rewrite a similar pojo within a minute
type: Comment
comment on: http://stackoverflow.com/q/23072732
type: QuestionComment

http://stackoverflow.com/q/23035152
answer count: 1
favorite count: 0
tagged with: regex
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23035173
has comment: http://stackoverflow.com/comment/35192171
score: -1
has title: Find function of regex in Java
has answer: http://stackoverflow.com/a/23035173
upvote count: 0
has body: Hi All I just started regex and executed the sample code package practice; import java.util.regex.*; public class Regexpr2 { public static void main(String args[]) { Pattern pat = Pattern.compile("Java 7 naya hai") ; Matcher match = pat.matcher("Java"); System.out.println("Here I am ------------&gt;"); if (match.find()) System.out.println("got it using find method---------"); else System.out.println("didnt got"); } } But the Output I not what I expected enter code here output: Here I am ------------> didnt got Can Someone explain why is "else" Statement is getting excuted

http://stackoverflow.com/a/23320554
has comment: http://stackoverflow.com/comment/95593409
accepted answer of: http://stackoverflow.com/q/22978074
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/79154060
has comment: http://stackoverflow.com/comment/65641674
type: Answer
has comment: http://stackoverflow.com/comment/83887686
has comment: http://stackoverflow.com/comment/95593444
downvote count: 1
score: 19
upvote count: 20
answers question: http://stackoverflow.com/q/22978074
has comment: http://stackoverflow.com/comment/87172820
has body: Because Tor Browser Bundle wasn't letting me use the WebDriver extension, I found a workaround in which I ran Tor from a regular Firefox browser. With this method, as long as the Tor Browser is open, you can use Tor with a regular Firefox browser. Open Tor Browser: File torProfileDir = new File( "...\\Tor Browser\\Data\\Browser\\profile.default"); FirefoxBinary binary = new FirefoxBinary(new File( "...\\Tor Browser\\Start Tor Browser.exe")); FirefoxProfile torProfile = new FirefoxProfile(torProfileDir); torProfile.setPreference("webdriver.load.strategy", "unstable"); try { binary.startProfile(torProfile, torProfileDir, ""); } catch (IOException e) { e.printStackTrace(); } Open Firefox with some configurations: FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("network.proxy.type", 1); profile.setPreference("network.proxy.socks", "127.0.0.1"); profile.setPreference("network.proxy.socks_port", 9150); FirefoxDriver = new FirefoxDriver(profile); Close browsers. Note that if you plan on doing a lot of closing and reopening (useful in obtaining a new IP address), I advise setting the profile preference toolkit.startup.max_resumed_crashes to a high value like 9999. private void killFirefox() { Runtime rt = Runtime.getRuntime(); try { rt.exec("taskkill /F /IM firefox.exe"); while (processIsRunning("firefox.exe")) { Thread.sleep(100); } } catch (Exception e) { e.printStackTrace(); } } private boolean processIsRunning(String process) { boolean processIsRunning = false; String line; try { Process proc = Runtime.getRuntime().exec("wmic.exe"); BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream())); OutputStreamWriter oStream = new OutputStreamWriter(proc.getOutputStream()); oStream.write("process where name='" + process + "'"); oStream.flush(); oStream.close(); while ((line = input.readLine()) != null) { if (line.toLowerCase().contains("caption")) { processIsRunning = true; break; } } input.close(); } catch (IOException e) { e.…

http://stackoverflow.com/comment/35231238
type: Comment
has text: @rohit - I still think Enum should not be assigned to null. :). I think Color color = null; // should give compile time error ( or runtime if I get it dynamically.)
comment on: http://stackoverflow.com/a/23056392
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35340636
score: 1
comment on: http://stackoverflow.com/a/23117680
type: AnswerComment
type: Comment
has text: For `double`s, the precision should be less than or equal to `1`. It will work for values up to 2^52. Any higher, and the precision of a `double` is greater than `1` and you may be storing a different value than you specify. So you might as well use `long`, which can go to 2^63 - 1.

http://stackoverflow.com/comment/35150260
type: Comment
type: QuestionComment
has text: Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
comment on: http://stackoverflow.com/q/23012314
score: 0

http://stackoverflow.com/comment/35190671
has text: public void connect() { try { Class.forName(driver).newInstance(); conn = DriverManager .getConnection(url + dbName, username, password); System.out.println("Made a connection"); executeQuery("what so ever your query"); conn.close(); } catch (Exception e) { System.out.println("Haven't made a connection"); } }
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23033134

http://stackoverflow.com/comment/35219068
type: AnswerComment
comment on: http://stackoverflow.com/a/23049746
type: Comment
has text: @Bfrank, Show the partial contents of one file that you are trying to feed to your program.
score: 0

http://stackoverflow.com/q/23050982
tagged with: if-statement
tagged with: arrays
score: 0
accepted answer: http://stackoverflow.com/a/23051023
answer count: 1
has answer: http://stackoverflow.com/a/23051023
has body: I'm new to Android, but not to programming, and I have to create a prototype app for a Masters project. I have 2 predetermined arrays, each containing 33 values. The aim is to get the arrays displaying each value on a button click. Eventually it'll do more, but that's not important for now. I've used a simple if/else if statement, and enclosed it in a try/finally block. The arrays loop beautifully, but when the value of i reaches the end of the array (32) and increments past it (33), it doesn't bypass the first if argument and go to the else if block. Try and try as I might, I cannot for the life of me figure out why it's not returning a false and skipping to the next section on the subsequent iteration. The logcat shows it's exceeded the array length, which is fine, but I have an argument in place to catch that. Or I think I do? I've probably missed something glaringly stupid, but if anyone out there can spot it, I'd really appreciate the help. Thanks in advance :) Code: public class TestActivity extends Activity { public int i; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test); final TextView testQuest = (TextView) findViewById(R.id.questView); final TextView testNum = (TextView) findViewById(R.id.numbs); Button getNext = (Button) findViewById(R.id.btnNext); final String[] quesNums = { "Question 1", "Question 2", "Question 3", "Question 4", "Question 5", "Question 6", "Question 7", "Question 8", "Question 9", "Question 10", "Question 11", "Question 12", "Question 13", "Question 14", "Question 15", "Question 16", "Question 17", "Question 18", "Question 19", "Question 20", "Question 21", "Question 22", "Question 23", "Question 24", "Question 25", "Question 26", "Question 27", "Question 28", "Question 29", "Question 30", "Question 31", "Question 32", "Question 33" }; final String[] questions = { "I have enough information about the organisation/work area to prepare for my placemen…
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
has title: Android: looping arrays with an if statement

http://stackoverflow.com/comment/35215653
comment on: http://stackoverflow.com/a/23048037
type: Comment
has text: Thanks for the answer! I think that is what I was looking for. Is the number 1 for an int variable equivalent to "" in a string variable? Or would 0 be it?
type: AnswerComment
score: 0

http://stackoverflow.com/q/22977276
has answer: http://stackoverflow.com/a/22977332
has body: package data_structures_java ; import java.util.LinkedList; class Queue_implementation { private LinkedList&lt;Float&gt; list = new LinkedList&lt;Float&gt;(); public void enqueue(Float item) { list.addLast(item); } public Float dequeue() { return list.poll(); } public boolean hasItems() { return !list.isEmpty(); } public int size() { return list.size(); } public void addItems(Queue_implementation q) { while (q.hasItems()) list.addLast(q.dequeue()); } } I wanted to use arraylist to make my own queue. But then i would have to write function like add_only_to_front(). QUESTION: Is there any crucial difference what basic data structure you can use to make your own linked list, stack... Because I used array list to write my own stack implementation, and i wanted to use arraylist for queue, deque, linkedlist, map(possible?), heap(?). This is my stack implementation using arraylist : package data_structures_java; import java.util.ArrayList ; public class Stack_implementation { ArrayList&lt;Integer&gt; actual_stack ; int index_top ; public Stack_implementation( int size ){ actual_stack = new ArrayList&lt;Integer&gt;(size) ; index_top = 0 ; } public int pop(){ System.out.println("popped 1 element!") ; int result = actual_stack.get(index_top) ; actual_stack.remove(index_top) ; --index_top ; return result ; } public void push(int element){ if( index_top &gt; actual_stack.size()){ System.out.println("can't push on stack!"); return ; } actual_stack.add(element) ; index_top++ ; } public void print_stack(){ if(actual_stack.isEmpty() )System.out.println("stack is empty") ; for(int i = index_top-1 ; i &gt;= 0 ; i--){ System.out.println( "|\t" + actual_stack.get(i) + "\t|" ) ; } } }
upvote count: 1
downvote count: 1
tagged with: queue
has comment: http://stackoverflow.com/comment/35087723
possible better answer: http://stackoverflow.com/a/22977332
tagged with: data-structures
accepted answer: http://stackoverflow.com/a/22977348
tagged with: arraylist
type: AnsweredQuestion
has title: Is it technically correct to use ArrayList(or better Linked list) to write my own Queue?[java code below]
favorite count: 0
has comment: http://stackoverflow.com/comment/35087965
type: Question
has comment: http://stackoverflow.com/comment/35087513
answer count: 2
has answer: http://stackoverflow.com/a/22977348
has comment: http://stackoverflow.com/comment/35087401
score: 0
tagged with: stack
tagged with: java

http://stackoverflow.com/comment/35218286
has text: Yes, So like wsdl, It can say what exactly input output it expects. So anyone has access to wsdl can find input and output. Similarly i want to know if there is any way i can achieve in wadl? My intention is not to convery whole wadl to JSON. My intention is in the request response in wadl, i want to show my sample json rather than simply wadl showing <representation mediaType="application/xml"/><representation mediaType="application/json"/>
comment on: http://stackoverflow.com/q/23049117
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22969478
has comment: http://stackoverflow.com/comment/35081848
score: 3
upvote count: 3
has body: From Javadoc: The Java language provides special support for the string concatenation operator ( + ), and for conversion of other objects to strings. String concatenation is implemented through the StringBuilder(or StringBuffer) class and its append method Thus, at least the left operand must not be null since StringBuffer.append(Object object) accept Object (including null) as parameter.
downvote count: 0
answers question: http://stackoverflow.com/q/22969348
has comment: http://stackoverflow.com/comment/35081409
has comment: http://stackoverflow.com/comment/35081104
type: Answer
has comment: http://stackoverflow.com/comment/35081740
has comment: http://stackoverflow.com/comment/35081041

http://stackoverflow.com/q/23070997
score: 0
answer count: 1
tagged with: asynchronous
has answer: http://stackoverflow.com/a/23071237
has title: Java concurrent tasks implementation
has comment: http://stackoverflow.com/comment/35258485
type: UnansweredQuestion
has body: My problem is this: I can have a maximum of three concurrent tasks running. These tasks can process 1 to 100 jobs simultaneously. I have many threads constantly submitting single jobs, and I want to respond to them as fast as possible. The time taken to process 100 jobs in one task is the same as it takes to process 1 job in one task. Jobs come in at random intervals. Threads that submit jobs need to block until the job is done, or a timeout is hit. Responding quickly to the threads submitting jobs is the driver here. So my current logic is this: If there are &lt; 3 tasks running, and a job arrives, create a new task to process just that job on it's own. If there are 3 tasks running, put the job in a queue and wait until another task finishes, then take all the jobs from the queue (limit 100) and create a task to process all of them. I'm just not quite sure the best way to set this up in Java. I created a simple semaphore versions which works fine but does not take advantage of the ability to submit job simultaneously together. How best should I expand this to fully meet my requirements? (there is no requirement to use a semaphore, it's just what I have so far). private static final Semaphore semaphore = new Semaphore(3); public static Response doJob(Job job) throws Exception { final boolean tryAcquire = this.semaphore.tryAcquire(this.maxWaitTime, TimeUnit.MILLISECONDS); if (tryAcquire) { try { return doJobInNewTask(job); // we'd actually like to do all the jobs which are queued up waiting for the semaphore (if there are any) } finally { this.semaphore.release() } } }
tagged with: java
has comment: http://stackoverflow.com/comment/35257728
tagged with: java.util.concurrent
type: Question
tagged with: concurrency

http://stackoverflow.com/q/23028770
answer count: 1
tagged with: youtube-analytics
score: 0
has body: I have used you tube analytics api in which i can get analytics of channel and content owners by daywise but i want to get analytics of a specific video of youtube daywise. How to get it ?
has answer: http://stackoverflow.com/a/23029784
tagged with: youtube-api
has title: How to get analytics of a specific video of youtube daywise in java?
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23029784

http://stackoverflow.com/a/23067952
type: AcceptedAnswer
has body: That error means that for the document you are retrieving, the "choices" field is an object and not an array. So please use the mongo shell and verify that for the id that you're querying on the data is correct as you expect.
has comment: http://stackoverflow.com/comment/35256811
answers question: http://stackoverflow.com/q/23067022
type: Answer
accepted answer of: http://stackoverflow.com/q/23067022
has comment: http://stackoverflow.com/comment/35256056
has comment: http://stackoverflow.com/comment/35254417
has comment: http://stackoverflow.com/comment/35256694
score: 0

http://stackoverflow.com/q/22983399
has answer: http://stackoverflow.com/a/22983548
has comment: http://stackoverflow.com/comment/35097722
answer count: 5
has answer: http://stackoverflow.com/a/22983977
accepted answer: http://stackoverflow.com/a/22983977
has body: I have string {"AAA":xxxxx,"BB":xxxx,"CCC":"3 xxx"}, and I want to get the values of AAA , BB and CCC as my output.I am using substring method of string i am able to get only AAA metaDataValue = mettaDataValue.substring(metaDataValue.indexOf("")+1,metaDataValue.indexOf(":"));
has comment: http://stackoverflow.com/comment/35097754
has answer: http://stackoverflow.com/a/22983606
type: Question
has answer: http://stackoverflow.com/a/22983519
has title: Fetching values from string
has answer: http://stackoverflow.com/a/22983470
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35097900
has comment: http://stackoverflow.com/comment/35097831
linked to: http://stackoverflow.com/q/5490789
tagged with: string
has comment: http://stackoverflow.com/comment/35097765
score: 0
possible better answer: http://stackoverflow.com/a/22983470

http://stackoverflow.com/comment/35079474
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22972510
has text: What database are you referring to? If you simply need to do something minor, then include a sqlite database with your java app and use it. If you're using a large DB somewhere (Oracle, DB2, MySQL, PostgreSQL, etc), then you can't install it with your app.

http://stackoverflow.com/comment/35292104
has text: @rpg711 It's not redundant. Passing 0 length array will actually create a new array right away inside that method. My approach avoids an extra array creation.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23090339

http://stackoverflow.com/comment/35138350
comment on: http://stackoverflow.com/a/23005493
has text: try this, System.out.print("{ \"Otype\" : \""+jObject.getString("Otype")+"\"}");
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23074778
favorite count: 0
has body: Like the title says, I can get it to write the first thing to the file I want it to, but after that it doesn't write any more. I run it through the debugger, and see that it's not even reading the next line (I know this because it's not filling the array.) I tried manually advancing the pointer (I don't know if that's actually a thing you can do) at the end of the loop with "line = in.readline;", but It just throws a "nosuchelement" exception. Here's my try block" try { in = new BufferedReader(new FileReader("lab7input.txt")); outNormal = new PrintWriter(new File("normal.txt")); outVegetarian = new PrintWriter(new File("vegetarian.txt")); outPescetarian = new PrintWriter(new File("pescetarian.txt")); outInvalid = new PrintWriter(new File("invalid.txt")); String line = in.readLine(); StringTokenizer st = new StringTokenizer(line); while (line != null) { Scanner sc = new Scanner(line); while(sc.hasNext()) { if(st.countTokens() == 3) { attendee3[0] = sc.next(); attendee3[1] = sc.next(); attendee3[2] = sc.next(); if(Integer.parseInt(attendee3[2]) == 0) { outNormal.println(attendee3[0] + " " + attendee3[1]); outNormal.close(); } else if(Integer.parseInt(attendee3[2]) == 1) { outVegetarian.println(attendee3[0] + " " + attendee3[1]); outVegetarian.close(); } else if(Integer.parseInt(attendee3[2]) == 2) { outPescetarian.println(attendee3[0] + " " + attendee3[1]); outPescetarian.close(); } else { outInvalid.println(attendee3[0] + " " + attendee3[1]); outInvalid.close(); } } if(st.countTokens() == 4) { attendee4[0] = sc.next(); attendee4[1] = sc.next(); attendee4[2] = sc.next(); if(Integer.parseInt(attendee4[3]) == 0) { outNormal.println(attendee4[0] + " " + attendee4[1] + " " + attendee4[2]); outNormal.close(); } else if(Integer.parseInt(attendee4[3]) == 1) { outVegetarian.println(attendee4[0] + " " + attendee4[1] + " " + attendee4[2]); outVegetarian.close(); } else if(Integer.parseInt(attendee4[3]) == 2) { outPescetarian.println(attendee4[0] + " " + attendee4[1] + " " + att…
possible better answer: http://stackoverflow.com/a/23076295
answer count: 3
has answer: http://stackoverflow.com/a/23076295
has answer: http://stackoverflow.com/a/34894345
score: 1
has answer: http://stackoverflow.com/a/23074928
tagged with: output
upvote count: 1
accepted answer: http://stackoverflow.com/a/23074928
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35279934
has comment: http://stackoverflow.com/comment/35264635
has comment: http://stackoverflow.com/comment/35264762
has comment: http://stackoverflow.com/comment/35264705
has comment: http://stackoverflow.com/comment/35264676
has comment: http://stackoverflow.com/comment/35264711
has comment: http://stackoverflow.com/comment/35264601
type: Question
has title: Scanner won't read the next line from a file. JAVA
downvote count: 0
tagged with: bufferedreader

http://stackoverflow.com/comment/35360591
has text: Maybe you should use `Iterator<Person> it = p.iterator()`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23111863

http://stackoverflow.com/comment/35311134
type: QuestionComment
comment on: http://stackoverflow.com/q/23101171
score: 0
has text: ArrayList<String> cannot be used to hold Object, it only can hold String object. That is a limitation by design in java.
type: Comment

http://stackoverflow.com/comment/35208372
type: Comment
has text: That has nothing to do with sounds. You read all the bytes of an input stream, and then create a ByteArrayInputStream. Read the javadoc and the java IO tutorial.
comment on: http://stackoverflow.com/a/23044038
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35088281
comment on: http://stackoverflow.com/a/22977502
has text: you know the buttons do u think i can change the textsyle or add an image to it?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23003630
has comment: http://stackoverflow.com/comment/68076273
has comment: http://stackoverflow.com/comment/120960001
has comment: http://stackoverflow.com/comment/133380335
accepted answer of: http://stackoverflow.com/q/23003542
upvote count: 122
has body: You can just use the Guava Multimaps factory: ImmutableMultimap&lt;String, Foo&gt; foosById = Multimaps.index(foos, Foo::getId); or wrap a call to Multimaps.index with a Collector&lt;T, A, R&gt; interface (shown below, in an unoptimized naive implementation). Multimap&lt;String, Foo&gt; collect = foos.stream() .collect(MultimapCollector.toMultimap(Foo::getId)); and the Collector: public class MultimapCollector&lt;T, K, V&gt; implements Collector&lt;T, Multimap&lt;K, V&gt;, Multimap&lt;K, V&gt;&gt; { private final Function&lt;T, K&gt; keyGetter; private final Function&lt;T, V&gt; valueGetter; public MultimapCollector(Function&lt;T, K&gt; keyGetter, Function&lt;T, V&gt; valueGetter) { this.keyGetter = keyGetter; this.valueGetter = valueGetter; } public static &lt;T, K, V&gt; MultimapCollector&lt;T, K, V&gt; toMultimap(Function&lt;T, K&gt; keyGetter, Function&lt;T, V&gt; valueGetter) { return new MultimapCollector&lt;&gt;(keyGetter, valueGetter); } public static &lt;T, K, V&gt; MultimapCollector&lt;T, K, T&gt; toMultimap(Function&lt;T, K&gt; keyGetter) { return new MultimapCollector&lt;&gt;(keyGetter, v -&gt; v); } @Override public Supplier&lt;Multimap&lt;K, V&gt;&gt; supplier() { return ArrayListMultimap::create; } @Override public BiConsumer&lt;Multimap&lt;K, V&gt;, T&gt; accumulator() { return (map, element) -&gt; map.put(keyGetter.apply(element), valueGetter.apply(element)); } @Override public BinaryOperator&lt;Multimap&lt;K, V&gt;&gt; combiner() { return (map1, map2) -&gt; { map1.putAll(map2); return map1; }; } @Override public Function&lt;Multimap&lt;K, V&gt;, Multimap&lt;K, V&gt;&gt; finisher() { return map -&gt; map; } @Override public Set&lt;Characteristics&gt; characteristics() { return ImmutableSet.of(Characteristics.IDENTITY_FINISH); } }
type: Answer
has comment: http://stackoverflow.com/comment/61831320
answers question: http://stackoverflow.com/q/23003542
downvote count: 1
score: 121
has comment: http://stackoverflow.com/comment/60081124
has comment: http://stackoverflow.com/comment/56636430
type: AcceptedAnswer

http://stackoverflow.com/q/22972023
has answer: http://stackoverflow.com/a/22972095
type: UnansweredQuestion
has body: char[] input =new char[24]; for (int i=0; i&lt;24; i++){ input[i] = (char)('a'+i); } RandomAccessFile bf = new RandomAccessFile("data1.txt", "rw"); for(int i=0; i&lt;24; i++){ bf.writeChar(input[i]); } With Above code, when I open the file, it seems to be "abcd..." as I expected, but when I try to read the file RandomAccessFile rf1 = new RandomAccessFile("data1.txt", "r"); rf1.seek(0); System.out.println(rf1.readChar()); rf1.seek(1); System.out.println(rf1.readChar()); rf1.close(); It gives 'a' as expected but when seek(1) it gives me ? rather than b, why?
tagged with: java
tagged with: file
type: Question
tagged with: randomaccessfile
score: 0
has title: What is the format of writing and reading with RandomAcessFile
answer count: 2
has answer: http://stackoverflow.com/a/22972281

arrays
tags question: http://stackoverflow.com/q/23074694
tags question: http://stackoverflow.com/q/23037959
tags question: http://stackoverflow.com/q/23089671
tags question: http://stackoverflow.com/q/22999136
tags question: http://stackoverflow.com/q/23092996
tags question: http://stackoverflow.com/q/22976541
tags question: http://stackoverflow.com/q/23087082
tags question: http://stackoverflow.com/q/23097886
tags question: http://stackoverflow.com/q/23006962
tags question: http://stackoverflow.com/q/22992318
tags question: http://stackoverflow.com/q/23033173
tags question: http://stackoverflow.com/q/22973903
type: Tag
tags question: http://stackoverflow.com/q/22993727
tags question: http://stackoverflow.com/q/23127919
tags question: http://stackoverflow.com/q/23033480
tags question: http://stackoverflow.com/q/23000609
tags question: http://stackoverflow.com/q/23067608
tags question: http://stackoverflow.com/q/23124777
tags question: http://stackoverflow.com/q/22998936
tags question: http://stackoverflow.com/q/23120490
tags question: http://stackoverflow.com/q/23019064
tags question: http://stackoverflow.com/q/23041480
tags question: http://stackoverflow.com/q/23074560
tags question: http://stackoverflow.com/q/23109448
tags question: http://stackoverflow.com/q/23051882
tags question: http://stackoverflow.com/q/23038325
tags question: http://stackoverflow.com/q/23106936
tags question: http://stackoverflow.com/q/23044000
tags question: http://stackoverflow.com/q/23091903
tags question: http://stackoverflow.com/q/22987988
tags question: http://stackoverflow.com/q/23024957
tags question: http://stackoverflow.com/q/23052477
tags question: http://stackoverflow.com/q/23120131
tags question: http://stackoverflow.com/q/23003874
tags question: http://stackoverflow.com/q/23044423
tags question: http://stackoverflow.com/q/23067368
tags question: http://stackoverflow.com/q/23090043
tags question: http://stackoverflow.com/q/23001816
tags question: http://stackoverflow.com/q/23065743
tags question: http://stackoverflow.com/q/23057936
tags question: http://stackoverflow.com/q/23003271
tags question: http://stackoverflow.com/q/23126565
tags question: http://stackoverflow.com/q/23093070
tags question: http://stackoverflow.com/q/23047336
tags question: http://stackoverflow.com/q/23055505
tags question: http://stackoverflow.com/q/23051105
tags question: http://stackoverflow.com/q/22989806
tags question: http://stackoverflow.com/q/22975267
tags question: http://stackoverflow.com/q/23067717
tags question: http://stackoverflow.com/q/23052324
tags question: http://stackoverflow.com/q/22995146
tags question: http://stackoverflow.com/q/23122693
tags question: http://stackoverflow.com/q/22997719
tags question: http://stackoverflow.com/q/22986450
tags question: http://stackoverflow.com/q/23094602
tags question: http://stackoverflow.com/q/23036091
tags question: http://stackoverflow.com/q/23122059
tags question: http://stackoverflow.com/q/23124798
tags question: http://stackoverflow.com/q/22988694
tags question: http://stackoverflow.com/q/22976771
tags question: http://stackoverflow.com/q/23121473
tags question: http://stackoverflow.com/q/23049269
tags question: http://stackoverflow.com/q/22984004
tags question: http://stackoverflow.com/q/23069740
tags question: http://stackoverflow.com/q/23019150
tags question: http://stackoverflow.com/q/23097176
tags question: http://stackoverflow.com/q/23003753
tags question: http://stackoverflow.com/q/22996587
tags question: http://stackoverflow.com/q/23034679
tags question: http://stackoverflow.com/q/23015377
tags question: http://stackoverflow.com/q/22978161
tags question: http://stackoverflow.com/q/23110444
tags question: http://stackoverflow.com/q/23123785
tags question: http://stackoverflow.com/q/23065508
tags question: http://stackoverflow.com/q/23023472
tags question: http://stackoverflow.com/q/23043071
tags question: http://stackoverflow.com/q/23103812
tags question: http://stackoverflow.com/q/23101125
tags question: http://stackoverflow.com/q/23081451

http://stackoverflow.com/comment/35193391
comment on: http://stackoverflow.com/q/23032173
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [How do I use Google Json Parsing API (Gson) to parse some dynamic fields in my json?](http://stackoverflow.com/questions/4818567/how-do-i-use-google-json-parsing-api-gson-to-parse-some-dynamic-fields-in-my-j)

http://stackoverflow.com/comment/35285095
comment on: http://stackoverflow.com/a/23069773
has text: James I appreciate all the help. I'll accept the answer, what do I need to update?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23123369
has body: This would do it: public static void main(String[] args) { int startingInt = 1; //begin printing from 1 System.out.println("Up to what number?"); Scanner reader = new Scanner(System.in); int number = Integer.parseInt(reader.nextLine()); while (startingInt &lt;=number){ System.out.println(startingInt); startingInt++; } }
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23123277
downvote count: 0

http://stackoverflow.com/a/23003379
accepted answer of: http://stackoverflow.com/q/22995951
answers question: http://stackoverflow.com/q/22995951
downvote count: 0
score: 1
has body: some of that is not in the hibernate dialect, you can change left with substring, convert with cast. and as for patindex i couldn't find the substitution. you either can add pathindex to the constructor of the dialect that you use registerFunction( "patindex", new StandardSQLFunction("patindex") ); or create patindex() to a stored procedure. then you can use something like this: from Unit c order by cast(substring(name, 0, PATINDEX('%[^0-9]%', name + 'z')-1) as integer); or you can use locate() instead of patindex(), but i think it doesn't support regular expression.
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/23025604
has body: If the conditions are not always to be true, say bool3 needs to be false, you can use something like this maybe. Otherwise, as the other answers mentioned, an array would work best probably. int correctCount = 0; if (bool1) correctCount++; if (bool2) correctCount++; if (!bool3) correctCount++; if (correctCount == 3) { // do this } else { Toast.makeText(context, String.valueOf(correctCount) + " out of 3 correct", Toast.LENGTH_LONG).show(); }
upvote count: 1
answers question: http://stackoverflow.com/q/23025339
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35175730
type: Answer

http://stackoverflow.com/q/23044225
answer count: 3
has title: Represent date from long, starting from year 0 instead of 1970
score: 0
has comment: http://stackoverflow.com/comment/35208275
has answer: http://stackoverflow.com/a/23057832
accepted answer: http://stackoverflow.com/a/23057832
has answer: http://stackoverflow.com/a/23045449
possible better answer: http://stackoverflow.com/a/23044395
has comment: http://stackoverflow.com/comment/35208222
has answer: http://stackoverflow.com/a/23044395
duplicate of: http://stackoverflow.com/q/21667884
has body: I have a long-variable which represents an amount of delay in milliseconds. I want to transform this long to some kind of Date where it says how many hours, minutes, seconds, days, months, years have passed. When using Date toString() from Java, as in new Date(5).toString, it says 5 milliseconds have passed from 1970. I need it to say 5 milliseconds have passed, and 0 minutes, hours, ..., years.
has comment: http://stackoverflow.com/comment/35208219
tagged with: time
type: AnsweredQuestion
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/35208299
linked to: http://stackoverflow.com/q/21667884
type: Question
linked to: http://stackoverflow.com/q/2653567

http://stackoverflow.com/q/23027393
score: -3
has body: My Question is- Input is string. Return true if the String has exactly 1 character that appears twice in the string, 0 character that appear thrice in the string, and at least 1 character that appear four or more times in the string. There is a problem in my code and I am unable to find out the problem. public class CheckCharacterOccurence { static String testcase1 = "jjiiiiyy"; public static void main(String[] args) { CheckCharacterOccurence testInstance = new CheckCharacterOccurence(); boolean result = testInstance.checkCharacterOccurence(testcase1); System.out.println(result); } public boolean checkCharacterOccurence(String str) { char ch=' '; char ch1=' '; int temp=0; int temp1=0; int temp2=0; int count=0; for(int i=0;i&lt;str.length();i++){ ch=str.charAt(i); for(int j=i;j&lt;str.length();j++){ if(str.charAt(i)==str.charAt(j)){ ch1=str.charAt(i); count++; } } System.out.println(count); if(count==2&amp;&amp;ch!=ch1){ temp++; } if(count==3&amp;&amp;ch!=ch1){ temp1++; } if(count&gt;=4){ temp2++; } count=0; } if(temp==1&amp;&amp;temp1==0&amp;&amp;temp2&gt;=1){ return true; } return false; } }
has answer: http://stackoverflow.com/a/23027462
has comment: http://stackoverflow.com/comment/35178635
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/23027684
has comment: http://stackoverflow.com/comment/35178601
upvote count: 0
tagged with: string
has title: How can I check character occurrence in a string?
answer count: 3
has answer: http://stackoverflow.com/a/23027419
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35206677
comment on: http://stackoverflow.com/a/23042094
has text: By the way, it gives a warning for unchecked type cast when it returns this. Can something be done about it? I'm kinda ok with it anyway.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23070153
possible better answer: http://stackoverflow.com/a/23070203
type: Question
answer count: 2
has body: I have an AlertDialog.Builder that fires off when a user first opens the app if they do not have a network connection. The AlertDialogh as a NeutralButton that once clicked jumps into a startActivity. I get a leaked window error. Not sure how to fix this issue since I am not able to .dismiss() or .cancel() the AlertDialog. Is there another way to go about displaying this alert? This is inside onCreate if(isNetworkAvailable()){ checkVersion(); }else{ AlertDialog.Builder warning = new AlertDialog.Builder(this); warning.setCancelable(false); warning.setTitle("Network Connection Not Established"); warning.setMessage("Data will not be Synchronized. To have data Synchronized close the application and connect to WiFi or Cell Sevice Provider then Reopen."); warning.setNeutralButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { findView(); } }); warning.show(); } The checkVersion() works no issues it is the findView() that gives the error private void findView(){ locationId = datasource.selectSettingsLocation(); if(locationId != 0){ Intent intent = new Intent(Startup.this, Return.class); startActivity(intent); this.finish(); } else { Intent intent = new Intent(Startup.this, Main.class); startActivity(intent); this.finish(); } } The else is what is being triggered in this case Intent intent = new Intent(Startup.this, Main.class);
has comment: http://stackoverflow.com/comment/35256041
accepted answer: http://stackoverflow.com/a/23070482
score: 0
tagged with: android
has title: Window Leak issue when triggering an AlertDialog.Builder
tagged with: android-alertdialog
has answer: http://stackoverflow.com/a/23070203
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23070482
tagged with: java

http://stackoverflow.com/comment/35289367
score: 0
has text: You wrote "without declaring them protected (since that will expose them to the entire package)". Thats wrong. "protected" means only accessible to inheriting classes. This seems to be what you are looking for.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23088804

http://stackoverflow.com/a/23040018
answers question: http://stackoverflow.com/q/23037213
has body: Yes, your phenomenon is related to different padding strategies. The Java implementation uses PKCS5 (which is equivalent to PKCS7) while the PHP implementation uses zero padding (see under Parameteres-&gt;data), i.e. if the message is not large enough zero bytes are added. For future questions I would ask you to do some more thorough initial research. For my answer I just followed your lead by looking in the code to see what padding was actually specified, googled for the default padding used by mcrypt and already the answer.
has comment: http://stackoverflow.com/comment/35202968
type: Answer
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35202486

http://stackoverflow.com/q/22972179
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22972309
has body: I am making a custom button with a shape on it. This shape can for example be a cross (as for closing the window). The class works like this: you create a button with a Path2D as parameter. This Path2D has been made by another class before. Now this shape will be painted in the center of the button by a custom paint method (overridden from JButton). This would be my code to get the coordinates of the top left point of the bounding rectangle: Rectangle r = path.getBounds(); float x = button.getWidth() / 2 - r.width / 2 + x_offset; float y = button.getHeight() / 2 - r.height/ 2 + y_offset; I used these before and they work perfectly. Now as the method to draw a Shape on the screen is Graphics2D.draw(Shape s), and you can't specify any coordinates, I want to know how I can change the x and y coordinates of the bounding rectangle.
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: graphics
has title: How to move a Path in Graphics2D
tagged with: awt
accepted answer: http://stackoverflow.com/a/22972309
upvote count: 1

http://stackoverflow.com/q/23096129
answer count: 1
has title: Make Logback include the "T" between date and time in its "%date" format for strict ISO 8601 compliance
accepted answer: http://stackoverflow.com/a/23096247
favorite count: 0
score: 38
has answer: http://stackoverflow.com/a/23096247
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
upvote count: 38
has body: By default, the Logback encoder uses a date format similar to the ISO 8601 standard. But it lacks the "T" in the middle between the date and time portions. The T makes for easier parsing, and is required by the standard (unless private parties agree otherwise). Is there some trick to get Logback to include the T? This… 2006-10-20T14:06:49,812 instead of this… 2006-10-20 14:06:49,812 I suppose I could re-create the entire format while adding a "T", but I wonder if there is some simpler way.
has comment: http://stackoverflow.com/comment/139603007
tagged with: logback

http://stackoverflow.com/q/22974568
favorite count: 0
has comment: http://stackoverflow.com/comment/35083052
has comment: http://stackoverflow.com/comment/35083439
linked to: http://stackoverflow.com/q/2853347
has comment: http://stackoverflow.com/comment/35083447
tagged with: spring
has title: Spring attach data to the current transaction
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22974929
tagged with: transactions
tagged with: java
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/35082985
score: 4
accepted answer: http://stackoverflow.com/a/22974929
has comment: http://stackoverflow.com/comment/35083009
has body: Is there a way to access the current transaction in Spring ? My objective is to the add some information to the transaction when it starts and use that information in all method calls within the same transaction. Here is a solution with EJB: How can i attach data to a JTA transaction? (or uniquely identify it) I am looking for the same with spring.
answer count: 1
downvote count: 0

http://stackoverflow.com/q/22976572
has title: Why doesn't this GridBagLayout code work?
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/35086186
has answer: http://stackoverflow.com/a/22976639
tagged with: java
has comment: http://stackoverflow.com/comment/35088637
downvote count: 3
has comment: http://stackoverflow.com/comment/35131954
has comment: http://stackoverflow.com/comment/35103262
tagged with: gridbaglayout
upvote count: 0
tagged with: layout
has comment: http://stackoverflow.com/comment/35107093
has body: I have the code below. A similar code works. Also a friend said it should work. But it doesn't. Anyone have a clue? Thanks! Problem Description: Instead of painting the desired layout, everything is tiny small... .( import java.awt.Color; import java.awt.Dimension; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Image; import javax.swing.JButton; import javax.swing.JColorChooser; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; public class ChatGUI extends JPanel { private static final long serialVersionUID = -3069354983197916315L; private Image imgBackground; private GridBagLayout gblChat; private GridBagConstraints constraintsChat; private JPanel jPanelChat; private JList clientList; private JColorChooser font_chooser; private JButton privateMessage_button; private JButton sendMessage_button; private JScrollPane OutputOfChatMessages; private JScrollPane ShowConnectedClients; private JScrollPane InputOfChatMessage; public static void main(String[] args) { JFrame jf = new JFrame(); ChatGUI cg1 = new ChatGUI(500, 500); jf.add(cg1); jf.setExtendedState(Frame.MAXIMIZED_BOTH); jf.setVisible(true); } /** * Layout */ public ChatGUI(int width, int height) { // used for scaling this.setMinimumSize(new Dimension(width / 2, height / 4)); this.setPreferredSize(new Dimension(width / 2, height / 4)); jPanelChat = new JPanel(); gblChat = new GridBagLayout(); constraintsChat = new GridBagConstraints(); this.setLayout(gblChat); this.setBackground(Color.LIGHT_GRAY); constraintsChat.fill = GridBagConstraints.BOTH; /** * Panel 1 = OutputOfChatMessages */ OutputOfChatMessages = new JScrollPane(); constraintsChat.gridx = 0; constraintsChat.gridy = 0; constraintsChat.gridwidth = 1; constraintsChat.gridheight = 1; gblChat.setConstraints(OutputOfChatMessages, constraintsChat); this.add(OutputOfChatMessages); /** * Panel 2 = ShowConnectedClients */ ShowConnectedClients = …
score: -3
accepted answer: http://stackoverflow.com/a/22976639
has comment: http://stackoverflow.com/comment/35086288
type: Question
type: AnsweredQuestion
favorite count: 0

http://stackoverflow.com/a/23032914
answers question: http://stackoverflow.com/q/23032851
has body: Add this to your constructor. Random gen = new Random(); In your method, use that to return random string among your arraylist public String getRandom() { int index = gen.nextInt(piratewords.size()); return piratewords.get(index); }
score: 0
has comment: http://stackoverflow.com/comment/35189170
has comment: http://stackoverflow.com/comment/35189669
type: Answer

http://stackoverflow.com/q/23036271
has comment: http://stackoverflow.com/comment/35194295
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23038207
has comment: http://stackoverflow.com/comment/35194933
tagged with: java
has title: could we read an object directly into the bytebuffer in java?
has comment: http://stackoverflow.com/comment/35195430
type: Question
tagged with: bytebuffer
has body: Say I have a List&lt;Integer&gt; ls and I know its length could we allocate length*4 bytes for bytebuffer and use put to directlty read ls into the buffer?
score: 0
has answer: http://stackoverflow.com/a/23038207
answer count: 1

http://stackoverflow.com/comment/35449987
has text: Sorry, forgot to add mentioned link to example http://www.soapui.org/Functional-Testing/transferring-property-values.html#3-an-example-transferring-a-session-id-from-a-response-to-a-following-request
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23113574

http://stackoverflow.com/q/23035580
has answer: http://stackoverflow.com/a/23036444
has comment: http://stackoverflow.com/comment/35192989
has comment: http://stackoverflow.com/comment/35192958
tagged with: bluetooth
answer count: 2
possible better answer: http://stackoverflow.com/a/23035598
has title: Unfortunately (app) has stopped android developer error
has body: I am getting an "unfortunately (app) has stopped" error when I try to run my app on my android phone. The app is supposed to provide an easy interface for controlling a arduino with a bluetooth module Below is my Logcat. Please provide help with this error, I am a first time eclipse user so as many details as possible would be great. 04-12 14:14:54.848: D/AndroidRuntime(20026): Shutting down VM 04-12 14:14:54.848: W/dalvikvm(20026): threadid=1: thread exiting with uncaught exception (group=0x415a9b90) 04-12 14:14:54.858: E/AndroidRuntime(20026): FATAL EXCEPTION: main 04-12 14:14:54.858: E/AndroidRuntime(20026): Process: com.example.fridgeshoot, PID: 20026 04-12 14:14:54.858: E/AndroidRuntime(20026): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fridgeshoot/com.example.fridgeshoot.MainActivity}: java.lang.SecurityException: Need BLUETOOTH permission: Neither user 10117 nor current process has android.permission.BLUETOOTH. 04-12 14:14:54.858: E/AndroidRuntime(20026): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176) 04-12 14:14:54.858: E/AndroidRuntime(20026): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226) 04-12 14:14:54.858: E/AndroidRuntime(20026): at android.app.ActivityThread.access$700(ActivityThread.java:135) 04-12 14:14:54.858: E/AndroidRuntime(20026): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397) 04-12 14:14:54.858: E/AndroidRuntime(20026): at android.os.Handler.dispatchMessage(Handler.java:102) 04-12 14:14:54.858: E/AndroidRuntime(20026): at android.os.Looper.loop(Looper.java:137) 04-12 14:14:54.858: E/AndroidRuntime(20026): at android.app.ActivityThread.main(ActivityThread.java:4998) 04-12 14:14:54.858: E/AndroidRuntime(20026): at java.lang.reflect.Method.invokeNative(Native Method) 04-12 14:14:54.858: E/AndroidRuntime(20026): at java.lang.reflect.Method.invoke(Method.java:515) 04-12 14:14:54.858: E/AndroidRuntime(20026): at com.android.intern…
has answer: http://stackoverflow.com/a/23035598
accepted answer: http://stackoverflow.com/a/23036444
tagged with: android
type: AnsweredQuestion
score: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/35339360
score: 0
comment on: http://stackoverflow.com/q/23047417
type: Comment
type: QuestionComment
has text: say it is using the method found here http://stackoverflow.com/a/17047638/3529744

http://stackoverflow.com/comment/35209226
type: QuestionComment
comment on: http://stackoverflow.com/q/23044713
score: 0
has text: you don't show your `INSERT` query, so there's no way to tell. probably you're using an invalid date format, instead of the mysql required `yyyy-mm-dd hh:mm:ss`. If that date you're building in `calculateCurrentDateTime()` is what you're sending to mysql, then no wonder. It's not a valid mysql time string format. Plus, if you just need to insert the current date/time, do it in mysql `insert datefield VALUES (now())`. No need for all that string generation/mangling.
type: Comment

http://stackoverflow.com/q/23008322
has answer: http://stackoverflow.com/a/23008745
type: UnansweredQuestion
tagged with: java
has body: I have a requirement to set the session timeout of 40 seconds. I know we keep normally to 20 minutes. But my current application requirement is to keep the session timeout in seconds that is to 40 seconds. The web.xml is taking only integer value as 1 but it is not taking 0.6. Is there any way to write this? We are running our java web application on Apache tomcat server. The minimum value i am able to set in web.xml is 1 minute like: 1 I can set the session timeout to 40 seconds by using session.setMaxInactiveInterval(40); but the session.setMaxInactiveInterval(40); works only when the website is opened by the user. But as soon as the user closes the website session.setMaxInactiveInterval method will not work and the default web.xml takes control and again sets the session time out to 1 minute. Is there any way to set session timeout in seconds in web.xml by doing some tweaking?
has title: Is there any way to set session timeout in seconds in web.xml by doing some tweaking?
type: Question
answer count: 1
tagged with: tomcat
score: 0

http://stackoverflow.com/comment/35112365
has text: Interesting. Is it a some sort of design pattern?
comment on: http://stackoverflow.com/a/22990862
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/23138703
has comment: http://stackoverflow.com/comment/35379042
has body: According to the now closed question, it all boils down to tweet = tweet.replaceAll("@\\w+|#\\w+|\\bRT\\b", "") .replaceAll("\n", " ") .replaceAll("[^\\p{L}\\p{N} ]+", " ") .replaceAll(" +", " ") .trim(); The second line seems to be redundant as the third one does remove \n too. Changing the first line's replacement to " " doesn't change the outcome an allows to aggregate the replacements. tweet = tweet.replaceAll("@\\w*|#\\w*|\\bRT\\b|[^@#\\p{L}\\p{N} ]+", " ") .replaceAll(" +", " ") .trim(); I've changed the usernames and hashtags part to eating also lone # or @, so that it doesn't need to be consumed by the special chars part. This is necessary for corrent processing of strings like !@AshStewart09. For maximum performance, you surely need a precompiled pattern. I'd also re-suggest to use Guava's CharMatcher for the second part. Guava is huge (2 MB I guess), but you surely find more useful things there. So in the end you can get private static final Pattern PATTERN = Pattern.compile("@\\w*|#\\w*|\\bRT\\b|[^@#\\p{L}\\p{N} ]+"); private static final CharMatcher CHAR_MATCHER = CharMacher.is(" "); tweet = PATTERN.matcher(tweet).replaceAll(" "); tweet = CHAR_MATCHER.trimAndCollapseFrom(tweet, " ");
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35378899
upvote count: 1
has comment: http://stackoverflow.com/comment/35398572
has comment: http://stackoverflow.com/comment/35379122
answers question: http://stackoverflow.com/q/23115132
downvote count: 0

http://stackoverflow.com/q/23025618
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35176049
answer count: 1
has body: i have a csv file with comments, the values of which need to be split between two ArrayLists. eg: % the values below here should go % into ArrayList&lt;Integer&gt; list1 3,4,5,2,2,3 5,6,3,2,4,5 3,2,3,4,5,6 2,3,4,5,1,3 % the values below here should go % into ArrayList&lt;Integer&gt; list2 4,6,3,4,5,3 3,4,5,6,3,2 4,5,6,4,3,2 what is the best way of achieving this? should i use a counter that is incremented each time the state changes from % to a value or vice versa and then if counter % 2 = 0 then add a new ArrayList and start writing to that? thats the only way i can think to do it, but it seems a little bit clumsy, does anyone else have a better idea? EDIT: i have already written the code for actually parsing the csv values, i dont need help with that, just wondering about how to split the values into two lists..
has title: parsing split csv files in java
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/23025888
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/23094552
answer count: 1
tagged with: android
has body: 04-16 07:45:39.612: D/AndroidRuntime(362): Shutting down VM 04-16 07:45:39.612: W/dalvikvm(362): threadid=1: thread exiting with uncaught exception (group=0x40014760) 04-16 07:45:39.632: E/AndroidRuntime(362): FATAL EXCEPTION: main 04-16 07:45:39.632: E/AndroidRuntime(362): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.asd/com.example.asd.MainActivity}: java.lang.NullPointerException 04-16 07:45:39.632: E/AndroidRuntime(362): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1736) 04-16 07:45:39.632: E/AndroidRuntime(362): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752) 04-16 07:45:39.632: E/AndroidRuntime(362): at android.app.ActivityThread.access$1500(ActivityThread.java:123) 04-16 07:45:39.632: E/AndroidRuntime(362): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993) 04-16 07:45:39.632: E/AndroidRuntime(362): at android.os.Handler.dispatchMessage(Handler.java:99) 04-16 07:45:39.632: E/AndroidRuntime(362): at android.os.Looper.loop(Looper.java:126) 04-16 07:45:39.632: E/AndroidRuntime(362): at android.app.ActivityThread.main(ActivityThread.java:3997) 04-16 07:45:39.632: E/AndroidRuntime(362): at java.lang.reflect.Method.invokeNative(Native Method) 04-16 07:45:39.632: E/AndroidRuntime(362): at java.lang.reflect.Method.invoke(Method.java:491) 04-16 07:45:39.632: E/AndroidRuntime(362): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841) 04-16 07:45:39.632: E/AndroidRuntime(362): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) 04-16 07:45:39.632: E/AndroidRuntime(362): at dalvik.system.NativeStart.main(Native Method) 04-16 07:45:39.632: E/AndroidRuntime(362): Caused by: java.lang.NullPointerException 04-16 07:45:39.632: E/AndroidRuntime(362): at com.example.asd.MainActivity.onCreate(MainActivity.java:28) 04-16 07:45:39.632: E/AndroidRuntime(362): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1…
type: UnansweredQuestion
has title: Could not find method ...OnClickListener error
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23094946
score: 0

http://stackoverflow.com/comment/35306167
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23097890
has text: that doesn't matter. All that matters is Java and its version

http://stackoverflow.com/a/23102291
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23096314
downvote count: 0
has body: Well the first 99% are just fine: from space 13376K, 99% used this is just how the GC in the young generation works. Objects go from Eden to Survivor spaces(from space and to space) on minor GC and from survivor to old generation on major GC. While the second one: object space 92608K, 95% used is something that you should worry about, sort of. Old generation has about 100MB of space according to your logs, which is too little usually, but depends on the code you execute. You should measure your program more to get the accurate results, but still it seems that you are creating some long lived objects, which pile up in the old generation.

http://stackoverflow.com/q/22988114
tagged with: encryption
has comment: http://stackoverflow.com/comment/35108708
tagged with: x509
has answer: http://stackoverflow.com/a/22997698
accepted answer: http://stackoverflow.com/a/22997698
upvote count: 1
tagged with: php
has answer: http://stackoverflow.com/a/22990241
type: Question
tagged with: java
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/22990241
has comment: http://stackoverflow.com/comment/35194851
favorite count: 0
tagged with: phpseclib
has comment: http://stackoverflow.com/comment/35108257
has body: I have got cert public file from client which is in this format : 3082 024d 3082 01b6 a003 0201 0202 0453 3d78 5830 0d06 092a 8648 86f7 0d01 0104 0500 306b 310b 3009 0603 5504 0613 0255 5331 0b30 0906 0355 0408 1302 4e4a 3111 300f 0603 5504 0713 0853 6f6d 6572 7365 7431 1030 0e06 0355 040a 1307 4d65 744c 6966 6531 1630 1406 0355 040b 130d 496e 7374 6974 7574 696f 6e61 6c31 1230 1006 0355 0403 1309 6542 7573 696e 6573 7330 1e17 0d31 3430 3430 3331 3530 3335 325a 170d 3234 3033 3331 3135 3033 3532 5a30 6b31 0b30 0906 0355 0406 1302 5553 310b 3009 0603 5504 0813 024e 4a31 1130 0f06 0355 0407 1308 536f 6d65 7273 6574 3110 300e 0603 5504 0a13 074d 6574 4c69 6665 3116 3014 0603 5504 0b13 0d49 6e73 7469 7475 7469 6f6e 616c 3112 3010 0603 5504 0313 0965 4275 7369 6e65 7373 3081 9f30 0d06 092a 8648 86f7 0d01 0101 0500 0381 8d00 3081 8902 8181 00b8 7e8e f585 9bb9 7f08 41e7 391b 2a51 df24 c169 2957 8944 86f5 6548 09c8 b45d a6ad 4f59 4c33 47cc 886a 4db2 c4b5 b06c 7208 420a 5c62 d5e7 1ee2 62d7 1a57 0a10 d8d8 8e66 553b 98ec 6ad5 6c7e 8b64 c21a 82ca c928 e81b 3114 497c 9edd 9ce0 b821 a634 b231 b706 2c95 46df e56f d7c2 ff96 a3e5 48aa 525f b1b6 dfeb 7b1b 76d6 0c5b f302 0301 0001 300d 0609 2a86 4886 f70d 0101 0405 0003 8181 0020 6cc4 ca93 1898 1833 650e 9029 e57c 9357 193f e4c8 37fb 97a2 6140 586a b4f6 71c4 115b 7c64 da1d 344b 0028 4c63 d321 4c60 6519 d7a7 4ac4 79a3 438b 3290 22a8 a8d1 747b fa8e b5bd 606b 0e2d 2aad 61e1 4cba 7ffe 06dc a85b 326c 0cd0 7b42 2d7b a7c6 3cc4 da51 1eb0 dcd8 35e0 9fd9 d6ea 78dc 1eda 5055 9844 96bd 840b 804f c106 51 According to their guide I converted this key using this java code: public static void encodeCertFile (String fileInput, String fileOutput) throws Exception { KeyFactory keyFactory = KeyFactory.getInstance("RSA"); // create a client public key object from the client Certificate FileInputStream fis = new FileInputStream(fileInput); CertificateFactory cf = CertificateFactory.getInstance("X.509"); java.security.cert.Certificate cert = cf.generateCert…
type: AnsweredQuestion
has title: format of public key generated using java code
score: 1

http://stackoverflow.com/q/23057891
tagged with: matrix
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/30429494
type: UnansweredQuestion
tagged with: bigdata
upvote count: 1
score: 1
tagged with: java
type: Question
tagged with: hadoop
has title: matrix multiplication on hadoop
downvote count: 0
has body: I'm looking for the best and easy way of matrix multiplication on hadoop java. Meanwhile I looked at this link http://www.norstad.org/matrix-multiply/index.html but I felt tough to understand it. Overall: I've two files matrixA(m x n) and matrixB(n x m). I want matrixC(m x m) by multiplying A and B. I'll pass above two files to mapreduce program. Please help me..

http://stackoverflow.com/q/23084779
has answer: http://stackoverflow.com/a/24441165
has body: Qt has launched the Qt WebEngine project to make blink available, can I use Qt Jambi to use the Qt WebEngine feature?
upvote count: 2
answer count: 1
favorite count: 0
has title: Qt WebEngine for java?
tagged with: qt
score: 2
downvote count: 0
type: UnansweredQuestion
tagged with: java
tagged with: blink
type: Question

image
tags question: http://stackoverflow.com/q/23054232
tags question: http://stackoverflow.com/q/22994696
tags question: http://stackoverflow.com/q/22972365
tags question: http://stackoverflow.com/q/23044745
tags question: http://stackoverflow.com/q/23103969
tags question: http://stackoverflow.com/q/23081625
tags question: http://stackoverflow.com/q/23115640
tags question: http://stackoverflow.com/q/23028351
tags question: http://stackoverflow.com/q/22979352
tags question: http://stackoverflow.com/q/23061863
tags question: http://stackoverflow.com/q/23065497
tags question: http://stackoverflow.com/q/22984430
tags question: http://stackoverflow.com/q/23056090
tags question: http://stackoverflow.com/q/23096006
tags question: http://stackoverflow.com/q/22998039
tags question: http://stackoverflow.com/q/23055355
tags question: http://stackoverflow.com/q/23006995
tags question: http://stackoverflow.com/q/23068938
tags question: http://stackoverflow.com/q/23006048
tags question: http://stackoverflow.com/q/23035169
tags question: http://stackoverflow.com/q/22987573
tag name: image
tags question: http://stackoverflow.com/q/23078406
tags question: http://stackoverflow.com/q/23005394
tags question: http://stackoverflow.com/q/23014112
type: Tag
tags question: http://stackoverflow.com/q/23086887

http://stackoverflow.com/q/23107263
type: Question
tagged with: postconstruct
tagged with: java
has answer: http://stackoverflow.com/a/23109294
answer count: 1
has title: Spring Roo @PostConstruct not being called
has comment: http://stackoverflow.com/comment/35321328
has body: I have the following config file: &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:task="http://www.springframework.org/schema/task" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt; &lt;!-- This will automatically locate any and all property files you have within your classpath, provided they fall under the META-INF/spring directory. The located property files are parsed and their values can then be used within application context files in the form of ${propertyKey}. --&gt; &lt;context:property-placeholder location="classpath*:META-INF/spring/*.properties"/&gt; &lt;!-- Turn on AspectJ @Configurable support. As a result, any time you instantiate an object, Spring will attempt to perform dependency injection on that object. This occurs for instantiation via the "new" keyword, as well as via reflection. This is possible because AspectJ is used to "weave" Roo-based applications at compile time. In effect this feature allo…
tagged with: spring
score: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35260560
has text: @Human Nothings changed ... just your understanding ;). Been using `GridBagLayout` for over 15 years and it still teaches me something new on occasions ;)
comment on: http://stackoverflow.com/a/23072523
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/23071463
answer count: 2
upvote count: 1
linked to: http://stackoverflow.com/q/10924294
favorite count: 0
tagged with: fedex
has title: FedEx tracking API error 9040 - Java Web Services
type: UnansweredQuestion
tagged with: soap
has answer: http://stackoverflow.com/a/23138914
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35258732
has comment: http://stackoverflow.com/comment/35258558
linked to: http://stackoverflow.com/q/18065390
tagged with: web-services
type: Question
has body: I have an assignment that requires me to use FedEx's tracking API using Java to communicate with their server. I downloaded all the client code from their developer website. I added my credentials to the source code and attempted to test the code using some tracking numbers I have. When testing the numbers on the tracking website I get the confirmation that things have been delivered to their locations. But when I try using the same values with the supplied client code I get this error message: Message: No information for the following shipments has been received by our system yet. Please try again or contact Customer Service at 1.800.Go.FedEx(R) 800.463.3339. After googleing the issue I found this solution (A stackoverflow thread): Fedex Web Services: ERROR 9040 - Can&#39;t pull up tracking I tried this solution by changing the PortType locaiton from https://wsbeta.fedex.com:443/web-services/track to https://ws.fedex.com:443/web-services/track But all that happens now is that I get no response at all. Here are links to the source code that I am working with (I would paste it but its close to 600 lines) Client code: http://pastebin.com/9xwraHYP Service PortType Provider: http://pastebin.com/ZVkqsAuv Any help will be greatly appreciated.
has answer: http://stackoverflow.com/a/27058531

http://stackoverflow.com/q/22977876
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22978032
has title: Term (word) extraction from text file without duplication of term using Java
tagged with: java
downvote count: 2
accepted answer: http://stackoverflow.com/a/22978032
has comment: http://stackoverflow.com/comment/35092544
type: Question
type: AnsweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/35088451
has body: I need the specification and implementation of a new data type that holds terms extracted from document(s). Such a data type will not allow duplication of terms in each instance. A minimum of: 1 creator method, 3 mutator methods, 3 observer methods are required. Also,a separate test program is to be implemented to read a text document (provided by a user) and extract each term contained in the document. Extracted terms from a single document will be stored in an instance of the newly created data type, i.e. for each text document, there will be an instance of the newly created data to hold terms extracted from the document.
has comment: http://stackoverflow.com/comment/35088537

http://stackoverflow.com/a/23149170
has comment: http://stackoverflow.com/comment/35398199
has comment: http://stackoverflow.com/comment/35400489
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35398345
type: Answer
has comment: http://stackoverflow.com/comment/35401348
has comment: http://stackoverflow.com/comment/35399670
has comment: http://stackoverflow.com/comment/35416352
has comment: http://stackoverflow.com/comment/35411792
answers question: http://stackoverflow.com/q/23103028
upvote count: 1
has comment: http://stackoverflow.com/comment/35400318
has comment: http://stackoverflow.com/comment/35400169
has body: I have seen your code for your given link and thats why I am posting a new Ans. One thing if you read your code carefully, you have declared ArrayAdapter&lt;String&gt; in Monday_fragment, so this list initialize every time when you replace this fragment with other. So just create a ArrayAdapter&lt;String&gt; in MainActivity and getter, setter for the same and change your methode ArrayList&lt;String&gt; toStringList(Collection&lt;DiaryLogs&gt; entryLogs) in the Monday_fragment like below public ArrayList&lt;String&gt; toStringList(Collection&lt;DiaryLogs&gt; entryLogs) { ArrayList&lt;String&gt; stringList = ((MainActivity)getActivity()).getMyStringList(); for (DiaryLogs myobj : entryLogs) { String objctString = myobj.toString(); stringList.add(objctString); } ((MainActivity)getActivity()).setMyStringList(stringList); return stringList; }

http://stackoverflow.com/comment/35143009
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23008295
type: AnswerComment
has text: I know how to make it visible. But how can I implement the code that runs when I close the current frame please?

http://stackoverflow.com/comment/35194432
type: AnswerComment
comment on: http://stackoverflow.com/a/23036279
type: Comment
score: 1
has text: Be careful, you are talking about a column, _id is not a row. With your code you are skipping all the data the lies in the first row of the table.

http://stackoverflow.com/q/22978245
tagged with: multithreading
tagged with: android
has answer: http://stackoverflow.com/a/26114266
has comment: http://stackoverflow.com/comment/35089732
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 15
tagged with: crash
answer count: 2
accepted answer: http://stackoverflow.com/a/26114266
score: 15
has comment: http://stackoverflow.com/comment/49233714
possible better answer: http://stackoverflow.com/a/30581742
has title: How to prevent android app from crashing due to exception in background thread?
has answer: http://stackoverflow.com/a/30581742
downvote count: 0
has comment: http://stackoverflow.com/comment/35121065
linked to: http://stackoverflow.com/q/2764394
favorite count: 0
tagged with: exception
has body: It's a general question, which raised from specific scenario, but I'd like to get a general answer how to deal with the following situation: Background: I have an app, which is using some 3rd party library (ad network provider SDK - specifically - AdMob SDK, based on Google Play Services). Functionality of this library is not critical for the application. The library creates one or more background worker threads. Sometimes (very rare case) there is an unhandled exception in one of these background threads, causing to crashing the application. I'd like to ignore all exceptions, caused by this library, regardless of their cause: in worst case the app user will not see an ad - it's much better than app crash. Since the library itself creates the background threads - I cannot just wrap them by try/catch. Question Is there any way to catch all non-handled background (non-main) thread exceptions and just to kill the thread in such case, and to prevent app crash? Related questions I saw a lot of several questions, but some of them are too specific (and not covering my case), others refer to situation when the developer has a control on thread creation and is able to wrap the whole thread with try/catch. If I still missed the relevant question, covering this case, I will appreciate the link

http://stackoverflow.com/a/23109940
type: Answer
has body: Use Trim() method like below, public int Cal(String ab) { String[] arr=ab.split(":"); int av = ( Integer.parseInt(arr[0].trim())*60 + Integer.parseInt(arr[1].trim()))*1000; return av; } trim() will remove spaces. Whenever you are trying to convert numeric string to number ( i.e. "11 " ), you should always remember to use trim() to avoid NumberFormatException
answers question: http://stackoverflow.com/q/23109869
accepted answer of: http://stackoverflow.com/q/23109869
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/35248987
has text: Are you using a webserver that supports WebSockets?
comment on: http://stackoverflow.com/q/23066125
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35190728
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23034303
type: Comment
has text: And then open a new command prompt to get the new environment variable settings

http://stackoverflow.com/comment/35257187
type: QuestionComment
comment on: http://stackoverflow.com/q/23070613
has text: That combined with `Character.isLetter(char)` would work.
score: 0
type: Comment

http://stackoverflow.com/q/23021354
has body: Is the following class immutable? If not, why? How can I change the fields? public class Student { private String name; private String age; public Student(String name, String age) { this.name = name; this.age = age; } public String getName() { return name; } public String getAge() { return age; } }
upvote count: 5
has answer: http://stackoverflow.com/a/23021564
has comment: http://stackoverflow.com/comment/35167625
downvote count: 1
has comment: http://stackoverflow.com/comment/35167659
answer count: 4
tagged with: immutability
has comment: http://stackoverflow.com/comment/35167683
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23034740
has comment: http://stackoverflow.com/comment/35167675
type: Question
has comment: http://stackoverflow.com/comment/35167622
has comment: http://stackoverflow.com/comment/35168183
has comment: http://stackoverflow.com/comment/35168038
has comment: http://stackoverflow.com/comment/35167704
tagged with: java
has comment: http://stackoverflow.com/comment/35167626
has answer: http://stackoverflow.com/a/23021613
has comment: http://stackoverflow.com/comment/35167829
has answer: http://stackoverflow.com/a/23021386
has comment: http://stackoverflow.com/comment/35167769
score: 4
has title: Is a public class with getters only an Immutable class?
has comment: http://stackoverflow.com/comment/35169419
favorite count: 0

http://stackoverflow.com/comment/40979476
has text: thanks for this, how would I determine whether it's taken as octal base or some other base?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23039885

http://stackoverflow.com/q/23050695
possible better answer: http://stackoverflow.com/a/23610596
accepted answer: http://stackoverflow.com/a/23050871
type: Question
has answer: http://stackoverflow.com/a/23610596
tagged with: plugins
tagged with: java
answer count: 3
tagged with: eclipse
upvote count: 10
tagged with: gradle
has body: I used libGDX to generate some gradle projects that I now need to import into Eclipse. So, I opened Eclipse, installed the gradle plugin, and went to File -> Import -> Gradle Project. At that point, I chose the directory that contained my generated gradle projects. Then, I clicked 'Build Model' and then added my projects to the list of available projects to import. After I select 'Finish' Eclipse begins importing them. Right at the very end I get this dialog: Looking in the log file, I found this stack trace: java.lang.NullPointerException at org.springsource.ide.eclipse.gradle.core.wizards.GradleImportOperation.refreshProjects(GradleImportOperation.java:256) at org.springsource.ide.eclipse.gradle.core.wizards.GradleImportOperation.perform(GradleImportOperation.java:195) at org.springsource.ide.eclipse.gradle.ui.wizards.GradleImportWizard$1.doit(GradleImportWizard.java:66) at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable$1.run(GradleRunnable.java:49) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53) I've tried reinstalling everything relevant. I've created the projects several times. I've downloaded a fresh version of eclipse. But, the same issue occurs everytime. Any help would be great. Thank you.
tagged with: libgdx
has answer: http://stackoverflow.com/a/23050871
downvote count: 0
has answer: http://stackoverflow.com/a/55584163
has title: Null Pointer Importing Gradle Project Into Eclipse
type: AnsweredQuestion
score: 10
favorite count: 0

http://stackoverflow.com/a/23003171
has comment: http://stackoverflow.com/comment/35134007
score: 0
type: AcceptedAnswer
has body: The answer to this question depends a lot on the nature of your data. If you have sparse data (mostly 0's and very few 1's or vice versa), then creating an array of indices of 1's might do the trick for you. As David Wallace mentioned, a HashSet of indices would allow you to quickly check whether a particular index is 1 or 0. If you do not have sparse data, then you might want a BitSet. This discussion might also be useful to give you input.
type: Answer
accepted answer of: http://stackoverflow.com/q/23003036
answers question: http://stackoverflow.com/q/23003036

http://stackoverflow.com/q/23119980
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has body: I am attempting to learn a bit about Java Faces using the Oracle/Sun JavaEE tutorial as I learn about Java EE in general. I ran into something that's been bothering me that I can't seem to fix. In an xhtml page the following block of code: &lt;p&gt;I've made your &lt;h:link outcome="personal" value="personal greeting page!" includeViewParams="true"&gt; &lt;f:param name="Result" value="#{hello.name}"/&gt; &lt;/h:link&gt; &lt;/p&gt; Get's displayed like: I've made yourpersonal greeting page! For some reason it's not recognizing the space between the word your, and the start of the link. When I look at the HTML source, it looks like its been trimmed out entirely. I've tried both manually adding an &amp;nbsp; and I've tried turning whitespace compression off in the WEB-INF/faces-config.xml Does anyone have an explanation for this behaviour and a way to fix it?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35345062
has comment: http://stackoverflow.com/comment/35370793
has title: Whitespace being removed between word and link in JSF page
tagged with: jsf
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23140244
tagged with: myfaces
type: Question
linked to: http://stackoverflow.com/q/1356220

http://stackoverflow.com/a/23037139
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/23026374
type: Answer
answers question: http://stackoverflow.com/q/23026374
has body: Like kleopatra suggested, use a JDesktopPane to add your JInternalFrames. I made a very simple (and i hope) easy to understand example for you, i created a JFrame with one JTabbedPane on it which contains 2 Tabs with a JPanel conainting a JDesktopPane. By clicking on the MenuItem addInternalFrame a boolean value is checked and the "right" Desktop to add is choosen ;) By clicking the removeInteralFrame MenuItem you remove the last added JInternalFrame. Try it, maybe it will help you. This is the MainFrame class import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.HashMap; import java.util.Map; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTabbedPane; public class MainFrame extends JFrame implements ActionListener { JMenuItem addInternalFrame; JMenuItem removeInternalFrame; JTabbedPane tabbedPane; JPanel tabPanel1; JPanel tabPanel2; JDesktopPane tabDesktopPane1; JDesktopPane tabDesktopPane2; boolean tab1Added = false; public MainFrame(final String title) { this.setTitle(title); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); tabbedPane = initComponents(); this.setJMenuBar(initMenuBar()); this.getContentPane().add(tabbedPane); this.setSize(new Dimension(1024, 768)); this.setVisible(true); } private JTabbedPane initComponents() { JTabbedPane jTabbedPane = new JTabbedPane(); tabDesktopPane1 = new JDesktopPane(); tabDesktopPane2 = new JDesktopPane(); tabPanel1 = new JPanel(); tabPanel1.add(tabDesktopPane1); tabPanel2 = new JPanel(); tabPanel2.add(tabDesktopPane2); jTabbedPane.setTabPlacement(JTabbedPane.TOP); jTabbedPane.addTab("Tab1", tabDesktopPane1); jTabbedPane.addTab("Tab2", tabDesktopPane2); return jTabbedPane; } private JMenuBar initMenuBar() { JMenuBar menuBar …

http://stackoverflow.com/q/23095997
tagged with: jlist
type: UnansweredQuestion
tagged with: swing
has body: When the jlist only has a couple rows in it, I don't want the scroll bar to be able to scroll down because there is no need. Also, I am able to click on the empty rows, which highlights the row, even though it is empty. How can I disable the ability to highlight the row? public ProductApplication() { //WEST PANEL JPanel west = new JPanel(new BorderLayout()); west.setBorder(BorderFactory.createMatteBorder( 5, 5, 5, 5, Color.blue)); west.add(new JTextField("Products"), BorderLayout.NORTH); pList = new JList(product); pList.setFixedCellHeight(20); pList.setFixedCellWidth(100); west.add(pList, BorderLayout.CENTER); scrollpane = new JScrollPane(pList); west.add(scrollpane, BorderLayout.WEST); add(west, BorderLayout.WEST);
tagged with: java
has title: How to disable JScrollBar when the JList inside JScrollPane does not fill entire area?
tagged with: jscrollbar
has answer: http://stackoverflow.com/a/23102360
type: Question
tagged with: jscrollpane
answer count: 1
score: 0

http://stackoverflow.com/comment/35317264
has text: @c all right let me check it
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23104762

http://stackoverflow.com/comment/35290195
has text: Given that zeroing out memory wholesale is cheaper than zeroing it out piecemeal, and a lot of newly-allocated memory will need to be zero, I would think it would be cheaper to have the GC bulk-zero freed memory, and know that it had done so, saving the need to zero out bits and pieces of it later.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23087417

http://stackoverflow.com/q/23096822
has body: public double intersect(Ray r) { double t; Vector L = r.origin.sub(pos); double a = r.direction.dot(r.direction); double b = 2*(r.direction.dot(L)); double c = (L.dot(L)) - (radius*radius); double disc = b*b - 4*a*c; if (disc &lt; 0) return -1; double distSqrt = Math.sqrt(disc); double q; if (b &lt; 0) q = (-b - distSqrt)/2; else q = (-b + distSqrt)/2; double t0 = q/a; double t1 = c/q; if (t0 &gt; t1) { double temp = t0; t0 = t1; t1 = temp; } if (t1 &lt; 0) return -1; if (t0 &lt; 0) t = t1; else t = t0; return t; } It should return -1 when there is no intersection. There is a sphere at (5,0,0) with a radius of 2. When I pass a ray with origin (0,0,0) and direction (5,0,0).unit, it returns 3 as it should. When I pass a ray with origin (0,0,0) and direction (5,2,0).unit, it returns 3.9 as it should. When I pass a ray with origin (0,0,0) and direction (5,0,1).unit, it returns -1, even though the ray intersects. When the direction is (5,0,-1).unit, it returns 2.73, even though it is not possible for t to be less than 3 and it should return the same thing as (5,0,1).unit returns.
downvote count: 0
has title: Ray-sphere intersection method not working
favorite count: 0
accepted answer: http://stackoverflow.com/a/23098440
has answer: http://stackoverflow.com/a/23141118
possible better answer: http://stackoverflow.com/a/23141118
upvote count: 3
type: Question
type: AnsweredQuestion
score: 3
tagged with: raytracing
has answer: http://stackoverflow.com/a/23098440
tagged with: java
answer count: 2

http://stackoverflow.com/a/25045148
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38968231
downvote count: 0
answers question: http://stackoverflow.com/q/23097656
type: Answer
has body: Information on training Stanford NLP RNTN is provided by mbatchkarov. In general, non-English Sentiment Analysis is still a work in progress and many methods - especially those that go beyond bag-of-words - may need to be substantially rethought in order to be applicable to another language. For example, aggulutinative languages like Turkish or German (i.e. languages that crunch a lot of words into one big word) aren't even going to jive that well on a number of text-mining and sentiment analysis tasks. Try googling sentiment analysis for Hindi. One interesting paper I found was this one by Mittal, et al.

http://stackoverflow.com/q/23120490
tagged with: java
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/23120640
tagged with: arrays
answer count: 1
has title: Error when looping on keyboard input
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: input
upvote count: 1
has body: I have a loop that is supposed to store information into an array of objects, but for some reason, it always skips the first input. public class GerbilData { public static void main(String[] args){ Scanner keyboard = new Scanner(System.in); System.out.println("How many different food items do the gerbils eat?"); int n1 = keyboard.nextInt(); Food[] gerbilFood = new Food[n1]; String temp; int temp2; int count = 1; for (int a = 0; a &lt; n1; a++){ gerbilFood[a] = new Food(); } int j = 0; while (j &lt; n1){ System.out.println("Name of food item " + count + ":"); temp = keyboard.nextLine(); gerbilFood[j].setName(temp); count++; j++; }
tagged with: object
score: 1

http://stackoverflow.com/comment/35276607
comment on: http://stackoverflow.com/q/23081798
type: Comment
type: QuestionComment
has text: When you do n = 8, it should get 11, but it gets 26
score: 0

http://stackoverflow.com/q/23043639
answer count: 0
tagged with: java
tagged with: accesscontrolexception
type: Question
tagged with: security
has comment: http://stackoverflow.com/comment/35226932
score: 0
has body: My problem is that program cannot read file (I also don't see pop-up permission window when it's loading!) It's a JNLP file, in it I got (but still I don't see any pop-ups): &lt;security&gt; &lt;all-permissions/&gt; &lt; /security&gt; when I execute that file it download some data and run normaly but when I try to load file I get an error: java.security.AccessControlException: access denied ("java.io.FilePermission" (...) ) I tried to give permision through java system setting and I also tried to change policy files but still it doesnt work.
has title: JNLP read file permission
tagged with: jnlp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35226981

http://stackoverflow.com/comment/35354092
has text: what is the name of this xml file?
comment on: http://stackoverflow.com/q/23125211
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23121034
answers question: http://stackoverflow.com/q/23117137
score: 1
type: AcceptedAnswer
has body: The problem is that @OneToMany can only have as inverse @ManyToOne, and not @OneToOne. @OneToOne can only have as mappedBy another @OneToOne, check the javadoc for those methods. The mapping bellow gives you the meaning you want: one user can have many addresses, but an address can only refer to only one user using the id in the foreign key specified in @JoinColumn: @Entity public class User { @Id @GeneratedValue(strategy= GenerationType.AUTO) protected Long id; ... @OneToMany(mappedBy="user") private Set&lt;Address&gt; adresses; } @Entity public class Address { @Id @GeneratedValue(strategy= GenerationType.AUTO) protected Long id; ... @ManyToOne(optional=false) @JoinColumn("your_foreign_key_name") private User user; }
downvote count: 0
has comment: http://stackoverflow.com/comment/35378203
accepted answer of: http://stackoverflow.com/q/23117137
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35353127

http://stackoverflow.com/q/23054587
has answer: http://stackoverflow.com/a/23059926
has title: Convert string to any object
score: 0
tagged with: groovy
has comment: http://stackoverflow.com/comment/35227215
answer count: 1
has comment: http://stackoverflow.com/comment/35227792
tagged with: string
has comment: http://stackoverflow.com/comment/35227410
has comment: http://stackoverflow.com/comment/35227183
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35227371
tagged with: dynamic
tagged with: java
has body: I'm wondering on how to convert a string to any data type dynamically. Example, I have these: String dataType String value Then, these fields will be populated from the database. dataType = "java.lang.Integer" value = "42" So, I want is to convert "42" (String) to 42 (int) I have solutions in mind: Use Class.cast(Object) Switch for every data type, and use an according parse method. ex: Integer.parseInt(String) or new BigDecimal(String) Use reflection methods for casting. Any ideas guys? (I won't be using external libraries) Also, Groovy solutions are accepted.
accepted answer: http://stackoverflow.com/a/23059926
type: Question
tagged with: casting
has comment: http://stackoverflow.com/comment/35227560
has comment: http://stackoverflow.com/comment/35227516

http://stackoverflow.com/a/23079226
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/23078832
type: AcceptedAnswer
downvote count: 0
has body: The flaw is that your merge doesn't copy symbols from right part if left[i1] - right[i2] > 0. This works: public static void merge(char[] string, char[] left, char[] right) { int i1 = 0; int i2 = 0; for (int i = 0; i &lt; string.length; i++) { if (i1 &lt; left.length &amp;&amp; i2 &lt; right.length) { if (left[i1] - right[i2] &lt;= 0) { string[i] = left[i1]; i1++; } else { string[i] = right[i2]; i2++; } } else if (i2 &gt;= right.length) { string[i] = left[i1]; i1++; } else { string[i] = right[i2]; i2++; } } } You have three cases: There are symbols available in both parts. Take one with the least value. There are symbols available only in the left part. Copy them. There are symbols available only in the right part. Copy them.
accepted answer of: http://stackoverflow.com/q/23078832
type: Answer
has comment: http://stackoverflow.com/comment/35272097

http://stackoverflow.com/q/23006152
upvote count: 1
has comment: http://stackoverflow.com/comment/35139702
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23006197
has body: i can't understand the following program, how to achieve polymorphism in this coding, please explain in simple way...because i am not strong knowledge in java... class Animal { eat() //here this class has one method } class Dog extends Animals {} class Cat extends Animals {} class Wolf extends Animals {} class MyMain { public static void main(String args[]) { Animals[] A=new Animals[3]; A[0]=new Dog(); //parent object reference is used to refer child object A[1]=new Cat(); A[2]=new Wolf(); for(int i=0;i&lt;3;i++) A[i].eat(); } please anybody explain this which book i have to study for improve knowledge in java?
tagged with: java
downvote count: 7
type: Question
score: -6
answer count: 6
has answer: http://stackoverflow.com/a/23006285
has answer: http://stackoverflow.com/a/23006260
has title: how to achieve polymorphism in java
possible better answer: http://stackoverflow.com/a/23006196
has answer: http://stackoverflow.com/a/23006197
has answer: http://stackoverflow.com/a/23006202
has answer: http://stackoverflow.com/a/23006196
has answer: http://stackoverflow.com/a/23006542
favorite count: 0
has comment: http://stackoverflow.com/comment/35139072

http://stackoverflow.com/comment/35302786
type: Comment
comment on: http://stackoverflow.com/a/23095139
score: 1
type: AnswerComment
has text: Why do people use emulators at all? I just plug my phone in... the emulator is so slow that compared to just plugging in the phone it seems totally useless!

struts2
tags question: http://stackoverflow.com/q/22987082
tags question: http://stackoverflow.com/q/23024464
tags question: http://stackoverflow.com/q/22983889
tags question: http://stackoverflow.com/q/23057098
tags question: http://stackoverflow.com/q/23031984
tags question: http://stackoverflow.com/q/23048532
tags question: http://stackoverflow.com/q/22984985
tags question: http://stackoverflow.com/q/23111928
tag name: struts2
tags question: http://stackoverflow.com/q/23012400
tags question: http://stackoverflow.com/q/23082573
tags question: http://stackoverflow.com/q/23075594
tags question: http://stackoverflow.com/q/23002058
tags question: http://stackoverflow.com/q/23126587
tags question: http://stackoverflow.com/q/23029966
tags question: http://stackoverflow.com/q/23042648
tags question: http://stackoverflow.com/q/23087554
tags question: http://stackoverflow.com/q/23008757
tags question: http://stackoverflow.com/q/23077771
tags question: http://stackoverflow.com/q/23061685
tags question: http://stackoverflow.com/q/23056044
tags question: http://stackoverflow.com/q/23011391
tags question: http://stackoverflow.com/q/23108934
tags question: http://stackoverflow.com/q/22995419
tags question: http://stackoverflow.com/q/23057096
tags question: http://stackoverflow.com/q/23078603
tags question: http://stackoverflow.com/q/23114591
tags question: http://stackoverflow.com/q/22990182
tags question: http://stackoverflow.com/q/23057414
tags question: http://stackoverflow.com/q/23098478
type: Tag
tags question: http://stackoverflow.com/q/22979162
tags question: http://stackoverflow.com/q/22969405
tags question: http://stackoverflow.com/q/23039505

http://stackoverflow.com/a/23036746
has comment: http://stackoverflow.com/comment/35198574
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23036686
has body: Do a loop { 1. Take a string from your list. 2. Split this string with the String.split method using comma as separator. 3. Take the element at position 0 from the array returned by split. }
accepted answer of: http://stackoverflow.com/q/23036686
type: Answer

http://stackoverflow.com/comment/35161063
score: 0
type: AnswerComment
has text: not exactly, there is a "buy" button, when i enter the button, i check whether or not the user is login, if not, it should show a dialog and lead to another activity to login, after login, the login activity finish(), back to the original activity, when logined, it will check the money in my account is or not more than the price of this commodity, so, first i need get the money from the database by using the userID and get the totalPrice, and then execute the if statement to check, if money is inadequate, it shows a dialog. if adequate, shows another dialog
type: Comment
comment on: http://stackoverflow.com/a/23017443

http://stackoverflow.com/q/23075000
has body: Is there exists CSS selector that works only when transforming html to pdf with flying saucer, and doesn't work when opening this html? I need something like this @page OnlyForFlyingSaucer { body { font-size: 16px; } } Thanks!
downvote count: 0
accepted answer: http://stackoverflow.com/a/23075909
type: Question
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/pdf
tagged with: http://stackoverflow.com/tag/html
tagged with: flying-saucer
favorite count: 0
upvote count: 2
tagged with: css
answer count: 1
has title: CSS selector only for Flying saucer
has answer: http://stackoverflow.com/a/23075909
tagged with: java
score: 2

http://stackoverflow.com/a/23243665
score: 0
type: Answer
has body: Why you need this below config? <bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" p:prefixJson="true" /> I think it will work well when you remove above bean.
answers question: http://stackoverflow.com/q/23117797

http://stackoverflow.com/comment/35120372
comment on: http://stackoverflow.com/q/22994479
has text: Measure it and you'll know the answer.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23072687
answer count: 2
favorite count: 0
has body: I am trying to creating objects in a loop. while executing this i am getting NullPointer Exception like below:: Exception in thread "main" java.lang.NullPointerException at Test1.main(Test1.java:14) Test1.java public class Test1 { public static void myMethod(int i) { System.out.println("calling @"+ i+"time"); } public static void main(String arg []) { for(int i = 0;i&lt;=999;i++) { Test1 obj[] = null; obj[i] = new Test1(); obj[i].myMethod(i); } } } Is this the correct way of creating objects in a loop?
has title: getting "NullPointer Exception" while creating objects in a loop
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23072735
has answer: http://stackoverflow.com/a/23072715
has answer: http://stackoverflow.com/a/23072735
downvote count: 1
type: Question
tagged with: object
upvote count: 0
accepted answer: http://stackoverflow.com/a/23072715
score: -1

jquery
tags question: http://stackoverflow.com/q/23077812
tags question: http://stackoverflow.com/q/23026452
tags question: http://stackoverflow.com/q/23098478
type: Tag
tags question: http://stackoverflow.com/q/23093380
tags question: http://stackoverflow.com/q/23102862
tags question: http://stackoverflow.com/q/22980359
tags question: http://stackoverflow.com/q/23057098
tags question: http://stackoverflow.com/q/23009201
tags question: http://stackoverflow.com/q/23077099
tags question: http://stackoverflow.com/q/22987082
tags question: http://stackoverflow.com/q/23006444
tags question: http://stackoverflow.com/q/23082340
tags question: http://stackoverflow.com/q/22977358
tags question: http://stackoverflow.com/q/22986533
tags question: http://stackoverflow.com/q/23057398
tag name: jquery
tags question: http://stackoverflow.com/q/23076242
tags question: http://stackoverflow.com/q/23033150
tags question: http://stackoverflow.com/q/22989101
tags question: http://stackoverflow.com/q/22970681
tags question: http://stackoverflow.com/q/23005822
tags question: http://stackoverflow.com/q/22971793

http://stackoverflow.com/q/23068676
answer count: 10
has answer: http://stackoverflow.com/a/65264153
upvote count: 295
score: 293
has answer: http://stackoverflow.com/a/23068695
has title: How to get current timestamp in string format in Java? "yyyy.MM.dd.HH.mm.ss"
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77585202
favorite count: 0
has answer: http://stackoverflow.com/a/75627822
type: Question
has answer: http://stackoverflow.com/a/23068748
tagged with: datetime
has comment: http://stackoverflow.com/comment/94674602
has comment: http://stackoverflow.com/comment/94677396
has answer: http://stackoverflow.com/a/34047753
accepted answer: http://stackoverflow.com/a/23068695
has comment: http://stackoverflow.com/comment/94326320
possible better answer: http://stackoverflow.com/a/23068721
has body: How to get timestamp in string format in Java? "yyyy.MM.dd.HH.mm.ss" String timeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Timestamp()); This is what I have, but Timestamp() requires an parameters...
has answer: http://stackoverflow.com/a/58829877
has answer: http://stackoverflow.com/a/23068721
downvote count: 2
has answer: http://stackoverflow.com/a/52813615
tagged with: timestamp
has answer: http://stackoverflow.com/a/35520573
tagged with: java
tagged with: date

http://stackoverflow.com/a/23031727
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/23018179
answers question: http://stackoverflow.com/q/23018179
has body: Hibernate keeps changing the package containing the ConnectionProvider base class. It changed from version 3 to 4 and has changed again with verson 4.3. As @teresa-carrigan mentions in a comment to this answer, you'll have to compile the latest BoneCPConnectionProvider.java (currently supporting Hibernate 4.3.1) and use that. Or use Hibernate version 4.2.12.Final and see if that works with BoneCP 0.8 (as explained in the aforementioned answer).
has comment: http://stackoverflow.com/comment/35245725
upvote count: 4

http://stackoverflow.com/comment/35154028
score: 1
type: AnswerComment
has text: what is you java installation directory ? that refers to jvm.
comment on: http://stackoverflow.com/a/23014298
type: Comment

http://stackoverflow.com/q/22999391
has comment: http://stackoverflow.com/comment/35127675
has comment: http://stackoverflow.com/comment/35127483
accepted answer: http://stackoverflow.com/a/22999581
has body: I am trying to add a FocusAdapter to a JDateChooser swing item, but the focusGained() method is not firing, neither through a tab focus or a mouse-click... public static void main(String[] args) { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; JTextField textField = new JTextField(); panel.add(textField, c); JDateChooser dateChooser = new JDateChooser(new Date()); dateChooser.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent evt) { System.out.println(evt.getSource()); // This line never runs } }); c.gridy = 1; panel.add(dateChooser, c); JFrame frame = new JFrame(); frame.add(panel); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } Frustrating... Am I missing something small?
tagged with: jdatechooser
answer count: 1
downvote count: 0
favorite count: 0
has title: Why will JDateChooser not receive focus events
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22999581
has comment: http://stackoverflow.com/comment/35127581
score: 1
tagged with: java
tagged with: focuslistener
upvote count: 1
tagged with: swing
type: Question

http://stackoverflow.com/q/23020604
has comment: http://stackoverflow.com/comment/35166141
has comment: http://stackoverflow.com/comment/35166134
tagged with: java
has body: I am creating a mailing system, and theres is a small bug that I can't figure out. I am posting all the classes in case whoever is reading needs it to understand anything, however I obviously don't expect people to read through all of it. The problem that comes up is that when I run the main, I am able to create a username, however after creating it, the username is not stored. I think the error either lies in main or UserList class, but I just can't find it. I put comments where i think the error is. Sorry if my post is too long and/or not correctly formatted. I will take out any unneeded code, just tell me what needs to go! /** * Created by Broomhead0 on 4/11/14. */ import java.util.ArrayList; public class Userlist { //private User[] users; // this is an array that will store references to all users ArrayList&lt;User&gt; users; //this is an arraylist that will store references to all users private int numberUsr; // this is the number of users that is currently stored in the user. Always smaller or equal to maxUser public Userlist() { users = new ArrayList&lt;User&gt;(); numberUsr = 0; // at start no user stored yet } // find a user in the list based on the username public User findUser(String username) { // iterate through the array; only iterate according to how many users are currently in the array for (int i = 0; i &lt; numberUsr; i++) { // access the particular user through users.(i), then get the name, // and call the equals method on that name to compare it with the input username if (users.get(i).userName.equals(username)){ return users.get(i); } } // no user found return null; } //ERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERROR // add a user to the list; only do so if the user does not yet exist public void addUser(User u) { if (findUser(u.userName) != null) //if there is a match, System.out.println("User already exists"); else //if there is not match { users.add(u); //add the username } //ERRORERRORERRORERRORERRORERRO…
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35166180
answer count: 1
has answer: http://stackoverflow.com/a/23020959
accepted answer: http://stackoverflow.com/a/23020959
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/35166099
has title: ArrayList not storing value
has comment: http://stackoverflow.com/comment/35166813
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35166350
type: AnsweredQuestion

http://stackoverflow.com/comment/35344293
type: QuestionComment
has text: can't you wrap it in a Url object and use the getHost() method?
score: 2
comment on: http://stackoverflow.com/q/23119617
type: Comment

http://stackoverflow.com/q/23109011
type: UnansweredQuestion
downvote count: 0
score: 1
favorite count: 0
tagged with: xpath
type: Question
upvote count: 1
tagged with: css
answer count: 1
has title: Jsoup selector for one of the element
tagged with: java
has answer: http://stackoverflow.com/a/23119045
tagged with: jsoup
has body: Recently I have started learning jsuop with java where i need to parse html page for properties of an element. i have took a same page as below . in that there is image when i spy through Selenium IDE i got a property as xpath=(//img[@alt='Moto G: Mobile'])[2] as jsoup does not support xpath. how to convert this in to CSS Selctor for jsoup. i have tried doc = Jsoup.connect("http://www.flipkart.com/").get(); Elements t3 = doc.select("img[alt='Moto G: Mobile']:nth-of-type(2)"); System.out.println(t3.size()); System.out.println(t3.get(0)); but getting 0 Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 is there any better way to handle these kind of properties using jsoup. can any body help me . thanks in advance

http://stackoverflow.com/q/23090949
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23091353
type: Question
accepted answer: http://stackoverflow.com/a/23091353
tagged with: awt
score: 0
has title: Custom component not visible initially, but then becomes visible
answer count: 1
tagged with: jframe
tagged with: jcomponent
tagged with: swing
has body: I've come across an issue when messing around with shapes. I created a simple program with a slider with which you manipulate the size of an arc. The problem is that when I run it, the arc isn't painted to the screen. However, when I change the value of the slider, everything starts working perfectly. Any thoughts on what this might be caused by? Here's the code: import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.event.ChangeListener; import javax.swing.event.ChangeEvent; import java.awt.*; import java.awt.geom.*; @SuppressWarnings("serial") public class GraphicsTest2 extends JFrame implements ChangeListener { // START OF GraphicsTest2 private JPanel sliderPanel, thePanel; private JSlider slider; private DrawStuff draw; public static void main(String[] args) { // START OF main new GraphicsTest2(); } // END OF main public GraphicsTest2() { // START OF CONSTRUCTOR super("Graphics test 2"); this.setSize(500, 500); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); thePanel = new JPanel(); thePanel.setLayout(new BorderLayout(10, 10)); slider = new JSlider(JSlider.HORIZONTAL, 1, 360, 120); slider.addChangeListener(this); sliderPanel = new JPanel(); sliderPanel.add(slider, BorderLayout.CENTER); draw = new DrawStuff(); thePanel.add(sliderPanel, BorderLayout.SOUTH); thePanel.add(draw, BorderLayout.CENTER); this.add(thePanel, BorderLayout.CENTER); this.pack(); this.validate(); this.setVisible(true); } // END OF CONSTRUCTOR public void stateChanged(ChangeEvent e) { // START OF stateChanged if(e.getSource() == slider) { int size = slider.getValue(); draw.arc = new Arc2D.Double(draw.getWidth() / 2 - 50, draw.getHeight() / 2 - 50, 100, 100, 0, size, Arc2D.PIE); this.repaint(); } } // END OF stateChanged private class DrawStuff extends JComponent { // START OF DrawStuff Shape arc; public void paintComponent(Graphics g) { // START OF paintComponent super.paintComponent(g); Graphics2D g2 = (Graphics2…

http://stackoverflow.com/comment/35304767
has text: You cannot create a method in the middle of another method.
score: 1
comment on: http://stackoverflow.com/q/23097078
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35261226
type: QuestionComment
comment on: http://stackoverflow.com/q/23072887
type: Comment
has text: Line 139 is the `onPrepareOptionsMenu` method
score: 0

inputstream
tags question: http://stackoverflow.com/q/23071656
tags question: http://stackoverflow.com/q/22972367
tags question: http://stackoverflow.com/q/23086731
tags question: http://stackoverflow.com/q/23041468
tags question: http://stackoverflow.com/q/22990581
tags question: http://stackoverflow.com/q/23007019
tags question: http://stackoverflow.com/q/23111811
tags question: http://stackoverflow.com/q/23021791
tag name: inputstream
type: Tag
tags question: http://stackoverflow.com/q/23025941
tags question: http://stackoverflow.com/q/23033480
tags question: http://stackoverflow.com/q/23005825
tags question: http://stackoverflow.com/q/22984937
tags question: http://stackoverflow.com/q/23065497

http://stackoverflow.com/q/23001426
type: AnsweredQuestion
tagged with: inetaddress
tagged with: network-programming
score: 1
tagged with: java
type: Question
has title: "localhost" vs 127.0.0.1 java
upvote count: 1
has body: Java is giving 127.0.0.1 as IP for InetAddress.getByName("localhost").getHostAddress() But why java not gives "localhost" for InetAddress.getByName("127.0.0.1").getHostName. For later one I get "127.0.0.1" as host name. Please clarify this.
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23001670
favorite count: 0
has answer: http://stackoverflow.com/a/23001670
has comment: http://stackoverflow.com/comment/35130962
tagged with: ip

http://stackoverflow.com/comment/35241628
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23062416
has text: @BrianRoach - Good point. I'll mention the wrapper classes briefly.

http://stackoverflow.com/comment/35222409
type: QuestionComment
comment on: http://stackoverflow.com/q/23042022
score: 0
has text: When you run your code within Eclipse, that usually includes a 'launch configuration' that will launch/run your code. Did the export of the project include anything like that? If you are missing the 'run' target, then it sounds that may not be part of the export project process.
type: Comment

http://stackoverflow.com/a/23042298
answers question: http://stackoverflow.com/q/23042246
type: Answer
has body: A float is a 32 bit IEEE 754 floating point. A double is a 64 bit IEEE 754 floating point. It is the same for float and double, both are binary floating point types, but double has more precision than float. Check this for more details
score: 0

http://stackoverflow.com/a/22985903
has body: A File is just a filename. There is nothing on the disk when you instantiate one unless there really is such a file, or you do some I/O, or you call createNewFile() and friends.
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/22985844
score: 2
downvote count: 0

http://stackoverflow.com/comment/35136415
type: QuestionComment
comment on: http://stackoverflow.com/q/23004600
has text: possible duplicate of [Android:Passing a hash map between Activities](http://stackoverflow.com/questions/5566921/androidpassing-a-hash-map-between-activities)
score: 0
type: Comment

http://stackoverflow.com/comment/35167920
comment on: http://stackoverflow.com/q/23021409
score: 0
has text: As @LuiggiMendoza suggested, the site is probably running multiple tests (ones with inputs larger than 5), so I would suggest you look at the java [while](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/while.html) loop & the scanner 'hasNext' [method](http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html).
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22994765
answers question: http://stackoverflow.com/q/22994479
has body: Only after you understand this statement: "Exactly zero lines of C code have ever been executed by a computer. Also, exactly zero lines of Java code have ever been executed by a computer." You will never understand any answer to your question. There answer to your question is: "An assignment, written in C, takes an unknown number of clock cycles to complete."
score: 3
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/comment/35153372
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23013799
has text: @tobias_k all of those inside would also be deleted. I'm appending it to a string builder sb.append(line.replaceAll("^[\'\"\\`].*[\'\"\\`]$", ""));

http://stackoverflow.com/comment/35146546
score: 2
comment on: http://stackoverflow.com/a/23007303
type: AnswerComment
has text: ... and reduce maintainability. They make it difficult to integrate libraries into your program, or even to integrate the work of multiple developers together, as there is no guarantee that different authors haven't used the same global variable names. So in summary, global variables have very many problems; but even if they did not, this would not be a good answer, because you have only mentioned one type of variable. This suggests that global variables are the right answer for ALL scope problems, when the fact is that there are many different types of scope problem, and different ...
type: Comment

http://stackoverflow.com/q/23060693
type: UnansweredQuestion
tagged with: regex
answer count: 4
has comment: http://stackoverflow.com/comment/35238426
upvote count: 0
has answer: http://stackoverflow.com/a/23060772
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23060861
score: -1
has comment: http://stackoverflow.com/comment/35238532
has answer: http://stackoverflow.com/a/23060795
has title: Number verification - if it is number, eponential values, it should pass otherwise it should fail
favorite count: 0
has comment: http://stackoverflow.com/comment/35238412
has answer: http://stackoverflow.com/a/23060776
has body: I am using ^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$ this regular expression, its working fine for all cases. But for values like 123E104 it failing to validate. I guess 123E104 is not exponential value. Since 123E104 is invalid exponential value. result should be false or not match

http://stackoverflow.com/comment/35129592
type: Comment
has text: @Solignis Forget about your class for a second. Look at the `Field#get(Object)` method javadoc. It's expects an argument which is the instance from which the field will be retrieved. So if my `Person` class has a `personName` field I wanted to retrieve, then I would call it with `theFieldObjectForPersonName.get(somePersonObject)`. You're not doing that. The object you're passing to `get` is a `Class`. In my previous example, it's as if you did `theFieldObjectForPersonName.get(Person.class)`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23000371

swt
tags question: http://stackoverflow.com/q/23054905
tags question: http://stackoverflow.com/q/22977959
tags question: http://stackoverflow.com/q/22985253
tags question: http://stackoverflow.com/q/22983422
tags question: http://stackoverflow.com/q/22989700
tags question: http://stackoverflow.com/q/23028722
tags question: http://stackoverflow.com/q/23079030
tags question: http://stackoverflow.com/q/23004021
tags question: http://stackoverflow.com/q/23060490
type: Tag
tags question: http://stackoverflow.com/q/23105095
tags question: http://stackoverflow.com/q/23126313
tags question: http://stackoverflow.com/q/23011284
tags question: http://stackoverflow.com/q/23103969
tags question: http://stackoverflow.com/q/23118080
tag name: swt
tags question: http://stackoverflow.com/q/23032051
tags question: http://stackoverflow.com/q/23011917
tags question: http://stackoverflow.com/q/22986494
tags question: http://stackoverflow.com/q/23128556
tags question: http://stackoverflow.com/q/23074139

http://stackoverflow.com/comment/35261728
type: AnswerComment
comment on: http://stackoverflow.com/a/23070119
score: 0
type: Comment
has text: And maybe an example flow of the program (just explanation is fine)

http://stackoverflow.com/q/22997855
has comment: http://stackoverflow.com/comment/35124707
type: Question
accepted answer: http://stackoverflow.com/a/22998120
has answer: http://stackoverflow.com/a/22997972
has answer: http://stackoverflow.com/a/22997961
score: 0
has answer: http://stackoverflow.com/a/22997979
has body: I'm trying to come up with a regex expression that matches a string that has only non-alphanumic characters. For example: ".." would be true ".dds!f" would be false and "sdjhgfsjd" would be false. I have tried str.matches("\\p{Punct}") however this only seems to match single punctionation characters. eg. ".".matches("\\p{Punct}") would be true but "..".matches("\\p{Punct}") would be false. I suppose an equivalent question would also be to match if there is any alphanumeric character in the string.
has answer: http://stackoverflow.com/a/22998233
answer count: 5
possible better answer: http://stackoverflow.com/a/22998233
has comment: http://stackoverflow.com/comment/35124568
tagged with: regex
has answer: http://stackoverflow.com/a/22998120
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/22937618
has comment: http://stackoverflow.com/comment/35125106
has title: Regex match if String has no alphanumic characters

http://stackoverflow.com/comment/50555375
type: AnswerComment
type: Comment
has text: @BorisTreukhov I also noticed that performance hit while I was debugging so I googled it and found this.
score: 3
comment on: http://stackoverflow.com/a/22989501

http://stackoverflow.com/a/23077033
has body: TimeZone.getSystemTimeZoneID() is a native method and I'm not surprised this doesn't work (and I think you can't do that at all,but I haven't found this information in Javassist doc). To skip native method use Modifier.isNative()
has comment: http://stackoverflow.com/comment/59676614
downvote count: 0
answers question: http://stackoverflow.com/q/22992546
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35602057
type: Answer

http://stackoverflow.com/a/41751144
score: 2
downvote count: 0
has body: Here's a Kotlin version based on the answers by Brian Roach and AYarulin. class RestDeserializer&lt;T&gt;(targetClass: Class&lt;T&gt;, key: String?) : JsonDeserializer&lt;T&gt; { val targetClass = targetClass val key = key override fun deserialize(json: JsonElement?, typeOfT: Type?, context: JsonDeserializationContext?): T { val data = json!!.asJsonObject.get(key ?: "") return Gson().fromJson(data, targetClass) } }
upvote count: 2
answers question: http://stackoverflow.com/q/23070298
type: Answer

http://stackoverflow.com/comment/35617844
type: AnswerComment
comment on: http://stackoverflow.com/a/23168882
score: 0
type: Comment
has text: Please note, I have rewriten my answer complitely. The new version require much less time to go into. ;)

http://stackoverflow.com/a/23387314
answers question: http://stackoverflow.com/q/23058309
has comment: http://stackoverflow.com/comment/35861602
has comment: http://stackoverflow.com/comment/36019870
upvote count: 4
has comment: http://stackoverflow.com/comment/36018460
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/36018531
type: Answer
has comment: http://stackoverflow.com/comment/35996284
has body: This mailthread from openjdk says, all AES intrinsics are enabled by default. Although I'm not certain how much of the Oracle core VM code shares with openjdk. If you read the whole thread, they also discuss about challenges on 32-bit VMs, that probably explains your problem with your second test run. Regarding your test, don't you think the differences in the CPUs make a big difference? Core i7's are quadcore and have better clock speeds in general. Wouldn't that have made a difference ? I guess that shift from 21s (core i5, 32bitVM, AES-NI off) to 8s (core i7, 64bitVM, AES-NI off) is the difference between i5 and i7. The improvement from 8s to 3s, although not 7 fold, is indeed worth a 'Yipes'! :) Regarding the detection mechanism - there doesn't seem to be a straightforward way. JVM throws a warning "AES intrinsics not available on this CPU" if you enabled the flags, and if it cannot find AES support - as per this bug report.

http://stackoverflow.com/comment/35182717
comment on: http://stackoverflow.com/q/23029749
score: 0
has text: Do you understand the HTTP protocol well? If you dont you might want to read more about it before writing an application that is heavily dependent on your understanding of it.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23076514
favorite count: 0
tagged with: deep-copy
tagged with: dozer
answer count: 0
type: UnansweredQuestion
has body: I have two classes Test1.java and Test2.java with a field fieldName of type Map&lt;String, Set&lt;String&gt;&gt;. When I try to map Test1 to Test2 using dozer, it throws the following error Exception in thread "main" java.lang.ClassCastException: java.util.HashSet cannot be cast to java.util.List at org.dozer.MappingProcessor.mapCollection(MappingProcessor.java:561) at org.dozer.MappingProcessor.mapOrRecurseObject(MappingProcessor.java:434) at org.dozer.MappingProcessor.mapMap(MappingProcessor.java:586) at org.dozer.MappingProcessor.mapOrRecurseObject(MappingProcessor.java:395) at org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:342) at org.dozer.MappingProcessor.mapField(MappingProcessor.java:288) at org.dozer.MappingProcessor.map(MappingProcessor.java:248) at org.dozer.MappingProcessor.map(MappingProcessor.java:197) at org.dozer.MappingProcessor.map(MappingProcessor.java:187) at org.dozer.MappingProcessor.map(MappingProcessor.java:133) at org.dozer.MappingProcessor.map(MappingProcessor.java:128) at org.dozer.DozerBeanMapper.map(DozerBeanMapper.java:127) at com.paypal.offers.common.util.TestMain.main(TestMain.java:25) Why is it not able to identify the correct destination type of util.Set ? Do I have to add some hints ?
upvote count: 1
has title: Dozer deep mapping Set with in a Map
score: 1
tagged with: java
type: Question
downvote count: 0

http://stackoverflow.com/comment/35364891
type: Comment
score: 0
type: QuestionComment
has text: Yes, I did (saw the same advice in another topic). But nothing has changed. Moreover, there is a server log in Netbeans, and it shows when I deploy and undeploy my .war file.
comment on: http://stackoverflow.com/q/23126867

http://stackoverflow.com/comment/35299199
type: QuestionComment
comment on: http://stackoverflow.com/q/23086595
score: 0
has text: Have you tried using a different garbage collector, such as G1GC, to see if that sheds any more light on the problem?
type: Comment

http://stackoverflow.com/q/23108567
type: Question
has comment: http://stackoverflow.com/comment/35323508
has answer: http://stackoverflow.com/a/23108753
downvote count: 4
upvote count: 0
has answer: http://stackoverflow.com/a/23108688
has answer: http://stackoverflow.com/a/23108707
favorite count: 0
has comment: http://stackoverflow.com/comment/35323494
answer count: 5
type: UnansweredQuestion
has body: I am trying to remove 1st 000 digits from given string like 0006700guys. I want to remove 0's from before the any decimal num started. Suppose if my String contain 006700guys, then i want to remove 1st two 0's, I need O/P like 6700guys. If my String contains 000006700chi O/P like 6700chi. Thanks in advance.
has comment: http://stackoverflow.com/comment/35323530
has answer: http://stackoverflow.com/a/23108739
has title: Remove specified digits from a String in java
has comment: http://stackoverflow.com/comment/35323393
tagged with: java
score: -4
has answer: http://stackoverflow.com/a/23109041

http://stackoverflow.com/comment/35088993
type: Comment
type: QuestionComment
has text: What does `wait()` do? What are you `synchronized` on? Is it shared?
score: 0
comment on: http://stackoverflow.com/q/22978198

http://stackoverflow.com/comment/140011959
has text: The answer would be much more helpful if you explain your solution briefly. Also the solution code should be properly formatted
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/79391857
type: Comment

http://stackoverflow.com/comment/35096765
type: Comment
type: QuestionComment
has text: @Hitendra did u tried this [link](http://stackoverflow.com/questions/10325117/java-android-calculate-days-between-2-dates-and-present-the-result-in-a-spec)
comment on: http://stackoverflow.com/q/22982356
score: 0

http://stackoverflow.com/a/23039457
accepted answer of: http://stackoverflow.com/q/23038673
has body: @Test public void test14() throws Exception { Map&lt;String, Integer&gt; m1 = ImmutableMap.of("a", 2, "b", 3); Map&lt;String, Integer&gt; m2 = ImmutableMap.of("a", 3, "c", 4); Map&lt;String, Integer&gt; mx = Stream.of(m1, m2) .map(Map::entrySet) // converts each map into an entry set .flatMap(Collection::stream) // converts each set into an entry stream, then // "concatenates" it in place of the original set .collect( Collectors.toMap( // collects into a map Map.Entry::getKey, // where each entry is based Map.Entry::getValue, // on the entries in the stream Integer::max // such that if a value already exist for // a given key, the max of the old // and new value is taken ) ) ; /* Use the following if you want to create the map with parallel streams Map&lt;String, Integer&gt; mx = Stream.of(m1, m2) .parallel() .map(Map::entrySet) // converts each map into an entry set .flatMap(Collection::stream) // converts each set into an entry stream, then // "concatenates" it in place of the original set .collect( Collectors.toConcurrentMap( // collects into a map Map.Entry::getKey, // where each entry is based Map.Entry::getValue, // on the entries in the stream Integer::max // such that if a value already exist for // a given key, the max of the old // and new value is taken ) ) ; */ Map&lt;String, Integer&gt; expected = ImmutableMap.of("a", 3, "b", 3, "c", 4); assertEquals(expected, mx); }
has comment: http://stackoverflow.com/comment/85137785
type: AcceptedAnswer
score: 122
type: Answer
answers question: http://stackoverflow.com/q/23038673
upvote count: 123
has comment: http://stackoverflow.com/comment/73503239
downvote count: 1

http://stackoverflow.com/a/23123922
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23123885
has comment: http://stackoverflow.com/comment/35351816
upvote count: 2
has comment: http://stackoverflow.com/comment/35351900
has body: whenever you deal with "how many times" then you should have a counter . You may try: public static int favorite(int[] digit, int fave) { int count=0; for (int x = 0; x &lt;digit.length; x++) { if ( digit[x] == fave) count++; } return count; } To print it out: System.out.println("Number of occurrence:"+ favorite(digit, fave)); assuming that you have something like int[] digit = {1,2,3,2,4,2,5}; and int fave = 2;
type: Answer

http://stackoverflow.com/comment/35290098
type: Comment
score: 0
type: AnswerComment
has text: Thank you. Just waiting pass the time limit, so I can check your answer as correct.
comment on: http://stackoverflow.com/a/23089271

http://stackoverflow.com/q/23041036
has comment: http://stackoverflow.com/comment/35202751
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/19892322
has title: Why do java intrinsic functions still have code?
type: Question
tagged with: java
score: 10
has body: There are many methods in the Java API that are intrinsics, but still have code associated with them when looking at the source code. For an example, Integer.bitCount() is an intrinsic, but if you open the Integer class file, you can see code with it. What purposes might this code serve if it is not necessarily used by the compiler/jvm?
has answer: http://stackoverflow.com/a/23041204
upvote count: 10
has comment: http://stackoverflow.com/comment/35202656
has answer: http://stackoverflow.com/a/64589941
has comment: http://stackoverflow.com/comment/35202627
downvote count: 0
possible better answer: http://stackoverflow.com/a/23041199
has answer: http://stackoverflow.com/a/23041199
favorite count: 0
tagged with: intrinsics
has comment: http://stackoverflow.com/comment/35202747
answer count: 3
has comment: http://stackoverflow.com/comment/35202771
accepted answer: http://stackoverflow.com/a/23041204
has comment: http://stackoverflow.com/comment/35202796

http://stackoverflow.com/comment/35142290
type: Comment
has text: the hex dump will actually be coming from reading a ss7 dialogic card that contains data similar to wireshark representation.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23007349

http://stackoverflow.com/comment/35189343
type: AnswerComment
has text: I ran the same code on identical as power and memory machine - and there I achieved speed above 30MB/s. So the problem is somewhere in the servers environment.
type: Comment
comment on: http://stackoverflow.com/a/23031421
score: 0

http://stackoverflow.com/comment/35315655
comment on: http://stackoverflow.com/q/23103969
score: 0
type: QuestionComment
has text: Do you get an exception? What is the result? And what is the desired outcome?
type: Comment

http://stackoverflow.com/comment/35108776
has text: What Application server are you using
type: Comment
comment on: http://stackoverflow.com/a/22989387
type: AnswerComment
score: 0

semaphore
type: Tag
tags question: http://stackoverflow.com/q/22997434
tags question: http://stackoverflow.com/q/23010330
tag name: semaphore

http://stackoverflow.com/a/23086047
answers question: http://stackoverflow.com/q/23085396
has body: Generics work at compile-time,due to lack of reified Generics in Java (it isn't possible to do a T t = new T()), Gson itself is forced to use the TypeToken approach, as you see. Otherwise Gson would have done it in a much more elegant manner.
type: Answer
score: 0

http://stackoverflow.com/q/23098308
type: UnansweredQuestion
has body: I'm using rest service. My service accepts Employee object as an input for my JSON Post request. I'm using worklight adapter to call the service. Can any one help me in writing an example of how the code looks like. Sample: public class Employee{ String id; String name; String address; ... ... } @Post @Consumes(JSON) @Produces(JSON) public ResponseObject getSomeInfo(Employee emp){ ....... } Can any one help me with the code to write this adapter request?
downvote count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: -1
type: Question
upvote count: 0
answer count: 1
has title: IBM Worklight - How to send post values in adapter?
tagged with: rest
favorite count: 0
tagged with: worklight-adapters
tagged with: ibm-mobilefirst
has answer: http://stackoverflow.com/a/23111003

http://stackoverflow.com/q/22970269
upvote count: 1
has comment: http://stackoverflow.com/comment/35089043
accepted answer: http://stackoverflow.com/a/25401796
linked to: http://stackoverflow.com/q/20241570
has comment: http://stackoverflow.com/comment/38311996
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35138513
score: 1
tagged with: java
tagged with: cqlsh
has answer: http://stackoverflow.com/a/25401796
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/38343191
answer count: 1
favorite count: 0
has body: I'm have a cassandra table like this: keyspace_name| columnfamily_name | column_name | component_index | -------------+-------------------+-------------+-----------------+ aw | test | as_of_date | 0 | aw | test | data | 1 | aw | test | record_id | null | aw | test | upload_time | 1 | And I'm won't to create trigger that will print(slf4j for example) rows that whould be inserted in next format: key = key1 column_name1=value1 column_name2=value2 ... column_namen=valuen Is it possible to get column name in trigger? I try example from the internet, but it prints incorrect data. public Collection&lt;RowMutation&gt; augment(ByteBuffer key, ColumnFamily update) { String localKey = new String(key.array(), Charset.forName("UTF-8")); logger.info("key={}.", localKey); for (Column cell : update) { try { String name = ByteBufferUtil.string(cell.name()); logger.info("name={}.", name); String value = ByteBufferUtil.string(cell.value()); logger.info("value={}.", value); } catch (Exception e) { logger.info("Exception={}.", e.getMessage()); } } As I understand, i am must convert cell.value() to specific data type like this: Date date = TimestampType.instance.compose(cell.value()); But I don't know, how to detect field type and i am don't understand why i can't get column name using ByteBufferUtil.string(cell.name()).
tagged with: cassandra
has title: Using cassandra triggers
tagged with: triggers

http://stackoverflow.com/q/22981167
upvote count: 1
tagged with: jquery-ui-selectable
has comment: http://stackoverflow.com/comment/35098083
favorite count: 0
has comment: http://stackoverflow.com/comment/35093982
has comment: http://stackoverflow.com/comment/35099362
tagged with: datatable
downvote count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35137765
has title: NullPointerException with SelectableDataModel and ViewScope with PrimeFaces
tagged with: jsf
tagged with: primefaces
score: 1
tagged with: java
has body: I am facing a problem with SelectableDataModel and ViewScope. Below is what I implemented: Facelet: &lt;p:dataTable id="countries" value="#{userPreferencesBean.countryDataModel}" var="country" emptyMessage="No Country found." selection="#{userPreferencesBean.selectedCountries}" styleClass="table-no-select-all" dynamic="true" rowKey="#{country.id}"&gt; ...... &lt;/p:dataTable&gt; Backing Bean: @ManagedBean(name = UserPreferencesBean.MANAGEDBEAN_NAME) @ViewScoped public class UserPreferencesBean implements Serializable { //All Variable Declarations goes here @PostConstruct public void initialize() { List&lt;Country&gt; coountries = Getting countries from DB setCountryDataModel(new CountryDataModel(coountries)); } public void preRender(ComponentSystemEvent event) { //Nothing here } ... } CountryDataModel: @ManagedBean(name = CountryDataModel.MANAGEDBEAN_NAME) @ViewScoped public class CountryDataModel extends ListDataModel&lt;Country&gt; implements SelectableDataModel&lt;Country&gt;, Serializable { public CountryDataModel() { } public CountryDataModel(List&lt;Country&gt; countries) { super(countries); } @Override public Interface getRowData(String rowKey) { @SuppressWarnings("unchecked") List&lt;Country&gt; countries = (List&lt;Country&gt;)getWrappedData(); for (Country singleCountry : countries) { if (isEqualWithRowKey(singleCountry.getId(), rowKey)) return singleCountry; } return null; } private boolean isEqualWithRowKey(Short countryId, String rowKey) { Short rowKeyId = Short.parseShort(rowKey); if (countryId.equals(rowKeyId)) return true; return false; } @Override public Object getRowKey(Country singleCountry) { return singleCountry.getId(); } } Now what is happening is that first time, datatable is getting loaded correctly. But when I am clicking on a particular row, I am getting NPE. Log is below: Caused by: java.lang.NullPointerException at org.primefaces.component.datatable.DataTable.getRowData(DataTable.java:936) at org.primefaces.component.datatable.feature.Se…
type: Question
has comment: http://stackoverflow.com/comment/35095311

windowbuilder
tags question: http://stackoverflow.com/q/23063324
tag name: windowbuilder
tags question: http://stackoverflow.com/q/23045715
tags question: http://stackoverflow.com/q/23045338
type: Tag

http://stackoverflow.com/q/23119724
tagged with: android
favorite count: 0
downvote count: 0
has answer: http://stackoverflow.com/a/34070726
possible better answer: http://stackoverflow.com/a/25695424
type: AnsweredQuestion
has body: I currently have something working to capture screenshots on iOS for appium tests using java and junit. Before a test finishes it runs this code to get the last visible thing on the screen before killing the connection @After public void tearDown() throws Exception { if (platform.equals(iOS)) { captureScreenshot(testName.getMethodName()); } driver.quit(); } @SuppressWarnings("Augmenter") public void captureScreenshot(String testName) { String imagesLocation = "target/surefire-reports/screenshot/" + platform + "/"; new File(imagesLocation).mkdirs(); // Insure directory is there String filename = imagesLocation + testName + ".jpg"; try { Thread.sleep(500); WebDriver augmentedDriver = new Augmenter().augment(driver); File scrFile = ((TakesScreenshot)augmentedDriver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(scrFile, new File(filename), true); } catch (Exception e) { System.out.println("Error capturing screen shot of " + testName + " test failure."); // remove old pic to prevent wrong assumptions File f = new File(filename); f.delete(); // don't really care if this doesn't succeed, but would like it to. } } This sorta works for android but lately it has completely killed the running test but this might have to do with the device it is trying to get the snapshot of. Before it would save the file but the image would come up blank or broken. Anyone know how to get image/screen capturing working on android using appium? Perhaps something with UIAutomator?
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/46294570
type: Question
answer count: 2
tagged with: appium
tagged with: ios
has title: Capturing Android screenshot with appium
has answer: http://stackoverflow.com/a/25695424
accepted answer: http://stackoverflow.com/a/34070726
upvote count: 7

http://stackoverflow.com/a/64422241
has body: public static void main (String[] args){ public static int oddSum(int s){ if (s &lt;= 0) return 0; else return s + oddSum(s -2); } }
answers question: http://stackoverflow.com/q/23106077
has comment: http://stackoverflow.com/comment/127563317
has comment: http://stackoverflow.com/comment/113917113
downvote count: 2
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/127468450
score: -1

http://stackoverflow.com/q/23049736
has answer: http://stackoverflow.com/a/34545814
has body: In my spring application, I have the following configuration classes for the spring environment: WebAppInitializer.java @Order(value=1) public class WebAppInitializer implements WebApplicationInitializer { @SuppressWarnings("resource") @Override public void onStartup(ServletContext container) { // Create the 'root' Spring application context AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(WebAppConfig.class); // Manage the lifecycle of the root application context //container.addListener(new ContextLoaderListener(rootContext)); // Create the dispatcher servlet's Spring application context AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext(); dispatcherContext.register(DispatcherConfig.class); // Register and map the dispatcher servlet ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(dispatcherContext)); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/"); } } WebAppConfig.java @EnableWebMvc @EnableTransactionManagement(mode=AdviceMode.PROXY, proxyTargetClass=true) @ComponentScan(value="spring.webapp.lojavirtual") @Configuration public class WebAppConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/bootstrap/**").addResourceLocations("/bootstrap/").setCachePeriod(31556926); registry.addResourceHandler("/extras/**").addResourceLocations("/extras/").setCachePeriod(31556926); registry.addResourceHandler("/jquery/**").addResourceLocations("/jquery/").setCachePeriod(31556926); } @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { configurer.enable(); } } DispatcherConfig.java @Controller @Import(WebAppConfig.class) public class DispatcherConfig { @Bean public ViewResolver jspResolver() { InternalResourceViewResolver viewResolver = new InternalResourceViewRes…
has comment: http://stackoverflow.com/comment/35218887
possible better answer: http://stackoverflow.com/a/34545814
linked to: http://stackoverflow.com/q/53533321
has answer: http://stackoverflow.com/a/23053029
linked to: http://stackoverflow.com/q/12059307
answer count: 3
downvote count: 0
favorite count: 0
score: 8
upvote count: 8
has title: Working with multiple dispatcher servlets in a spring application
tagged with: spring
accepted answer: http://stackoverflow.com/a/23053029
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/57512177
tagged with: java
type: Question

http://stackoverflow.com/a/23027853
has comment: http://stackoverflow.com/comment/35180083
has body: The exception is thrown by a Scanner object in the execution of next and thus it seems to me that text has exhausted its input source. You should control that you have more elements at text before asking it for more integers as you tried but not at the outer loop as you do but at the deepest level. Right now you are loading bunches of 4x4=16 elements if you can get an element before starting your loop. Try with: for (int i=0;i&lt;4;i++) { if(!text.hasNextInt()) break; for (int j=0;j&lt;4;j++) { if(!text.hasNextInt()) break; matrix1[i][j]= text.nextInt(); } }
accepted answer of: http://stackoverflow.com/q/23027836
has comment: http://stackoverflow.com/comment/35184525
has comment: http://stackoverflow.com/comment/35184000
has comment: http://stackoverflow.com/comment/35186061
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35186387
has comment: http://stackoverflow.com/comment/35183330
has comment: http://stackoverflow.com/comment/35183913
type: Answer
answers question: http://stackoverflow.com/q/23027836

http://stackoverflow.com/a/23069293
has comment: http://stackoverflow.com/comment/35254583
type: AcceptedAnswer
downvote count: 0
has body: Do this please: @Override public void onClick(View v) { if(mUserName != null &amp;&amp; mPassword != null &amp;&amp; mEmail != null &amp;&amp; mUserName.getText() != null &amp;&amp; mPassword.getText() != null &amp;&amp; mEmail.getText() != null) { Your original code here. } } Update: Typo mUserName = (EditText) findViewById(R.id.usernameField); should be userNameField? &lt;EditText android:id="@+id/userNameField" ...
accepted answer of: http://stackoverflow.com/q/23068041
type: Answer
has comment: http://stackoverflow.com/comment/35254707
score: 1
has comment: http://stackoverflow.com/comment/35254769
has comment: http://stackoverflow.com/comment/35254629
has comment: http://stackoverflow.com/comment/35254564
upvote count: 1
answers question: http://stackoverflow.com/q/23068041

http://stackoverflow.com/q/22991153
has answer: http://stackoverflow.com/a/22992024
has answer: http://stackoverflow.com/a/23032626
accepted answer: http://stackoverflow.com/a/23032626
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35183592
has title: Spring @Autowired gives null in a @Repository bean
has comment: http://stackoverflow.com/comment/35128357
has comment: http://stackoverflow.com/comment/35114489
has comment: http://stackoverflow.com/comment/35184350
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35183622
possible better answer: http://stackoverflow.com/a/22992024
has body: I have a simple standalone application using @Autowired to inject a SessionFactory, here is the code: package au.edu.rdsi.rexportal; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.support.GenericXmlApplicationContext; import org.springframework.stereotype.Component; import org.springframework.stereotype.Repository; @Repository("rexportalConsole") public class RexportalConsole { @Autowired private SessionFactory sessionFactory; public static void main(String[] args) { GenericXmlApplicationContext ctx = new GenericXmlApplicationContext(); ctx.getEnvironment().setActiveProfiles("development"); ctx.load("classpath:META-INF/spring-rexportal.xml"); ctx.refresh(); RexportalConsole rc = (RexportalConsole) ctx.getBean("rexportalConsole"); System.out.println(rc); System.out.println(rc.sessionFactory); } } When I run this program I always get null for sessionFactory property: au.edu.rdsi.rexportal.RexportalConsole@1f3a1de9 null But if I change @Repository to @Component, I get the correct result and I can use the sessionFactory bean: au.edu.rdsi.rexportal.RexportalConsole@14eb7ad0 org.hibernate.impl.SessionFactoryImpl@6fcbf86a I want to use @Repository because I need the translation of exceptions as you can see in my application.xml, the PersistenceExceptionTranslationPostProcessor works for @Respository: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd http://www.springframework.org/schema/aop http://w…
tagged with: spring

http://stackoverflow.com/comment/35281262
comment on: http://stackoverflow.com/a/23082389
type: AnswerComment
score: 4
has text: @blackbuild I still don't agree with your statement `it must be identical regardless of the used profile`. I have used maven profiles for quite some time, and most of the time it was to manage building artifacts for different environments, and yes, the different profiles did result in different artificat being created. How-ever, I am not going to turn a deaf ear to your statements. Can you back your claims with some supporting links and/or documents?
type: Comment

http://stackoverflow.com/a/23051803
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23051709
has comment: http://stackoverflow.com/comment/35222389
has comment: http://stackoverflow.com/comment/35222655
answers question: http://stackoverflow.com/q/23051709
type: Answer
has comment: http://stackoverflow.com/comment/35222349
has comment: http://stackoverflow.com/comment/35222405
has comment: http://stackoverflow.com/comment/35222568
has comment: http://stackoverflow.com/comment/35222550
upvote count: 3
has body: It's really hard to tell what you're asking but taking a guess... if you want to set specific object's balances, just do it outside the loop: // create each accountArray object for(int i = 0; i &lt; accountArray.length; i++) { // copy each element (object) from accountTemplate accountArray[i] = (AccountWithInterface)accountTemplate.clone(); } // set balance for first object accountArray[0].setBalance(85900.32); // set balance for second object accountArray[1].setBalance(3250.99); for(int i = 0; i &lt; accountArray.length; i++) { System.out.println(accountArray[i].toString()); } Another option is: // create each accountArray object for(int i = 0; i &lt; accountArray.length; i++) { // copy each element (object) from accountTemplate accountArray[i] = (AccountWithInterface)accountTemplate.clone(); if (i == 0) accountArray[i].setBalance(85900.32); else if (i == 1) accountArray[i].setBalance(3250.99); System.out.println(accountArray[i].toString()); } Or even something like this: double[] balances = new double[] {85900.32, 3250.99}; // create each accountArray object for(int i = 0; i &lt; accountArray.length; i++) { // copy each element (object) from accountTemplate accountArray[i] = (AccountWithInterface)accountTemplate.clone(); if (i &lt; balances.length) accountArray[i].setBalance(balances[i]); System.out.println(accountArray[i].toString()); } Whatever is the most appropriate for your situation. You have many options.
has comment: http://stackoverflow.com/comment/35222631
has comment: http://stackoverflow.com/comment/35222376
score: 3

http://stackoverflow.com/a/23031855
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23031820
type: Answer
answers question: http://stackoverflow.com/q/23031820
has body: Define c in doSomething as Comparable or String: doTest(String.class); } private static void doTest(Class&lt;? extends Comparable&gt; type) { doSomething(type, "test"); } // third party API like javax.swing.event.EventListenerList.add() private static &lt;C extends Comparable&gt; void doSomething(Class&lt;C&gt; ct, Comparable c) { // ... } Please note that you cannot cast implicitly from Object,String or Comparable to C. To get more insight, inside the doSomething try to do this: C s = c; //Type mismatch: cannot convert from Comparable to C
score: 0

http://stackoverflow.com/a/23122528
type: Answer
has body: Just call frame.repaint() (which should be called once automatically) to make it repaint the graphics. No need to provide your own Graphics object. Side note, you should be using a JPanel with paintComponent(Graphics) instead. This will make handling of events a lot easier, especially for a game like snake. Here is a small code example on Stack Overflow: Java drawing on JPanel which on a JFrame And one I made myself with usage of Java 8: import javax.swing.*; import java.awt.*; /** * @author Obicere */ public class PaintExample { public PaintExample() { final JFrame frame = new JFrame("Paint Example"); final MyPanel panel = new MyPanel(); frame.add(panel); frame.pack(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static void main(final String[] args) { SwingUtilities.invokeLater(PaintExample::new); } public class MyPanel extends JPanel { @Override public void paintComponent(final Graphics g) { super.paintComponent(g); g.setColor(Color.YELLOW); g.fillOval(0, 0, 50, 50); g.setColor(Color.BLACK); g.drawOval(0, 0, 50, 50); g.drawLine(20, 10, 20, 20); g.drawLine(30, 10, 30, 20); g.drawArc(15, 15, 20, 20, 180, 180); g.drawString("Drawing with swing!", 10, 100); } @Override public Dimension getPreferredSize() { return new Dimension(400, 400); } } } As request of your comment, I also modified the program to display objects upon request: import javax.swing.*; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.LinkedList; /** * @author Obicere */ public class PaintExample { public PaintExample() { final JFrame frame = new JFrame("Paint Example"); final MyPanel panel = new MyPanel(); frame.add(panel); frame.pack(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static void main(final String[] args) { SwingUtilities.invokeLater(PaintExample::new); } public…
accepted answer of: http://stackoverflow.com/q/23122492
upvote count: 5
has comment: http://stackoverflow.com/comment/35349373
answers question: http://stackoverflow.com/q/23122492
downvote count: 0
has comment: http://stackoverflow.com/comment/35349540
has comment: http://stackoverflow.com/comment/35349587
score: 5
type: AcceptedAnswer

http://stackoverflow.com/q/23097470
has answer: http://stackoverflow.com/a/23101669
answer count: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23101669
has answer: http://stackoverflow.com/a/23097524
tagged with: javabeans
has body: I have an object myObject which contains a property called myThing. The object myThing has an ArrayList and a property list which is connected to it. I have some JLabel myLabel which is bound to the list property. To make this work, when the firePropertyChange is done, I have to make a clone of the list so that I pass a PropertyChangeEvent I have an old list and a new list to pass. This is very inefficient. Is there some way I should be doing this without the clone, that still allows me to bind properties? Lists have been the bane of my existence lately.
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/23097524
has title: Binding a list in java - efficiently
tagged with: properties
score: 0
tagged with: java
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/35173516
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23021641
has text: Cheers, although I was able to implement it without a separate node class. http://pastebin.com/ySRp0nZA

http://stackoverflow.com/comment/35083526
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22974961
has text: `javafx.scene.image.Image` is not abstract. http://docs.oracle.com/javafx/2/api/javafx/scene/image/Image.html Make sure you are importing the correct `Image` class. Also, your image needs to go into an `ImageView`
type: Comment

http://stackoverflow.com/q/23061785
tagged with: jeditorpane
answer count: 0
tagged with: fonts
type: UnansweredQuestion
tagged with: java
tagged with: swing
type: Question
has title: Java Fontrendering with JEditorPane
has comment: http://stackoverflow.com/comment/35271012
score: 0
has body: I want to do some font rendering using the java html2image-classes. It works fine - but there are some issues that I cannot resolve. The code I use is the following: import gui.ava.html.image.generator.HtmlImageGenerator; import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.GraphicsEnvironment; import java.awt.RenderingHints; import java.awt.font.LineMetrics; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; import javax.imageio.ImageIO; public class FontTest { public static void main(String[] args) throws Throwable { HtmlImageGenerator imageGenerator = new HtmlImageGenerator(); imageGenerator.loadHtml("&lt;html&gt;\n" + "&lt;body bgcolor=green&gt;\n" + "\n" + "&lt;span style=\"font-family:'Times New Roman',Times,serif; font-size:200%\"&gt;" + "gro&amp;szlig;er Beispieltext $ in Times New Roman&lt;/span&gt;" + "&lt;/body&gt;\n" + "&lt;/html&gt;"); imageGenerator.saveAsImage("test.png"); } } The resulting Image has always 6 pixel too much in width. That issue can be fixed by decreasing the preffered size of the JEditorPane. The really tricky issue is that the left and the bottom side of the image are containing pixel- rows and colums that I don't want to have within the image. The are some lines of pixels above the text and some pixel-rows on the left side of the resulting image that shouldn't be a part of the image. I found out that the amount of "error-pixels" depends on the used font-size. Does anybody have an idea how to find out the correct (minimal) bounding-box that does only contain the rendered text?
has comment: http://stackoverflow.com/comment/35286548

http://stackoverflow.com/a/23325676
type: Answer
has comment: http://stackoverflow.com/comment/36044743
has comment: http://stackoverflow.com/comment/36050616
has comment: http://stackoverflow.com/comment/35770319
accepted answer of: http://stackoverflow.com/q/23095119
has body: I have a bit of experience in this area, having done some work on debugging dynamically compiled groovy scripts though the JDT. I never got this to work perfectly, and I think it is mostly a limitation of the JDT, which was never designed to handle dynamically compiled code. TLDR: My guess is that your dynamically compiled scripts have an incorrect source file attribute in the byte code. This attribute is set in the class file by the compiler. See https://en.wikipedia.org/wiki/Java_class_file Your confusion, I think, is that the debugger correctly stops at breakpoints you set in the scripts, but the IDE cannot load the source. This is confusing of course, but there is a good explanation for this. Breakpoints are actually handled by the VM and the VM keeps track of them through a fully qualified name and a line number. This allows breakpoints to be hit regardless of which classloader loads the class file, but it can lead to some confusion if multiple class files are loaded through different classloaders with the same qualified name, but different source code. This algorithm for determining when to stop the VM has nothing to do with actually looking for source code when the VM stops. Looking for source code is handled by the IDE. Since even in the statically compiled world, the source file name may not match with the class name (inner classes, anonymous classes, etc). The class name cannot be used to look up the source file. Here is a simplification of what the IDE does when it stops at a breakpoint: Find the class file at that breakpoint Get the source attribute Find a source file in the source lookup path that matches the name of the source attribute Use some heuristics if multiple source files of same name are found (I think this would be the ranking in the source lookup tab) Return the most appropriate source file. (Caveat, I think that the source attribute is only the simple name of the source file (ie- no directory), so I think the IDE converts the package name …
answers question: http://stackoverflow.com/q/23095119
score: 8
has comment: http://stackoverflow.com/comment/35728785
has comment: http://stackoverflow.com/comment/36044771
has comment: http://stackoverflow.com/comment/35728951
has comment: http://stackoverflow.com/comment/36050605
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35728611
upvote count: 8
has comment: http://stackoverflow.com/comment/35772265

http://stackoverflow.com/q/23123336
score: 0
has answer: http://stackoverflow.com/a/23148791
accepted answer: http://stackoverflow.com/a/23148791
has comment: http://stackoverflow.com/comment/35350728
has title: java.lang.UnsupportedOperationException: Mat data type is not compatible: 4
has comment: http://stackoverflow.com/comment/35351442
has comment: http://stackoverflow.com/comment/35354042
has comment: http://stackoverflow.com/comment/35353938
tagged with: opencv
type: AnsweredQuestion
tagged with: java
tagged with: image-processing
has body: i have written my own algorithms to determine the edges and then find the corner points. But then am having trouble in prespective transforming the image.I have written some code to achieve the result but am getting the above specified error. Could anyone help please me out. Thanks in advance! Mat mat = new Mat(w, h, CvType.CV_32S); MatOfPoint2f finalc = new MatOfPoint2f(); MatOfPoint2f ma = new MatOfPoint2f(); mat.put(0, 0, array); Mat quad = new Mat(w,h,CvType.CV_32S); quad.put(0,0,w,0,w,h,0,w); ma.put((int)a[0][1],(int)a[0][0],(int)a[1][1],(int)a[1][0],(int)a[2][1],(int)a[2][0],(int)a[3][1],(int)a[3][0]); Imgproc.approxPolyDP(ma,finalc,2.0,true); Mat transmtx = Imgproc.getPerspectiveTransform(finalc, quad); Imgproc.warpPerspective(mat, quad, transmtx, quad.size()); MatOfByte matOfByte = new MatOfByte(); Highgui.imencode(".jpg", quad, matOfByte); byte[] byteArray = matOfByte.toArray(); //InputStream in = new ByteArrayInputStream(byteArray); //BufferedImage bufferedImage = ImageIO.read(in); File f = new File("retrieve1.jpg"); BufferedImage img1 = new BufferedImage(w, h, 12); WritableRaster raster = (WritableRaster)img1.getData(); raster.setDataElements(0,0,w,h,byteArray); img1.setData(raster); try { ImageIO.write(img1,"jpg",f); } catch(Exception e) {} } all i am basically trying to do is port a part of this (C++) code to java. https://github.com/bsdnoobz/opencv-code/blob/master/quad-segmentation.cpp
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35353159
has comment: http://stackoverflow.com/comment/35351353

http://stackoverflow.com/q/23055460
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
tagged with: google-oauth
has comment: http://stackoverflow.com/comment/35231798
has comment: http://stackoverflow.com/comment/35268376
score: 0
has body: I am new to GA(OAuth). I have few queries while using Google authentication on java web based portal. 1) How and where do I configure my web-portal(e.g. https://abc.xyz.com)? 2) If I have 100 user base, in that case do i have to create each user's account in order to achieve authentication from Google? If yes then how shall i map them for above portal? 3) I have used http://ocpsoft.org/java/setting-up-google-oauth2-with-java/ Is there any way to avoid maintenance of clientID, Clientsecret or JSon at my web application level and can still achieve secure authentication from GA? 4) how can i implement SSO? Any early help would be appreciated. Thanks
has title: Use Google Authentication for Java webportal with SSO
answer count: 0
tagged with: oauth
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35228840
has comment: http://stackoverflow.com/comment/35267966
has comment: http://stackoverflow.com/comment/35277383

http://stackoverflow.com/a/23118021
upvote count: 1
has comment: http://stackoverflow.com/comment/35341634
answers question: http://stackoverflow.com/q/23116770
type: Answer
has comment: http://stackoverflow.com/comment/35341721
downvote count: 0
score: 1
has body: Did you try closing down eclipse and opening it again? If not try restarting eclipse. It works for me every time.

http://stackoverflow.com/comment/35142923
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23008264
type: Comment
has text: When `System.nanoTime() > eventTime` is true, the print statement will run 10 times in a few seconds. It's actually in the while loop but it's too quick

http://stackoverflow.com/comment/35223259
type: Comment
comment on: http://stackoverflow.com/a/23042626
has text: In this way you can limit the number of fetched columns. To limit results you can use setFirstResult / setMaxResults
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35223758
type: Comment
type: QuestionComment
has text: Thanks Dominik. Can I do this without jaxb with some java design pattern ? Lets say what if I am not exposing an endpoints
comment on: http://stackoverflow.com/q/23052479
score: 0

abstract-class
tags question: http://stackoverflow.com/q/22987613
type: Tag
tags question: http://stackoverflow.com/q/23096792
tags question: http://stackoverflow.com/q/22988859
tags question: http://stackoverflow.com/q/23008433
tags question: http://stackoverflow.com/q/23058500
tag name: abstract-class
tags question: http://stackoverflow.com/q/23098139
tags question: http://stackoverflow.com/q/23056632

parsing
tags question: http://stackoverflow.com/q/22985727
tags question: http://stackoverflow.com/q/23014783
tags question: http://stackoverflow.com/q/22982111
tags question: http://stackoverflow.com/q/23112193
tags question: http://stackoverflow.com/q/22999122
tags question: http://stackoverflow.com/q/23128080
tag name: parsing
tags question: http://stackoverflow.com/q/23040446
tags question: http://stackoverflow.com/q/23054790
tags question: http://stackoverflow.com/q/23046589
tags question: http://stackoverflow.com/q/23010060
tags question: http://stackoverflow.com/q/23079236
tags question: http://stackoverflow.com/q/23000676
tags question: http://stackoverflow.com/q/23068468
tags question: http://stackoverflow.com/q/23072134
tags question: http://stackoverflow.com/q/23057761
tags question: http://stackoverflow.com/q/23105056
tags question: http://stackoverflow.com/q/23033263
tags question: http://stackoverflow.com/q/23011649
type: Tag
tags question: http://stackoverflow.com/q/23059620
tags question: http://stackoverflow.com/q/23000609
tags question: http://stackoverflow.com/q/23111468
tags question: http://stackoverflow.com/q/23038056
tags question: http://stackoverflow.com/q/23016239
tags question: http://stackoverflow.com/q/23113261
tags question: http://stackoverflow.com/q/23122675
tags question: http://stackoverflow.com/q/23096881
tags question: http://stackoverflow.com/q/22986450
tags question: http://stackoverflow.com/q/22974109
tags question: http://stackoverflow.com/q/23073304
tags question: http://stackoverflow.com/q/23047825
tags question: http://stackoverflow.com/q/23014428
tags question: http://stackoverflow.com/q/23128219
tags question: http://stackoverflow.com/q/23084238

http://stackoverflow.com/a/22991393
has comment: http://stackoverflow.com/comment/35112998
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35113256
score: 1
has comment: http://stackoverflow.com/comment/35113326
has body: Is this correct? Not by my definition of "entry point". If not why? An Application instance is not an "entry point". It is merely a singleton created as part of your process starting up, nothing more. What is it that makes this (com.login.LoginActivity) to be recognized launch file? That the is the MAIN and LAUNCHER? If by "to be recognized launch file" you mean "to have an icon show up the home screen launcher", then yes, the &lt;intent-filter&gt; on that &lt;activity&gt; is causing this.
downvote count: 0
answers question: http://stackoverflow.com/q/22990102
has comment: http://stackoverflow.com/comment/35113289

http://stackoverflow.com/q/23000669
has answer: http://stackoverflow.com/a/23003127
upvote count: 2
tagged with: android
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23003127
tagged with: layout-inflater
type: Question
has title: Image with caption Android Viewpager
tagged with: android-viewpager
downvote count: 0
has body: I am new to Android programming.I have a gallery with images and when I click on one image should appear a ViewPager with full screen image and caption and I can slide through the whole gallery. I have follow this tutorial enter link description here the only difference is that my images are stored in an array as well, the caption. When I run the app the gallery is showing but the Viewpager is empty and not sliding. I have no errors, I have no idea what should be wrong. Thanks in advance :) FullScreenImageAdapter.java package com.example.sherlockholmes.images; import android.app.Activity; import android.content.Context; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.example.sherlockholmes.R; public class FullScreenImageAdapter extends PagerAdapter { private Activity context; private LayoutInflater inflater; private int _position; private Integer[] mThumbIds; private String[] description; public FullScreenImageAdapter(Activity context,Integer[] mThumbIds,String[] description){ this.context=context; this.mThumbIds = mThumbIds; this.description = description; } @Override public int getCount() { return 0; } @Override public boolean isViewFromObject(View view, Object object) { return view == ((RelativeLayout) object); } @Override public Object instantiateItem(ViewGroup container, int position) { inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View viewLayout = inflater.inflate(R.layout.layout_fullscreen_image, container, false); ImageView imageView = (ImageView) viewLayout.findViewById(R.id.full_image); TextView textview = (TextView) viewLayout.findViewById(R.id.item_text); Button btnClose = (Button) viewLayout.findViewById(R.id.btnClose); imageView.setImageReso…
answer count: 1
favorite count: 0

http://stackoverflow.com/a/23088216
has comment: http://stackoverflow.com/comment/35288494
has comment: http://stackoverflow.com/comment/35288955
score: 0
type: Answer
has body: public void sampleFunction(int size){ while(size &gt;= 0) { sampleFunction(size-1); } } Think slowly and step by step... size=1 while(1>=0) size=0 while(0>=0) size=-1 while(-1>=0) evaluates false then it goes right back to step 2 because you never finished your while loop in step 2. The solution is to change the while to an if. Do you understand why it is looping forever now? You keep setting your size back to 0 in step 3. If you learn how to use your stepping tool in the debugger you would be able to visualize this.
answers question: http://stackoverflow.com/q/23087889

http://stackoverflow.com/comment/35205632
has text: Not sure what you want. Something like http://www.codecademy.com/ for Java/JSP?
score: 0
comment on: http://stackoverflow.com/q/23042833
type: Comment
type: QuestionComment

http://stackoverflow.com/a/32196762
has body: Polymorphism in java is a concept by which we can perform a single action by different ways.it uses 2 concepts such as method overloading and method over riding. A method is a set of code which is referred to by name and can be called (invoked) at any point in a program simply by utilising the method's name. the method over riding concepts uses the key word 'extends'. We can extend a class by using the extends keyword in a class declaration after the class name and before the parent class. public class ParentClass { } and we define child class like public class ChildClass extends ParentClass { } // example of extending a class class B { int x = 0; void f1 () { x = x+1;} } class C extends B {} public class Test1 { public static void main(String[] args) { B b = new B(); b.f1(); System.out.println( b.x ); // prints 1 } } // example of extending a class, overwriting a method class B { int x; void setIt (int n) { x=n;} void increase () { x=x+1;} } class C extends B { void increase () { x=x+2;} } public class Test2 { public static void main(String[] args) { B b = new B(); b.setIt(2); b.increase(); System.out.println( b.x ); // prints 3 C c = new C(); c.setIt(2); c.increase(); System.out.println( c.x ); // prints 4 } }
answers question: http://stackoverflow.com/q/23080696
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/52290437

http://stackoverflow.com/comment/35144714
type: AnswerComment
score: 0
type: Comment
has text: Where am I to implement this code? i added it to my SongsManager, and it doesnt seem to make any changes
comment on: http://stackoverflow.com/a/23008327

http://stackoverflow.com/comment/57250467
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/34375405
has text: What does MyPojo look like?

http://stackoverflow.com/a/22990787
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35133090
answers question: http://stackoverflow.com/q/22989607
has comment: http://stackoverflow.com/comment/35114282
has body: You might want use load-on-startup in your web.xml file and then override the init() method in your servlet to do the required task. startupTasks xxx.xxxxxx.server.StartupTasksServlet 0 Additional Info can be found here

http://stackoverflow.com/comment/35215497
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23047817
has text: Seems like an odd exam question since likely every IDE has a similar helper. My recommendation would be to study the equals produced by an IDE like eclipse and understand the logical breakdown of how it is comparing the object.
type: Comment

http://stackoverflow.com/comment/35197712
score: 0
comment on: http://stackoverflow.com/q/23034315
type: QuestionComment
type: Comment
has text: Thanks. I was actually missing main-class as well as .properties file from the jar file. Now it is working fine.

http://stackoverflow.com/comment/35311654
type: Comment
score: 0
has text: @GeorgesOatesLarsen, Based on a quick read of your question and from the picture I thought you were questioning why the components were not left aligned, so I just suggested the simple BoxLayout. Then based on you second comment about forcing the button to the full width I suggested two possible layout managers you could use and even suggested which constraint you needed to use for the GridBagLayout. I assumed you could go from there, or if you needed more help you could reference the tutorial.
type: AnswerComment
comment on: http://stackoverflow.com/a/23100536

http://stackoverflow.com/comment/35201542
comment on: http://stackoverflow.com/a/23040301
type: Comment
score: 0
type: AnswerComment
has text: That's fine I guess. I don't need to have precise measurement. Just rough idea will be fine.

http://stackoverflow.com/comment/35143050
comment on: http://stackoverflow.com/q/23007364
has text: the session variable takes `Object` as it parameter. Try to typecast it in required type
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35388752
type: Comment
score: 0
has text: @user2676468 You should create a kind of `startMoveX` and `startMoveY` variables and use them the similar way that `startScale` and `startRotation` are used.
type: AnswerComment
comment on: http://stackoverflow.com/a/23116839

http://stackoverflow.com/q/23065325
tagged with: grayscale
downvote count: 0
answer count: 1
has title: Java for ImageJ. How to convert an image from RGB to 8 bit using code?
has comment: http://stackoverflow.com/comment/35248142
favorite count: 0
has comment: http://stackoverflow.com/comment/35247083
accepted answer: http://stackoverflow.com/a/23070564
score: 2
type: AnsweredQuestion
has body: I am currently working on Connected Component Labelling. This is a process which takes an image and tells you how many separate objects are in the Image. My problem is that at the very start I need to be able to take any image (specifically RGB value) and convert it into 8-bit. EDIT: as in literally considered an 8bit, where the image is no longer recognised as RGB. Not an 8bit image that is recognised as an RGB. Is there a way using code to automatically do this without having to go into the toolbar and convert it "manually"? To clarify, I am programming for ImageJ using Java. If anyone is willing to help me, I would be happy to provide them with the code I have so far where I am making a coloured image grey scale and then making it binary. My problem is that after the changes the image is still considered RGB, even though the image is essentially 8 bit. Thanks EDIT: I was looking at the code provided to me earlier and it doesn't seem to solve my problem. I am quite literally just wanting to make the little 'tick' that's next to RGB, be next to 8-bit instead. I have already done all the actual conversion on my own, its just still recognised as RGB image.
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35247808
type: Question
has comment: http://stackoverflow.com/comment/35249833
tagged with: 8-bit
tagged with: imagej
tagged with: rgb
has answer: http://stackoverflow.com/a/23070564

http://stackoverflow.com/comment/35255769
has text: You want the exact height/width of image then try this in `paintComponent()` method. `g.drawImage(img, 0, 0, img.getWidth(), img.getHeight(), this);` or `g.drawImage(img, 0, 0, 450, 450, this);`
type: Comment
comment on: http://stackoverflow.com/a/23068983
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35079452
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22971047
type: Comment
has text: The implementation of generics only checks that the return is of type Integer if you actually assign it to an Integer variable.

http://stackoverflow.com/a/23051704
has comment: http://stackoverflow.com/comment/35223403
upvote count: 10
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/121238791
has comment: http://stackoverflow.com/comment/35223001
score: 10
has comment: http://stackoverflow.com/comment/35222986
answers question: http://stackoverflow.com/q/23051678
has body: Pattern.matches() method is a static method so it cannot be used if you want to reuse a compiled pattern. A compiled pattern is an instance of Pattern class. Pattern.matches() compiles your regex every time it's used. You can reuse your compiled pattern by storing an instance of Pattern class, e.g.: Pattern pattern = Pattern.compile("^[a-z]+$", Pattern.CASE_INSENSITIVE); // you can store this instance You can then get a matcher for this pattern each time you want to use it Matcher m = pattern.matcher("Testing");

http://stackoverflow.com/a/23030804
score: 0
type: Answer
has body: It only appears that way because you coded it that way. You've thrown away the most useful part of the exception, which is the exception itself, and its message. Don't do that. Don't just create an error message of your own devising. Use the one that comes with the exception. As you test various failure modes, you will also discover that there is more than one kind of NamingException, and that you should catch them separately.
answers question: http://stackoverflow.com/q/23028964

http://stackoverflow.com/a/30936383
has body: Using above fix you may get another error :- requestFeature() must be called before adding content to solve that problem use this fix :- Don't call setContentView() before requestFeature().
type: Answer
answers question: http://stackoverflow.com/q/23019691
score: 0

http://stackoverflow.com/q/23113492
has comment: http://stackoverflow.com/comment/35332945
has comment: http://stackoverflow.com/comment/35332700
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35332980
has comment: http://stackoverflow.com/comment/35334388
downvote count: 1
has comment: http://stackoverflow.com/comment/35333126
type: Question
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/9464166
tagged with: session
tagged with: java
has comment: http://stackoverflow.com/comment/35332807
score: -1
has body: In the following snippet,uSession.isNewalways returns false. Why is that ? I create a new session but the corresponding method returns false. HttpSession uSession = request.getSession(); if(uSession.isNew()) {System.out.println("Inside if statement---------"); uSession.setAttribute("username", username); uSession.setMaxInactiveInterval(3600); RequestDispatcher dispatcher = request.getRequestDispatcher("User.jsp"); dispatcher.forward(request, response); } I have even tried after deleting all the localhost cookies from the browser.
has title: isNew returns false even when I have created a new session.Why is that ?
has comment: http://stackoverflow.com/comment/35334447
tagged with: httpsession
has comment: http://stackoverflow.com/comment/35334021
has comment: http://stackoverflow.com/comment/35333434
has comment: http://stackoverflow.com/comment/35332774
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35332979
has comment: http://stackoverflow.com/comment/35332633
has comment: http://stackoverflow.com/comment/35332866
has comment: http://stackoverflow.com/comment/35333980
has comment: http://stackoverflow.com/comment/35333779
has answer: http://stackoverflow.com/a/34087285
favorite count: 0

http://stackoverflow.com/comment/35169318
type: Comment
has text: For this issue you can look into this mail list https://groups.google.com/forum/m/#!msg/rhipe/eL_2H5tNi4c/UGJgXVAx_QgJ
comment on: http://stackoverflow.com/a/23021028
type: AnswerComment
score: 0

http://stackoverflow.com/q/23061544
has comment: http://stackoverflow.com/comment/35239884
tagged with: android
type: AnsweredQuestion
upvote count: 2
score: 1
has answer: http://stackoverflow.com/a/23081170
tagged with: java
possible better answer: http://stackoverflow.com/a/23061671
has answer: http://stackoverflow.com/a/23061605
has comment: http://stackoverflow.com/comment/35239908
downvote count: 1
tagged with: numberpicker
has answer: http://stackoverflow.com/a/23061671
type: Question
has title: Android app dev, custom numberpicker for api level 8
has body: I am trying to create a custom number picker for applications that require minimum of API level 8, so far I got this code, it is simple but I don't know how to fix this error I get. The code so far is this: package com.example.symbol_temp; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Integer counter=0; Button add,sub; final TextView display; add = (Button) findViewById(R.id.plus); sub = (Button) findViewById(R.id.minus); display = (TextView) findViewById(R.id.showtemperature); add.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { counter++; display.setText( "" + counter); } }); sub.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { counter--; display.setText( "" + counter); } }); } } and the XML is this: &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.symbol_temp.MainActivity$PlaceholderFragment" &gt; &lt;TextView android:id="@+id/showtemperature" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;Button android:id="@+id/minus" style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout…
answer count: 3
accepted answer: http://stackoverflow.com/a/23061605
favorite count: 0

http://stackoverflow.com/q/23002490
has comment: http://stackoverflow.com/comment/35132955
has comment: http://stackoverflow.com/comment/35133862
possible better answer: http://stackoverflow.com/a/23003047
has comment: http://stackoverflow.com/comment/35133931
has answer: http://stackoverflow.com/a/23003047
has comment: http://stackoverflow.com/comment/35132916
has comment: http://stackoverflow.com/comment/35133575
has comment: http://stackoverflow.com/comment/35133204
has comment: http://stackoverflow.com/comment/35133414
tagged with: throw
has body: I am trying to create two exceptions, one that is thrown when the month number is greater than 12 or less than 1, and another that is thrown when the month name is invalid. I thought that I included all the necessary steps ( I'm bad at exceptions ), but my main class is still not working. Any insight as to what I did wrong? public class Month { private int monthNumber; /** * Creates a new month set to January */ public Month(){ monthNumber = 1; } /** * Creates a month set to the month number provided by the user * @param m the number of the month */ public Month(int m) throws MonthsNumberException{ if (m&lt;1 || m&gt;12){ throw new MonthsNumberException("Number has to be greater than 1 and less than 12"); }else{ monthNumber = m; } } /** * Creates a month based on the string name provided * @param m String values for the name of the month */ public Month(String m) throws MonthsNameException{ switch(m){ case "January": monthNumber = 1; break; case "February": monthNumber = 2; break; case "March": monthNumber = 3; break; case "April": monthNumber = 4; break; case "May": monthNumber = 5; break; case "June": monthNumber = 6; break; case "July": monthNumber = 7; break; case "August": monthNumber = 8; break; case "September": monthNumber = 9; break; case "October": monthNumber = 10; break; case "November": monthNumber = 11; break; case "December": monthNumber = 12; break; default: throw new MonthsNameException("Invalid month name: " + m); } } /** * changes the month to the number provided * @param m the number of the month */ public void setMonthNumber(int m) throws MonthsNumberException{ if (m&lt;1 || m&gt;12){ throw new MonthsNumberException("Number has to be greater than 1 and less than 12"); }else{ monthNumber = m; } } /** * returns the number of the month * @return the number of the month */ public int getMonthNumber(){ return monthNumber; } /** * returns the name of the month * @return the name of the month */ public String getMonthName(){ String month=""; switch(mon…
has comment: http://stackoverflow.com/comment/35133315
favorite count: 0
has comment: http://stackoverflow.com/comment/35132858
has comment: http://stackoverflow.com/comment/35133519
has comment: http://stackoverflow.com/comment/35133571
has answer: http://stackoverflow.com/a/23003108
has comment: http://stackoverflow.com/comment/35132935
tagged with: exception
has title: Custom exceptions not working
has comment: http://stackoverflow.com/comment/35134926
has comment: http://stackoverflow.com/comment/35132854
score: -2
has comment: http://stackoverflow.com/comment/35132853
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35132968
tagged with: java
downvote count: 2
accepted answer: http://stackoverflow.com/a/23003108
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35132897
has comment: http://stackoverflow.com/comment/35133743
upvote count: 0

http://stackoverflow.com/comment/35105807
type: QuestionComment
has text: Why create and use separate `List`? use array itself.
comment on: http://stackoverflow.com/q/22987988
score: 0
type: Comment

http://stackoverflow.com/q/23103504
accepted answer: http://stackoverflow.com/a/23103749
has title: How does Machine Learning Links with Hadoop?
type: AnsweredQuestion
upvote count: 2
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35315240
tagged with: java
has comment: http://stackoverflow.com/comment/35315069
has body: ML deals with the learning of the machines based upon its experiences or a given set of supervision and we can analyse data based upon the ML algorithms and Hadoop is software framework for storage and large-scale processing of data-sets on clusters of commodity hardware. So my question is: How does ML gets linked with Hadoop ? How are they used together? or Do I have the wrong understanding of these things?
has comment: http://stackoverflow.com/comment/35315360
tagged with: hadoop
has answer: http://stackoverflow.com/a/23103749
answer count: 1
score: 1
has comment: http://stackoverflow.com/comment/35315343
has comment: http://stackoverflow.com/comment/35315021
favorite count: 0

http://stackoverflow.com/q/23109448
type: AnsweredQuestion
upvote count: 0
tagged with: arrays
favorite count: 0
tagged with: class
has answer: http://stackoverflow.com/a/23110251
type: Question
score: -1
answer count: 2
accepted answer: http://stackoverflow.com/a/23110251
downvote count: 1
has title: How can I combine an extra variable to an array/method?
tagged with: java
has body: I have created a simple program which outputs student details. Ideally I would like to give the user an option to add both courses. Will this require a lot of messing about changing code? If not can someone help? class Student { public static void main(String[]args)//The main method; starting point of the program. { Scanner input = new Scanner(System.in); String surName, foreName, courseName; int age,telephone; System.out.println("\t\t\t***********************************************"); System.out.println("\t\t\tWelcome to the Mobile College's Student Records"); System.out.println("\t\t\t***********************************************"); System.out.println("\nHow many students would you like to add?"); int noStudents = input.nextInt(); Stu [] TheStu = new Stu [noStudents]; for (int x = 0; x &lt; noStudents; x++) { System.out.println("Please enter Surname: "); surName = input.next(); System.out.println("Please enter Forename: "); foreName = input.next(); System.out.println("Please enter Age: "); age = input.nextInt(); System.out.println("Please enter Telephone No. "); telephone = input.nextInt(); System.out.println("Which course do you want to add the student to? .......Literacy or Numeracy "); courseName = input.next(); TheStu [x] = new Stu (surName, foreName, age, telephone, courseName); } for (int y = 0; y &lt; noStudents; y++) { System.out.println("\t\t\t***********************************************"); System.out.println ("\t\t\tName: " + TheStu[y].getfName() + " " + TheStu[y].getsName()); System.out.println ("\t\t\tAge: " + TheStu[y].getstuAge()); System.out.println ("\t\t\tTelephone No. 0" + TheStu[y].getphone()); System.out.println ("\t\t\tEnrolled on the " + TheStu[y].getcourseType() + " Course."); System.out.println("\t\t\t***********************************************"); } }// end of class } class Stu { private String sName; private String fName; private int stuAge; private int phone; private String courseType; Stu (String s, String f, int a, int p, Stri…
tagged with: methods
possible better answer: http://stackoverflow.com/a/23109680
has answer: http://stackoverflow.com/a/23109680

http://stackoverflow.com/comment/35309874
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23030981
has text: @TejalN mark this answer as correct, as I inserted the working comment into the answer.
type: AnswerComment

http://stackoverflow.com/q/23038121
has comment: http://stackoverflow.com/comment/35197962
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35198051
has body: Here is my sample program: // writing into a file package file; import java.io.*; public class Writeintofile { /** * @param args the command line arguments */ public static void main(String[] args) { try { FileOutputStream fos=new FileOutputStream("C:/Users/Pavan/Desktop/Myjava/File/bin/city.txt"); int i; while((i=System.in.read())!=-1) { fos.write(i); } // TODO code application logic here } catch(Exception e) { System.out.println(e); } } } Am not able to enter data on the console. What changes do i need to make so that Netbeans can read the data from the console? But everything is working fine if the program is executed from the windows command prompt.
has answer: http://stackoverflow.com/a/23038179
type: Question
linked to: http://stackoverflow.com/q/1653871
tagged with: java
duplicate of: http://stackoverflow.com/q/1653871
score: 0
answer count: 1
tagged with: netbeans-7
has title: How to read from console in netbeans 7.0

http://stackoverflow.com/a/23055899
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35231627
has comment: http://stackoverflow.com/comment/35232238
has body: Why bother using files, if you have database on your hands? Try using database locking like this (https://dev.mysql.com/doc/refman/5.0/en/innodb-locking-reads.html). By the way, what database engine do you use? It might help if you list it.
downvote count: 0
has comment: http://stackoverflow.com/comment/35236724
has comment: http://stackoverflow.com/comment/35236556
type: Answer
answers question: http://stackoverflow.com/q/23055487

http://stackoverflow.com/comment/35159652
has text: I think no such ready tools available. To add more to above comment, if Spring MVC is used, you could start by adding debug break points to the controller classes and invoke appropriate pages to view that stacktrace. You could also try to reverse engineer existing code to UML models which may be help.
comment on: http://stackoverflow.com/q/23016577
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23003186
downvote count: 0
score: 1
has body: By setting ScrollView weight to 1 and height to 0dp it will wrap its height to fill all the space left after the Buttongets layouted to use wrap_content height: <?xml version="1.0" encoding="utf-8"?>
has comment: http://stackoverflow.com/comment/35134563
upvote count: 1
answers question: http://stackoverflow.com/q/23003172
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23003172
type: Answer

http://stackoverflow.com/q/23020388
has comment: http://stackoverflow.com/comment/35165745
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/23020461
has body: Why is it not needed for a Java application to follow the Java naming conventions? In other words, why doesn't the Java compiler raise an error when the conventions are not followed in an application? It would certainly make the life of every programmer easier if no code would exist that contains, for example, class names starting with a lower-case letter or package names starting with an upper-case letter. I understand that it is not possible to start requiring this now, because that would break existing applications, but why has this not been required from the beginning?
possible better answer: http://stackoverflow.com/a/23020496
has answer: http://stackoverflow.com/a/23020461
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35165702
tagged with: java
has comment: http://stackoverflow.com/comment/35165671
type: Question
tagged with: naming-conventions
has answer: http://stackoverflow.com/a/23020496
has title: Why is following Java naming conventions not required for compilation

http://stackoverflow.com/comment/35079934
comment on: http://stackoverflow.com/q/22972306
score: 0
has text: @user3109178 I really think you should always use `setContentPane` for both applets and applications (i.e. `JFrame`). Adding components is intended to be used with a layout manager. You shouldn't lay out your frame, rather you should just lay out a panel which would then act as your frame (after setting the content pane of a frame).
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23032740
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/23032768
score: 0
answer count: 1
has title: Timer code crashes my app
tagged with: onstart
tagged with: timer
has body: I'm learning android development, and what I'm trying to do is to have a label that counts down from 40 minutes, and when it reaches 0 it would stop counting and do something else. This is my code: @Override protected void onStart() { super.onStart(); count = 2400; final Timer t = new Timer();//Create the object t.scheduleAtFixedRate(new TimerTask() { @Override public void run() { minLeft = (int) Math.floor(count / 60); secLeft = count - minLeft * 60; counter = minLeft + ":" + secLeft; TextView tv = (TextView) findViewById(R.id.timer); Log.i(MainActivity.TAG,minLeft+", "+secLeft+", "+counter); tv.setText(counter); count--; if (minLeft &lt;= 0 &amp;&amp; secLeft &lt;= 0) { t.cancel(); count = 2400; onFinish(); } } }, 1000, 1000); } But, when I go to that activity by clicking a button in the main activity, the label has the text "Timer" (its original text), and after a few seconds the app crashes with CalledFromWrongThreadException, but the line that causes the problem seems to be the one where I set the text of the TextView. Please help, thanks in advance.
tagged with: android
tagged with: android-studio
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23032768

http://stackoverflow.com/a/22996831
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22988475
score: 1
upvote count: 1
has body: Eclipse plugin in Gradle that you have used does not support Android projects - they are significantly different from regular Java projects. Some things can work but there will be a lot of things missing including Android nature for generated projects. And the ADT plugin provided by Google does not support Gradle projects yet as the team focuses on Android Studio first. http://tools.android.com/tech-docs/new-build-system can give you some ideas about the current state.
has comment: http://stackoverflow.com/comment/35132886

http://stackoverflow.com/comment/35139627
score: 0
type: QuestionComment
type: Comment
has text: It looks like serialization issue.
comment on: http://stackoverflow.com/q/23005458

http://stackoverflow.com/comment/35301840
type: AnswerComment
has text: @Pshemo, Quincunx: This works. If I have another constraint like the string must have atleast one digit and atleast one alpha, I tried doing `([ ]*+[0-9]++[A-Za-z]++[ ]*+)+`. That doesn't work. What is wrong here?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23091608

http://stackoverflow.com/q/23050018
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/35220465
type: Question
has title: Adding doubles from a file to get total in java
has answer: http://stackoverflow.com/a/23050039
has body: I have a text file that looks like this: Jacob Andrews 8159 Rose Ct Mill City OR 97322 5552127879 64.00 Ryan Perkins 7546 Prince Ave Las Vegas NV 87126 5553451989 13.00 Joshua Gilbert 9278 Monroe Dr Corvallis CA 97330 5552832656 95.00 Miles Crain 4578 Chester Dr Corvallis OR 97331 5552345678 1544.00 Butch Cassidy 5498 Sutton Pl Gresham AZ 97380 5416565797 1798.56 Perry Winkle 8185 Shaver Ave Las Vegas NV 87126 5553812346 195.66 everything is separated by tabs. My while loop is like this: while(fileScan.hasNextLine()) { String currentLine = fileScan.nextLine(); String[]dataSet = currentLine.split("\t"); String firstName = dataSet[0]; String lastName = dataSet[1]; String Address = dataSet[2] +(' '); Address += dataSet[3] +(' '); Address += dataSet[4]; String city = dataSet[5]; String state = dataSet[6]; String zip = dataSet[7]; String phone = dataSet[8]; String donation = dataSet[9]; int ZIP = Integer.parseInt(zip); Double Donation = Double.parseDouble(donation); As you can see I made the donation read as a double, my question is how do I get the donation total? I need to write the code to add up and get the total donations but cannot figure it out. Any advice would be great.
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23050039
tagged with: double
tagged with: addition
type: AnsweredQuestion

android-dialog
type: Tag
tag name: android-dialog
tags question: http://stackoverflow.com/q/22984097
tags question: http://stackoverflow.com/q/23014133

http://stackoverflow.com/comment/35111299
score: 1
comment on: http://stackoverflow.com/q/22990158
has text: Either make your method non-static, pass it an Activity or Context or whatever it needs as a parameter, or have a `singleton` instance statically cached which you can obtain as needed. But remember that you not only have to have the object, you have to be calling it is method at an actually appropriate time, possibly from an appropriate thread, etc.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35220795
comment on: http://stackoverflow.com/q/23050941
score: 0
type: QuestionComment
has text: The `while(true)` goes on forever unless you `break`. The `breaks` you have only exit the switch statements, not the `do/while` loop.
type: Comment

http://stackoverflow.com/q/23094301
tagged with: colors
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21247776
answer count: 0
has comment: http://stackoverflow.com/comment/35300097
tagged with: java
has comment: http://stackoverflow.com/comment/35301032
type: Question
tagged with: testing
has body: i know that the question is a bit confused, but in Java, i want to, example, when a image go less than 0 x of the panel, appear smoothly at another side, like a loop. I'm bit newbie at this hehe, i dont have enought reputation to post images, but there ya go the link. https://i.sstatic.net/gwzno.png public void move(){ x += dx; y += dy; if(x + dx &lt; 0) dx = 0; if(y + dy &lt; 0) dy = 0; if(x + dx &gt; getWidth()) dx = 0; if(y + dy &gt; getHeight()) dy = 0; } this is the movement of my word's method.
has comment: http://stackoverflow.com/comment/35300439
has title: How to make a image when go offset a window, appear at the other side?
score: 0
has comment: http://stackoverflow.com/comment/35299869

http://stackoverflow.com/comment/35326074
type: AnswerComment
has text: You've explained the problem, but have not shown a solution. Can you please post code to fix the problem?
type: Comment
comment on: http://stackoverflow.com/a/23109391
score: 0

http://stackoverflow.com/q/23098478
has body: I have a checkboxlist in my form as following, which I do not know whats the best way to receive its selected options in back-end. &lt;s:form id="search" name="search" method="GET" action="search"&gt; &lt;s:checkboxlist name="mySearch.age" label="Age" list="@com.example.Lists@AGE"/&gt; &lt;s:checkboxlist name="mySearch.gender" label="Gender" list="@com.example.Lists@GENDER"/&gt; &lt;s:select name="mySearch.education" label="Education" list="@com.example.Lists@EDUCATION"/&gt; &lt;s:select name="mySearch.country" label="Country" list="@com.example.Lists@COUNTRY"/&gt; &lt;s:textfield id="mySearch.terms" name="mySearch.terms" label="Terms (Separate by comma)"/&gt; &lt;s:submit value="Submit"/&gt; &lt;/s:form&gt; I am not sure what the type of age should be and how to catch it in back-end. I need them to be as following or any other format to be easy to search based on them age=20%2C30 or age=20,30 1) At the moment it is like following private List&lt;Integer&gt; age; and the values will be as follwoing in the url, mySearch.age=20&amp;mySearch.age=30 2) I used javascript function and simple html (same as this) to send the values as well using following code but it sends them as age=20&amp;age=30 $('#search').serialize() 3) I also used the following code to send them as age=2,3 which is fine but I am wondering how to send the values of other fields of the form along with these values? var formValues = $('#search').serialize(); var obj={}; obj.ages = $('input[name=age]:checked').map(function(){ return this.value; }).get(); alert(obj.ages);
type: Question
has answer: http://stackoverflow.com/a/23281463
has comment: http://stackoverflow.com/comment/35560050
has comment: http://stackoverflow.com/comment/35312368
has comment: http://stackoverflow.com/comment/35609887
tagged with: jsp
tagged with: javascript
answer count: 6
tagged with: jquery
has title: How to send multiple values of checkbox to back-end in param=value1%2Cvalue2 format?
tagged with: struts2
has comment: http://stackoverflow.com/comment/35595166
has comment: http://stackoverflow.com/comment/35312522
has answer: http://stackoverflow.com/a/23277423
has comment: http://stackoverflow.com/comment/35595205
downvote count: 0
has answer: http://stackoverflow.com/a/23342416
favorite count: 0
has comment: http://stackoverflow.com/comment/35595679
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23293352
has comment: http://stackoverflow.com/comment/35595239
has answer: http://stackoverflow.com/a/23324399
has comment: http://stackoverflow.com/comment/35589013
has comment: http://stackoverflow.com/comment/35564638
score: 2
has answer: http://stackoverflow.com/a/23310278
has comment: http://stackoverflow.com/comment/35588960
has comment: http://stackoverflow.com/comment/35595224
has comment: http://stackoverflow.com/comment/35310384
upvote count: 2
tagged with: java

http://stackoverflow.com/a/23127224
accepted answer of: http://stackoverflow.com/q/23127135
score: 1
has body: You could use plain old Iterator to iterate through the list, or instead of hasNext(i, conditions) just check list length (i &lt; conditions.size() - 1) In the end, instead of iterating through whole list, just check if last element's JoinPart is null (at least it is what you are doing) @Override public boolean isValid(List&lt;MyCondition&gt; conditions, ConstraintValidatorContext context) { return conditions.isEmpty() || conditions.get(conditions.size() - 1).getJoinPart() != null; }
has comment: http://stackoverflow.com/comment/35376013
answers question: http://stackoverflow.com/q/23127135
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35372672

applet
tags question: http://stackoverflow.com/q/23047992
tags question: http://stackoverflow.com/q/23045017
tags question: http://stackoverflow.com/q/23087224
tags question: http://stackoverflow.com/q/23082053
tags question: http://stackoverflow.com/q/23035241
tags question: http://stackoverflow.com/q/23033245
tags question: http://stackoverflow.com/q/22985909
tags question: http://stackoverflow.com/q/22972306
tags question: http://stackoverflow.com/q/23055245
type: Tag
tags question: http://stackoverflow.com/q/23030636
tag name: applet
tags question: http://stackoverflow.com/q/23045566
tags question: http://stackoverflow.com/q/23017504
tags question: http://stackoverflow.com/q/23093338
tags question: http://stackoverflow.com/q/23087211
tags question: http://stackoverflow.com/q/23123983
tags question: http://stackoverflow.com/q/23064982
tags question: http://stackoverflow.com/q/22982246
tags question: http://stackoverflow.com/q/23015219
tags question: http://stackoverflow.com/q/23092767
tags question: http://stackoverflow.com/q/23072371
tags question: http://stackoverflow.com/q/22995743
tags question: http://stackoverflow.com/q/23050210
tags question: http://stackoverflow.com/q/23040624
tags question: http://stackoverflow.com/q/22988516
tags question: http://stackoverflow.com/q/22989003
tags question: http://stackoverflow.com/q/23041967
tags question: http://stackoverflow.com/q/23002496
tags question: http://stackoverflow.com/q/22987972
tags question: http://stackoverflow.com/q/23084655
tags question: http://stackoverflow.com/q/23073357
tags question: http://stackoverflow.com/q/23109575
tags question: http://stackoverflow.com/q/23044602

http://stackoverflow.com/q/22981424
type: UnansweredQuestion
tagged with: servlet-listeners
has comment: http://stackoverflow.com/comment/44285963
tagged with: java
has answer: http://stackoverflow.com/a/27949361
tagged with: servlets
type: Question
tagged with: weblogic
tagged with: security
has body: I have Weblogic with datasource which can be used only by users with special role. That's why I have to set run-as role for every servlet in my webapp that needs to use DB. Also I need HttpSessionListener for detecting destroyed sessions, and this listener should make record in DB about the finished session. But by specification I can't set run-as role in web.xml for this listener. Is there any way to do this without tricks? My only thought is to call URL that mapped to special servlet with set run-as section which will do the record to DB. Or I can create TimerTask in some servlet that will check List of finished sessions and do the record, but it's worse case than the servlet calling. I hope more usual and straight solution exists.
score: 0
answer count: 1
has title: How to set run-as role for listener instead of servlet in web.xml?

http://stackoverflow.com/comment/35171706
type: Comment
comment on: http://stackoverflow.com/q/23023430
type: QuestionComment
score: 0
has text: `=+` is not an operator. It is the assignment operator (`=`) followed by the unary plus operator (`+`). `+=` *is* an operator. In the expression `a += b`, it stores the result of `a + b` in `a`.

http://stackoverflow.com/comment/35278085
comment on: http://stackoverflow.com/a/23081353
score: 0
type: AnswerComment
has text: and after geting the connected components i have to make a label matrix as we do in matlab by using labelmatrix(countours) how can i do this in java ??
type: Comment

parameterization
tags question: http://stackoverflow.com/q/23123828
type: Tag
tag name: parameterization

http://stackoverflow.com/comment/76091838
has text: 3 years later is there a better way now to solve this?
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23026354
type: AnswerComment

http://stackoverflow.com/q/23028989
score: 3
has comment: http://stackoverflow.com/comment/35208867
answer count: 0
upvote count: 3
type: UnansweredQuestion
tagged with: maven
tagged with: dependency-management
tagged with: jira
tagged with: java
has comment: http://stackoverflow.com/comment/35190189
has title: Maven 3 transitive dependencies of test dependency are marked as compile, why?
type: Question
downvote count: 0
tagged with: maven-3
favorite count: 0
has body: I observed a strange behaviour in my maven 3.0.5 / JDK 1.7 build. Within the dependency tree I found TEST-resources that have transitive COMPILE dependencies (see section 1 below). This triggers than in a subsequent build phase that maven-jira-plugin:4.2.20 unpacks these resources to the target/class folder (In effect this is the expected/normal behaviour, but not desired here, see section 2 below) On an other machine, (same Maven/JDK version) these dependencies are not marked as COMPILE and the build is running fine. Any hints why the transitive dependencies are marked as compile? [UPDATE 1] I am little bit confused about the -X output... the jira maven plugins seems to do some extra magic... Does "Included..." means that the jira plugin uses the specified version of the dependency-plugin? [DEBUG] Populating class realm maven.api [DEBUG] Created new class realm extension>com.atlassian.maven.plugins:maven-jira-plugin:4.2.20 [DEBUG] Importing foreign packages into class realm extension>com.atlassian.maven.plugins:maven-jira-plugin:4.2.20 [DEBUG] Imported: < maven.api [DEBUG] Populating class realm extension>com.atlassian.maven.plugins:maven-jira-plugin:4.2.20 [DEBUG] Included: com.atlassian.maven.plugins:maven-jira-plugin:jar:4.2.20 [..] [DEBUG] Included: org.apache.maven.plugins:maven-dependency-plugin:jar:2.0 (1) Dependency Tree [INFO] [INFO] --- maven-dependency-plugin:2.5.1:tree (default-cli) @ --- [INFO] com.example.jira.plugins:example-plugin-solman-connector:atlassian-plugin:6.2.0.2-SNAPSHOT [INFO] +- com.atlassian.activeobjects:activeobjects-plugin:jar:0.23.2:provided [..] [INFO] +- javax.xml.ws:jaxws-api:jar:2.2.8:provided [INFO] +- com.sun.xml.ws:jaxws-rt:jar:2.2.8:provided [..] [INFO] +- com.atlassian.jira:jira-core:jar:6.2.2:provided [INFO] | +- com.atlassian.jira:jira-api:jar:6.2.2:provided [..] [INFO] | +- com.atlassian.cargo-test-runner:cargo-test-runner:jar:2.6:test [INFO] | | +- org.codehaus.cargo:cargo-core-uberjar:jar:1.1.2:test [INFO] | | | +- sax…

http://stackoverflow.com/a/22979739
upvote count: 3
has body: Try to initialize TextView before executing asyntask. Like following. try { loading = (TextView) findViewById(R.id.textView2); a = (Atom) new Atom().execute(null,null,null); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); finish(); } I don't know this is correct or not, This my guessing, So, Please let me know what happened. Thanks
type: Answer
accepted answer of: http://stackoverflow.com/q/22979622
answers question: http://stackoverflow.com/q/22979622
score: 3
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/35210011
has text: Thanks,I'll try to find something that works well. I've been trying to learn how to use an IDE, but my class is so fast paced, I barely get enough time to finish assignments.
type: Comment
comment on: http://stackoverflow.com/a/23044845
type: AnswerComment
score: 0

http://stackoverflow.com/a/23090807
type: Answer
has comment: http://stackoverflow.com/comment/35315990
answers question: http://stackoverflow.com/q/23089605
has body: In the error message, you have shown like DEVMSSQL14.test.com, 1433 has failed. I believe, it is correct. I dont think. this host name is correct. which says "TEST" as domain Open the cmd, try to ping DEVMSSQL14.test.com Success case : If you are able to ping, then make sure the services are running for sql in services Failure case: Get the right host name to establish the connection When i tried, i got this message, because i may be out of network. Pinging DEVMSSQL14.test.com [208.64.121.161] with 32 bytes of data: Request timed out. Request timed out.
score: 0

http://stackoverflow.com/q/23017978
accepted answer: http://stackoverflow.com/a/23018494
has title: How to implement a group function in mongoDB using JAVA
has body: The dataset can be found in http://docs.mongodb.org/manual/tutorial/aggregation-zip-code-data-set/ Now , I am trying to implement the following function "Return Average City population by State": db.zips.aggregate( { $group : { _id : { state : "$state", city : "$city" }, pop : { $sum : "$pop" } } }, { $group : { _id : "$_id.state", avgCityPop : { $avg : "$pop" } } } ) with an output of: { "result" : [ { "_id" : "RI", "avgCityPop" : 18933.28301886793 } Please help me in JAVA, Thank you
favorite count: 0
has comment: http://stackoverflow.com/comment/35161522
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35161034
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23018494
type: Question
tagged with: mongodb
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/35225415
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23053427
has text: I would suggest a background process / service rather than a Java program for this.

http://stackoverflow.com/q/23072419
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35260588
has comment: http://stackoverflow.com/comment/35260596
tagged with: sql
has title: Cannot update in SQL with given field
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23072714
has comment: http://stackoverflow.com/comment/35260579
has comment: http://stackoverflow.com/comment/35260694
tagged with: java
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/23072660
has comment: http://stackoverflow.com/comment/35260529
has comment: http://stackoverflow.com/comment/35260573
has body: First of i want to apologise for the title, but when i explain you will understand that why i didn't know how to say this. Anyways, i am writing a chat programm and when i give the "UPDATE" command i follow it up with the name of the field that i want to update and then i give my new values. My problem is that it throughs me to an exception about wrong columns but i am sure after multiple checks that the name of the field i give is the same as the one in my SQL. I use MySQL with phpMyAdmin. Here is my code part: Client: if (mymessage.equals("UPDATE")) { String[] arr = input.nextLine().split(" "); message = id + "-=-" + arr[0].trim() + "-=-" + arr[1].trim(); message2 = encrypt(message, serverAesKey); write.println(message2); write.flush(); } Server: if (msg[2].trim().equals("UPDATE")) { System.out.println("waiting..."); message = read.nextLine(); command = Mediator.decrypt(message, Mediator.getServerAesKey()); System.out.println(command); msg = command.split("-=-"); int id = Integer.parseInt(msg[0].trim()); String field = msg[1].trim(); String update = msg[2].trim(); System.out.println("....."+id+"-"+field+"-"+update); Mediator.updateDB(id, field, update); &gt;&gt;this simply runs the method below public void updateInfo(int id, String field, String update) { Connection connection; try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/chat", "root", ""); switch (field) { case "name": String SQLname = "UPDATE info SET name = " + update + " WHERE id = " + id + ""; PreparedStatement pstmtName = connection.prepareStatement(SQLname); pstmtName.executeUpdate(); break; case "password": String SQLpassword = "UPDATE info SET password = " + update + " WHERE id = " + id + ""; PreparedStatement pstmtPwd = connection.prepareStatement(SQLpassword); pstmtPwd.executeUpdate(); break; } } catch (ClassNotFoundException | SQLException e) { e.printStackTrace(); } } And this is the exception i get: com.mysql.jdbc.exceptions.jdbc…

http://stackoverflow.com/q/23091752
has answer: http://stackoverflow.com/a/23092270
tagged with: arraylist
tagged with: selection-sort
score: 0
has title: Implementing a SelectionSort capable of handling array list, linked list, and doubly linked list in java
has answer: http://stackoverflow.com/a/23100104
has answer: http://stackoverflow.com/a/23092493
has answer: http://stackoverflow.com/a/23092266
tagged with: doubly-linked-list
type: UnansweredQuestion
answer count: 4
tagged with: list
tagged with: java
has body: BACKGROUND: I want to implement a selection sort capable of handling an array list, a linked list, and a doubly linked list. For each list type I have a position{} and list{} class. The position{} class is what holds the list, (i.e. class position{int head; list tail;}). While the LIST{} contains the next(), previous(), end(), Insert(), first() methods and uses position{}, it does not contain the list class itself, the list class itself that constructs the list is called class position{}. QUESTION: My problem is not with making the selection sort compatible, I have achieved this by only using the commands that are common between he three list abstract data types. My problem is that my selection sort returns the same list and does no sort of sorting. The list printed after the sort is the same as the list printed before the sort. Any help is appreciated. output before selection sort 2 879 621 229 702 40 243 312 247 46 711 241 after selection sort 2 879 621 229 702 40 243 312 247 46 711 241 My list ADT's are correct, the problem lies in my poor selectionsort. public static void SelectionSort(LIST A) { POSITION i, j, maxp, temp; for(i = A.Previous(A.End()); !i.isEqual(A.First()); i = A.Previous(i)) { maxp = i; for(j = A.First(); !j.isEqual(i); j = A.Next(j)) { if((Integer)A.Select(j) &gt; (Integer)A.Select(maxp)) { maxp = j; } } temp = i; A.Insert(i, A.Select(maxp)); A.Insert(maxp, A.Select(temp)); A.Delete(maxp); A.Delete(i); } }
type: Question

http://stackoverflow.com/q/23076115
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/36413989
type: UnansweredQuestion
has title: How to pass database connection to Kettle job from java
has answer: http://stackoverflow.com/a/27410226
upvote count: 2
type: Question
has answer: http://stackoverflow.com/a/36140636
tagged with: pentaho
tagged with: java
answer count: 3
score: 2
has body: I have one Kettle job which will get data from database X and copy the data to another database Y. I have used some Kettle jars to run this job from java and its working fine. Now, my requirement is, how can i pass Database name to job from java dynamically? Example: String filename = "myJob.kjb"; KettleEnvironment.init(); JobMeta jobMeta = new JobMeta(filename, null); jobMeta.setParameterValue("TEST_DB", "MyDatabase"); jobMeta.setInternalKettleVariables(); Job job = new Job(null, jobMeta); job.start(); job.waitUntilFinished();

http://stackoverflow.com/comment/35102486
comment on: http://stackoverflow.com/a/22983313
has text: it's not working for some reason , i made each thread fetches only 1 record , when i print count in each thread , there overlapping 1 2 2 1
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35171238
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23023190
has text: We aren't going to do your (homework?) for you. If you make an earnest attempt but then get stuck, we'll be glad to help.
type: Comment

http://stackoverflow.com/comment/35276684
has text: The short answer is no. The long answer is why would you want to do that anyway. And the even longer answer is just use `List.indexOf`.
comment on: http://stackoverflow.com/q/23081806
score: 0
type: QuestionComment
type: Comment

weblogic
tags question: http://stackoverflow.com/q/23128846
tags question: http://stackoverflow.com/q/23084794
tags question: http://stackoverflow.com/q/23057898
tags question: http://stackoverflow.com/q/22983576
tags question: http://stackoverflow.com/q/23103220
tags question: http://stackoverflow.com/q/22974969
tags question: http://stackoverflow.com/q/22981424
tag name: weblogic
tags question: http://stackoverflow.com/q/23127684
tags question: http://stackoverflow.com/q/23036384
type: Tag

http://stackoverflow.com/comment/35161494
type: QuestionComment
has text: @user2666216 i Agreed with NESPowerGlove . Use the ExecutorService. i did mentioned in my answer too
comment on: http://stackoverflow.com/q/23017332
score: 0
type: Comment

http://stackoverflow.com/a/23047791
downvote count: 1
answers question: http://stackoverflow.com/q/23047763
score: 0
type: AcceptedAnswer
has body: Try this: public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter a string"); String s = input.nextLine();// methods should be called with () even if have no argument String lower = ""; String total = ""; for (int i = 0; i &lt; s.length(); i++) { char thisChar = s.charAt(i); // you can replace with : if (Character.isLowerCase(thisChar)) if (thisChar &gt;= 97 &amp;&amp; thisChar &lt;= 122) { lower += thisChar; } }//close the for loop here System.out.println("Total amount of characters: " + s.length() + " - " + s); System.out.println("Lower case letters: " + lower.length() + " - " + lower); }
type: Answer
accepted answer of: http://stackoverflow.com/q/23047763
upvote count: 1

http://stackoverflow.com/comment/35358676
type: QuestionComment
has text: You have to provide more details (e.g. code snippets, screenshots) and improve your question tags. I'm not sure anybody could understand the problem you're facing for now.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23127807

http://stackoverflow.com/a/23065541
answers question: http://stackoverflow.com/q/23065407
has comment: http://stackoverflow.com/comment/35247368
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23065407
has body: I think the issue is you're performing a call on root.gpa, no matter where the node in the tree you're referencing is. Try this. public void inOrderTraverseTree(Node focusNode, double min, double max) { if (focusNode != null) { inOrderTraverseTree(focusNode.leftChild, min, max); if (focusNode.gpa &gt;= min &amp;&amp; focusNode.gpa &lt;= max){ System.out.println(focusNode); } else { System.out.print(""); } inOrderTraverseTree(focusNode.rightChild, min, max); }// end if }// end inOrderTraverseTree

http://stackoverflow.com/comment/35333138
comment on: http://stackoverflow.com/q/23113261
has text: taka look at this https://developers.google.com/feed/ and this https://code.google.com/p/google-gson/
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23123321
possible better answer: http://stackoverflow.com/a/23123359
answer count: 2
has answer: http://stackoverflow.com/a/23123359
upvote count: 0
tagged with: arrays
score: -1
has title: java.lang.NullPointerException when initialize array
has answer: http://stackoverflow.com/a/23123363
favorite count: 0
tagged with: android
has body: I want to initialize and array to my pTotalPrice variable to hold the total price of the product * quantity. I got the error. I did that because the the tablelayout is dynamically created. I need to hold the value total price of each product, hence the final price shows the correct value if I deleted one of the product. the error java.lang.NullPointerException is at pTotalPrice[i] = pPrice * pQuantity; public class ScreenSecondFragment extends Fragment { public ScreenSecondFragment(){} public double pFinalPrice; public double[] pTotalPrice; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_secondscreen, container, false); TextView showCartContent = (TextView)rootView.findViewById(R.id.showCart); final Button thirdBtn = (Button) rootView.findViewById(R.id.third); //Get Global Controller Class obiect (see application tag in AndroidManifest.xml) final Controller aController = (Controller) getActivity().getApplicationContext(); // Get Cart Size final int cartSize = aController.getCart().getCartSize(); /******** Dynamically create view elements - Start **********/ TableLayout ll = (TableLayout) rootView.findViewById(R.id.displayTable); ll.setStretchAllColumns(true); ll.setShrinkAllColumns(true); TableLayout.LayoutParams params = new TableLayout.LayoutParams(); params.setMargins(1, 1, 1, 1); TableRow.LayoutParams param = new TableRow.LayoutParams(); param.span = 3; /****** Title header ******/ TableRow rowProdLabels = new TableRow(this.getActivity()); rowProdLabels.setBackgroundColor(android.graphics.Color.BLUE); // Product column TextView prodLabel = new TextView(this.getActivity()); prodLabel.setText("PRODUCT"); prodLabel.setTypeface(Typeface.SERIF, Typeface.BOLD); prodLabel.setTextSize(17); prodLabel.setTextColor(android.graphics.Color.WHITE); rowProdLabels.addView(prodLabel); // Price column TextView priceLabel = new TextView(this.getActivity()); priceLabel.s…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35350725
tagged with: android-fragments
tagged with: java
accepted answer: http://stackoverflow.com/a/23123363
downvote count: 1
type: Question

http://stackoverflow.com/comment/35319605
comment on: http://stackoverflow.com/a/23105907
type: AnswerComment
has text: you can increase the millisecond to 10000. :)
score: 0
type: Comment

http://stackoverflow.com/comment/35284124
comment on: http://stackoverflow.com/q/23085908
has text: ops, my bad, I taught of classes of course, I have edited it now.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35273834
has text: @npinti, I Agree ,How nice way to guide me.. thank you so much.:)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22979566
type: AnswerComment

http://stackoverflow.com/q/23036646
tagged with: java
has title: Button confusion Passing listModel
type: Question
score: 0
tagged with: handler
answer count: 1
tagged with: button
has answer: http://stackoverflow.com/a/23038653
type: UnansweredQuestion
tagged with: swing
tagged with: parameters
has body: I need to have a box with a jlist and two buttons. One button will close the box and the other will bring up a text box the user can fill in to add an element to the jlist. What I have so far: import java.awt.FlowLayout; import javax.swing.*; public class Main { public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JFrame box = new JFrame("Course List"); box.setSize(600,300); box.setLayout(new FlowLayout()); box.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); box.setVisible(true); DefaultListModel listModel = new DefaultListModel(); JList list = new JList(listModel); list.setSelectedIndex(1); box.add(new JScrollPane(list)); box.pack(); JButton button1 = new JButton("Add Course"); box.add(button1); HandlerClass handler = new HandlerClass(); button1.addActionListener(handler); } } import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.DefaultListModel; import javax.swing.JOptionPane; class HandlerClass implements ActionListener{ public void actionPerformed(ActionEvent e) { String input; input = JOptionPane.showInputDialog(null, "Enter in course name"); } } My issue is I don't know how to pass "ListModel" or if that's even possible so that I can do something like listModel.addElement(input) and add the text from the text to the jlist. EDIT: So I don't know if this is the way it is supposed to be done but I just created an infinite loop in my main and some setters and getters in the handlerclass. It works but my not be the correct way to do it.

http://stackoverflow.com/comment/35095583
type: QuestionComment
has text: provide IDEA and Grails versions pls
score: 1
comment on: http://stackoverflow.com/q/22981104
type: Comment

http://stackoverflow.com/a/23104006
answers question: http://stackoverflow.com/q/23103864
accepted answer of: http://stackoverflow.com/q/23103864
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
has body: try this Collections.sort(persons, new Comparator&lt;Persons&gt;() { @Override public int compare(Persons o1, Persons o2) { return o1.name.compareTo(o2.name); }});
type: Answer

http://stackoverflow.com/q/23103044
has comment: http://stackoverflow.com/comment/35314927
downvote count: 0
score: 1
has body: I am trying to find a way to call a custom method from the phones menu button from within a libGDX screen. Is there a way to do this. i Know that you can catch the touch with Gdx.input.setCatchMenuKey(true); but I have not been able to find a way to call a method. From within the class which extends Screen I would like to have a method such as the following which is called when the phone menu key is pressed: private void onPhoneMenuKeyTouch(){ //do something }
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/35315007
tagged with: android
has comment: http://stackoverflow.com/comment/35315438
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35314751
linked to: http://stackoverflow.com/q/7223723
tagged with: libgdx
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35314971
has title: call method from android phone menu button with libGDX

http://stackoverflow.com/comment/35214746
comment on: http://stackoverflow.com/a/23001820
type: AnswerComment
score: 0
has text: CS5 does it so probably CS6 does it too (I don't know about the other versions)
type: Comment

http://stackoverflow.com/a/52731603
has comment: http://stackoverflow.com/comment/92388430
score: 3
upvote count: 3
has body: In my case: spring boot 2 ,multiple datasource(default and custom). entityManager.createQuery go wrong: 'entity is not mapped' while debug, i find out that the entityManager's unitName is wrong(should be custom,but the fact is default) the right way: @PersistenceContext(unitName = "customer1") // !important, private EntityManager em; the customer1 is from the second datasource config class: @Bean(name = "customer1EntityManagerFactory") public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder, @Qualifier("customer1DataSource") DataSource dataSource) { return builder.dataSource(dataSource).packages("com.xxx.customer1Datasource.model") .persistenceUnit("customer1") // PersistenceUnit injects an EntityManagerFactory, and PersistenceContext // injects an EntityManager. // It's generally better to use PersistenceContext unless you really need to // manage the EntityManager lifecycle manually. // 【4】 .properties(jpaProperties.getHibernateProperties(new HibernateSettings())).build(); } Then,the entityManager is right. But, em.persist(entity) doesn't work,and the transaction doesn't work. Another important point is: @Transactional("customer1TransactionManager") // !important public Trade findNewestByJdpModified() { //test persist,working right! Trade t = new Trade(); em.persist(t); log.info("t.id" + t.getSysTradeId()); //test transactional, working right! int a = 3/0; } customer1TransactionManager is from the second datasource config class: @Bean(name = "customer1TransactionManager") public PlatformTransactionManager transactionManager( @Qualifier("customer1EntityManagerFactory") EntityManagerFactory entityManagerFactory) { return new JpaTransactionManager(entityManagerFactory); } The whole second datasource config class is : package com.lichendt.shops.sync; import javax.persistence.EntityManagerFactory; import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.fa…
answers question: http://stackoverflow.com/q/23018836
type: Answer
downvote count: 0

http://stackoverflow.com/q/23105684
possible better answer: http://stackoverflow.com/a/23106032
has answer: http://stackoverflow.com/a/23105993
has comment: http://stackoverflow.com/comment/35318776
has comment: http://stackoverflow.com/comment/35319074
favorite count: 0
has comment: http://stackoverflow.com/comment/35318864
has answer: http://stackoverflow.com/a/23106003
answer count: 5
upvote count: 7
accepted answer: http://stackoverflow.com/a/23105993
has body: I have a program in Java that generates a float value aggressiveness that can be from 0 to infinite. What I need to do is that the higher this float is, the higher there are chances the program fires a function attackPawn(). I already found out that I need the function Math.random(), which gives a random value between 0 and 1. If Math.random() is lower than aggressiveness transformed into a float between 0 and 1, I call the function attackPawn(). But now I am stuck, I can't figure out how I can transform aggressiveness from 0 to infinite to a float which is from 0 to 1, 1 meaning "infinite" aggressiveness and 0 meaning absence of anger. Any ideas or math equation?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23106015
has answer: http://stackoverflow.com/a/23106098
score: 7
tagged with: math
tagged with: java
tagged with: game-development
has title: How to clamp a value from 0 to infinite to a value from 0 to 1?
type: Question
has comment: http://stackoverflow.com/comment/35318995
has answer: http://stackoverflow.com/a/23106032
has comment: http://stackoverflow.com/comment/35319162
has comment: http://stackoverflow.com/comment/35318847
downvote count: 0

http://stackoverflow.com/q/23039389
answer count: 1
has body: I just want to draw an image, within a set range of width, height, that instead of scaling just omits the extra part of the image that doesn't fit within that box. g.drawImage(img, 3, 106, bgST.getWidth()-700, bgST.getHeight()-700, null); Basically this, but without the autoscaling
has comment: http://stackoverflow.com/comment/35200042
tagged with: resolution
has title: Is there a drawImage method that doesn't auto scale?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35200011
has comment: http://stackoverflow.com/comment/35200414
tagged with: drawimage
has comment: http://stackoverflow.com/comment/35204795
tagged with: java
tagged with: render
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/23039624
score: 0

http://stackoverflow.com/comment/35200878
has text: I'm a big fan of constructors, I personally think this code would look nicer with a constructor that instantiates allTabs = to a new HashMap<String, JPanel>()
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23039677

http://stackoverflow.com/q/23062568
has body: Suppose you are given a set of N intervals (represented as left and right coordinates) and M points. For each point P algorithm should find number of intervals to which P belongs. Here's my algorithm: 1) Put left and right coordinates of intervals in "left" and "right" arrays respectively 2) Sort "left", exchanging entries simultaneously with "right" 3) Given a point P, find a maximum i such that left[i] &lt;= P 4) For each j &lt;= i, add 1 to result if right[j] >= P 5) Return result Implementation in Java: import java.util.*; class Intervals { public static int count(int[] left, int[] right, int point) { int k = find(left, point), result = 0; for (int i=0; i &lt; k; i++) if (point &lt;= right[i]) result++; return result; } private static int find(int[] a, int point) { if (point &lt; a[0]) return -1; int i = 0; while (i &lt; a.length &amp;&amp; a[i] &lt;= point) i++; return i; } private static void sort(int[] a, int[] b) { sort(a, b, 0, a.length-1); } private static void sort(int[] left, int[] right, int lo, int hi) { if (hi &lt;= lo) return; int lt = lo, gt = hi; exchange(left, right, lo, lo + (int) (Math.random() * (hi-lo+1))); int v = left[lo]; int i = lo; while (i &lt;= gt) { if (left[i] &lt; v) exchange(left, right, lt++, i++); else if (left[i] &gt; v) exchange(left, right, i, gt--); else i++; } sort(left, right, lo, lt-1); sort(left, right, gt+1, hi); } private static void exchange(int[] left, int[] right, int i, int j) { int temp = left[i]; left[i] = left[j]; left[j] = temp; temp = right[i]; right[i] = right[j]; right[j] = temp; } private static boolean less(int[] a, int i, int j) { return a[i] &lt; a[j]; } public static void main(String[] args) { int n = Integer.parseInt(args[0]); int m = Integer.parseInt(args[1]); int[] left = new int[n]; int[] right = new int[n]; Random r = new Random(); int MAX = 100000; for (int i = 0; i &lt; n; i++) { left[i] = r.nextInt(MAX); right[i] = left[i] + r.nextInt(MAX/4); } sort(left, right); for (int i=0; i &lt; m; i++) Syste…
has answer: http://stackoverflow.com/a/23066773
has answer: http://stackoverflow.com/a/23062684
has comment: http://stackoverflow.com/comment/35242144
upvote count: 1
type: Question
tagged with: algorithm
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35241908
has title: Given a set of intervals, find how many intervals contain a point
has answer: http://stackoverflow.com/a/23062868
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/35242074
has comment: http://stackoverflow.com/comment/35242270
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35323960
comment on: http://stackoverflow.com/a/23040085
type: AnswerComment
has text: This is a valid statement; thanks for sharing that. It is, however, not an answer to the original question.
score: 0
type: Comment

http://stackoverflow.com/a/22973597
downvote count: 0
has body: Run your program like this: java Program &gt; /dev/null On Windows, you can do this instead. java Program &gt;NUL
answers question: http://stackoverflow.com/q/22973572
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/35194535
type: Comment
has text: But I must define the tag which will be used in comparation. I can not compare like that
comment on: http://stackoverflow.com/a/23036330
type: AnswerComment
score: 0

http://stackoverflow.com/q/22983466
linked to: http://stackoverflow.com/q/6850326
has comment: http://stackoverflow.com/comment/35098116
linked to: http://stackoverflow.com/q/5048852
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22983706
has title: Dynamic JFreeChart with custom x-axis values
type: AnsweredQuestion
tagged with: java
tagged with: jfreechart
type: Question
has answer: http://stackoverflow.com/a/22983706
has body: I have seen this example of jfreechart to plot a moving graph using DynamicTimeSeriesCollection class. I need the same with custom X-Axis values. The values would be in the range of milliseconds, so I can't use Second class' constructor. Please explain in a bit detail, I have just started with JFreeChart today

http://stackoverflow.com/q/23051455
accepted answer: http://stackoverflow.com/a/23052312
tagged with: key-bindings
tagged with: java
has title: Problems with KeyBindings
type: AnsweredQuestion
has body: I've switched from KeyListeners to KeyBindings as instructed, however they still seem to do nothing. My keybinds are set up as to allow the left and right arrow keys to call a setDx() method in paddle.java which instructs the move() method to move the paddle. gamePanel.java: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class gamePanel extends JPanel implements ActionListener { paddle Paddle; boolean ingame = true; int delay = 1000; Timer timer; JLabel text = new JLabel("stuff here"); InputMap im = this.getInputMap(JPanel.WHEN_IN_FOCUSED_WINDOW); ActionMap am = this.getActionMap(); public gamePanel() { setBackground(Color.WHITE); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), "RightArrow"); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), "LeftArrow"); add(text); text.setBounds(100, 100, 200, 300); timer = new Timer(delay, this); Paddle = new paddle(); timer.start(); } @Override public void paint(Graphics g) { super.paint(g); if (ingame) { g.drawImage(Paddle.getImage(), Paddle.getX(), Paddle.getY(), Paddle.getWidth(), Paddle.getHeight(), this); } } @Override public void actionPerformed(ActionEvent ae) { Object obj = ae.getSource(); if (obj == timer) { Paddle.move(); validate(); repaint(); } } public class ArrowAction extends AbstractAction { private String cmd; public ArrowAction(String cmd) { this.cmd = cmd; } @Override public void actionPerformed(ActionEvent e) { if (cmd.equalsIgnoreCase("LeftArrow")) { Paddle.setDx(-20); } else if (cmd.equalsIgnoreCase("RightArrow")) { Paddle.setDx(20); } } } /* @Override public void keyPressed(KeyEvent ke) { int KeyCode = ke.getKeyCode(); if (KeyCode == KeyEvent.VK_LEFT) { text.setText("key pressed"); Paddle.setDx(-20); } if (KeyCode == KeyEvent.VK_RIGHT) { Paddle.setDx(20); } } @Override public void keyReleased(KeyEvent ke) { int KeyCode = ke.getKeyCode(); if (KeyCode == KeyEvent.VK_LEFT) { Paddle.setDx(0); } if (KeyCode == KeyEvent.VK_RIGHT) { Paddle.setDx(0); } } @Override public void keyTy…
tagged with: awt
has answer: http://stackoverflow.com/a/23052312
possible better answer: http://stackoverflow.com/a/23051506
type: Question
has answer: http://stackoverflow.com/a/23051506
has comment: http://stackoverflow.com/comment/35221761
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35223078
tagged with: swing

http://stackoverflow.com/comment/35219207
score: 0
comment on: http://stackoverflow.com/q/23026969
has text: Hi salk31, I am going back by clicking on a button. Please see "The calling code from "EditAwardsView1" to return to the "SelectPerson" view is:" above. I have added another Window.alert in the first view and when I return to the first view it seems that another instance of the view is created as it displays twice. How do I trow away the first instance of the view please. Regards, Glyn
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35218433
has text: @MarkoTopolnik Well, assuming that my 'group' is indeed the minority, I would believe that the reason why that would be is because example code like the one above is everywhere on the inter-webs and programmers, especially new ones, are forced to think that that is the standard and yet no, not really. It's hideous, if I am to be polite (nothing to do with the answer, just the bracket style). Well, to each his own I guess..
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22981950
type: AnswerComment

http://stackoverflow.com/comment/35198738
type: QuestionComment
has text: as mentioned by pakkudon your get method is not worth . you should write return myScanner; now coming back to your problem you can use hashmap where you will insert number as key and its count as value. before putting value in map check if number is already put in , if yes then increment that count if not then put number as key and 1 as count
score: 0
comment on: http://stackoverflow.com/q/23038371
type: Comment

http://stackoverflow.com/comment/35356345
score: 0
type: AnswerComment
type: Comment
has text: Works. I have mistake in type parameters. :-)
comment on: http://stackoverflow.com/a/23126305

http://stackoverflow.com/comment/35298143
type: AnswerComment
type: Comment
has text: @delnan Wait, no. If you look at [source](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/Hashtable.java#354) you will see that there is indeed a hashCode *and* an equals comparison. Therefore, the original would still hold if I'm not mistaken.
comment on: http://stackoverflow.com/a/23093433
score: 0

http://stackoverflow.com/comment/49116603
type: Comment
type: QuestionComment
has text: This question is not a duplicate of the question "Properly removing an Integer from a List<Integer>". That question relates to the pitfall of calling remove(int index) when remove(Object o) was intended, or vice versa. This question relates to the problem of removing multiple items from a list where the index of future items has been altered by the removal of preceding items.
comment on: http://stackoverflow.com/q/23096807
score: 1

http://stackoverflow.com/comment/35217311
score: 0
has text: @Takendarkk okay I edited the above code to show
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23048655

http://stackoverflow.com/a/23039911
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23039756
has body: Try this one. String[] str = new String[] { "\"test\"-a-\"test2\"-b-\"test3\"", "\"test\"-a-\"test2\"-b\"test3\"", "\"test\"-a-\"test2\"b\"test3\"" }; // quote then one or more lower letter quote - one lower letter - &lt;same pattern till the end&gt; Pattern p = Pattern.compile("^(\"[a-z]+\"-[a-z]-\"[a-z]+\\d\"-[a-z]-\"[a-z]+\\d\")$"); for (String s : str) { Matcher m = p.matcher(s); System.out.println(s + (m.find() ? " found" : " not found")); } output: "test"-a-"test2"-b-"test3" found "test"-a-"test2"-b"test3" not found "test"-a-"test2"b"test3" not found

http://stackoverflow.com/q/23057226
has comment: http://stackoverflow.com/comment/35232642
downvote count: 0
tagged with: unicode
favorite count: 0
tagged with: java.util.scanner
type: UnansweredQuestion
tagged with: input
upvote count: 1
answer count: 0
score: 1
tagged with: java
has title: Both Scanner and BufferedReader not reading the first line of file in unicode format
type: Question
has body: I have tried reading file contents line by line using BufferedReader. Then, i tried with scanner also. The problem is, If i read the file in unicode format, the first line is not read. Please help. I used Tamil with Latha font. My code: with bufferedreader File SourceFile=new File("D:/sample.txt"); FileInputStream f1=new FileInputStream(SourceFile); BufferedReader br1=new BufferedReader(new InputStreamReader(f1, "UTF8")); LineNumberReader lnr = new LineNumberReader(new FileReader(SourceFile)); lnr.skip(Long.MAX_VALUE); int lines=lnr.getLineNumber(); lnr.close(); for(i=0;i&lt;lines;i++) { System.out.println(s); } br1.close();
has comment: http://stackoverflow.com/comment/35232227

http://stackoverflow.com/a/23014765
type: Answer
downvote count: 0
has body: This &lt;bean id="myid" class="com.my.package.MyClass"&gt; &lt;property name="myVariable" value="${params.myvariable}" /&gt; &lt;/bean&gt; means that you have a class MyClass such as class MyClass { ... public void setMyVariable(String value) { ... } } With what you describe, the ... can be replaced with your static field private static String myVariable; // in setter method myVariable = value; This is a workaround to autowire a static field, which normally cannot be done. Spring works on beans (instances), not on classes.
score: 9
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23014717
answers question: http://stackoverflow.com/q/23014717
upvote count: 9

http://stackoverflow.com/q/22980193
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35093201
tagged with: maven
has title: Ignoring persistence.xml -> EntityManager is null
has comment: http://stackoverflow.com/comment/35094771
score: 2
has comment: http://stackoverflow.com/comment/35092947
downvote count: 0
has body: when I try to inject the EntityManager, it is always null without throwing an exception. It doesn't matter where the persistence.xml is placed, if it is empty or missing; this file seems completly to be ignored. My persistence.xml is placed in src/main/resources/META-INF/. I try to get it run in a Jetty now for 2 days, but there is no way. I would really appreciate your help. My producer: @Singleton public class ApplicationResources { @PersistenceUnit private EntityManagerFactory emManagerFactory; @Produces public EntityManagerFactory produces() { System.err.println("produces " + emManagerFactory); return emManagerFactory; } } My DAO @Stateless public class AverageCountryPricesDAO { @Inject private EntityManagerFactory emManagerFactory; public AverageCountryPricesDAO() { System.err.println("construct DAO"); } public void testit() { System.err.println("emManagerFactory: " + emManagerFactory); } } My pom.xml org.glassfish javax.faces 2.1.8 javax javaee-api 6.0 provided org.primefaces primefaces 4.0 com.oracle ojdbc6 11.2.0.3.0 org.hibernate hibernate-entitymanager 4.1.8.Final org.jboss.weld.servlet weld-servlet 2.0.0.Final org.eclipse.jetty jetty-plus 8.1.7.v20120910 jar org.eclipse.jetty jetty-webapp 8.1.7.v20120910 Thanks in advance, Tim
tagged with: java
has comment: http://stackoverflow.com/comment/35093333
tagged with: code-injection
type: Question
tagged with: persistence
upvote count: 2
has comment: http://stackoverflow.com/comment/35093133
tagged with: entitymanager
favorite count: 0

http://stackoverflow.com/comment/35230324
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23056161
has text: I would like to compare the NAME of Person, i.e., person.getName() and not the person object itself. The Person object contains other variables which I do not want to account for. What do you think I can implement?

http://stackoverflow.com/comment/35138865
has text: It seems more of a bubble sort to me.
score: 1
comment on: http://stackoverflow.com/a/23005963
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23033691
has comment: http://stackoverflow.com/comment/35201328
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/23031984
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23031984
has body: Use the text tag &lt;s:i18n name="samplePrj"&gt; &lt;s:text name="com.samplePrj.Successmessage" /&gt; &lt;/s:i18n&gt; it will load the bundle using i18n tag from samplePrj.properties and print the value from key com.samplePrj.Successmessage in it. or you can use it with getText() but your action class should extend ActionSupport. &lt;s:property value="getText('com.samplePrj.Successmessage')"/&gt;
type: Answer
has comment: http://stackoverflow.com/comment/35200237

http://stackoverflow.com/comment/53456856
comment on: http://stackoverflow.com/a/32723971
has text: Could you show your Procfile and you java files so we can see how this works please?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23077489
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/23078017
tagged with: regex
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35269433
has title: Remove inner double quote in CSV file
has answer: http://stackoverflow.com/a/42323170
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35317597
has body: I have a CSV file which contains double quote inside the data. EI_SS EI_HDR,"Test FileReport, for" Testing" EI_DT,tx,tx,tx,tx,tx,tx,tx,tx,tx,tx,tx,tx,tx,tx,tx,dt8,tx EI_COL,"Carrier, Name","Carrier ID","Account Name","Account ID","Group Name","Group ID","Action Code","File ID","Contract","PBP ID","Response Status","Claim Number","Claim Seq","HICN","Cardholder ID","Date of Service","NDC" "Test Carrier" ,"MPDH5427" ,"1234" ,"CSNP" ,"TestD" Test" ,"FH14077" ,"" ,"PD14079042" ,"H5427" ,"077" ,"REJ" ,"133658279751004" ,"999" ,"304443938A" ,"P0002067501" ,01/01/2014,"50742010110" ,"C" "Test, Carrier1" ,"BCRIMA" ,"Carrier" ,"14" ,"123333" ,"00000MCA0014001" ,"" ,"PD14024142" ,"H4152" ,"013" ,"REJ" ,"133658317280023" ,"999" ,"035225520A" ,"ZBM200416667" ,01/01/2014,"00378350505" The Updated Actual CSV Now I want to remove the inner quotes from these data but need to keep outer double quotes for each data. For processing file, I have used "\"[a-zA-Z0-9 ]+[,][ a-zA-Z0-9]+\"" pattern to split the file. But if there is any inner quote in any row then the code breaks. I need to convert this into XLSX by keeping comma's and replacing inner quotes (if not possible then removing those inner quotes. Please help me to solve this issue.
has answer: http://stackoverflow.com/a/23077647
has comment: http://stackoverflow.com/comment/35269676
score: 0
answer count: 3

http://stackoverflow.com/q/23004921
tagged with: java
has answer: http://stackoverflow.com/a/41108367
type: Question
has body: Specifically, I have TabPane, and I would like to know if there is element with specific ID in it. So, I would like to do this with lambda expression in Java: boolean idExists = false; String idToCheck = "someId"; for (Tab t : tabPane.getTabs()){ if(t.getId().equals(idToCheck)) { idExists = true; } }
upvote count: 137
has title: How to check if element exists using a lambda expression?
has comment: http://stackoverflow.com/comment/115914348
answer count: 3
score: 137
has answer: http://stackoverflow.com/a/23004988
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/48945247
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23004988
possible better answer: http://stackoverflow.com/a/41108367

http://stackoverflow.com/a/23030789
accepted answer of: http://stackoverflow.com/q/23020493
answers question: http://stackoverflow.com/q/23020493
has body: It fails to compile in JDK 1.5, 1.6 and 1.7, but works in JDK 1.8. Update: It seems like the fact that it worked with the first JDK8 versions was actually a bug: It worked in JDK 1.8.0_05, but according to this question and the answer by medvedev1088, this code will no longer compile in 1.8.0_25, which is the behavior that conforms to the JLS I don't think that this is a bug that was fixed. Instead, it's rather an effect of the changes that are related to the method invocation mechanisms for lambda expressions in Java 8. Most people would probably agree that the section about "Method Invocation Expressions" is by far the most complex incomprehensible part of the Java Language Specification. And there is probably a whole team of engineers concerned with cross-checking and validating this section. So any statement or any attempted reasoning should be taken with a huge grain of salt. (Even when it comes from the aforementioned engineers). But I'll give it a try, to at least flesh out the relevant parts that others may refer to for a further analysis: Considering the section about Method Invocation Expressions in JLS 7 Method Invocation Expressions in JLS 8 and considering that both methods are "Potentially Applicable Methods" ( JLS7 / JLS8 ), then the relevant subsection is the one about Phase 3: Identify Applicable Variable Arity Methods in JLS7 Phase 3: Identify Methods Applicable by Variable Arity Invocation in JLS8 For JLS 7, it states The method m is an applicable variable-arity method if and only if all of the following conditions hold: For 1 = i < n, the type of ei, Ai, can be converted by method invocation conversion to Si. ... (The other conditions are referring to forms of invocation that are not relevant here, e.g. invocations that really use the varargs, or invocations that involve generics) Referring to the example: A method is applicable for the actual argument expression b of type Byte when b can be converted to the respective formal method parameter via…
has comment: http://stackoverflow.com/comment/48391618
has comment: http://stackoverflow.com/comment/48393648
type: AcceptedAnswer
downvote count: 0
score: 8
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/48394305
has comment: http://stackoverflow.com/comment/48391015

http://stackoverflow.com/a/23001126
upvote count: 1
has comment: http://stackoverflow.com/comment/35130828
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23000676
has comment: http://stackoverflow.com/comment/35130850
type: Answer
has body: In the CsvPreference.EXCEL_PREFERENCE you've given, the quote character is the " as described in the javadoc. The quote character is a character you use to wrap special characters that want you want to appear literally. As such, for these preferences, the appropriate way to produce your CSV content would be id, name, city, age 1,"""Bob""",London,12 Otherwise, the CSV parser simply thinks "Bob" means, literally, Bob since there is no other special character between the quotes. But a quote is a special character so if it appears between quotes, it will be considered, literally, as a quote. Alternatively, provide a different CsvPreference object which has a different quote character. Make this decision only after you are certain about what your CSV producer is sending you.

http://stackoverflow.com/comment/35287157
comment on: http://stackoverflow.com/a/23087403
score: 0
type: Comment
type: AnswerComment
has text: The optimal solution would be to modify the collection of classes, but that is unfortunately impossible. I thought about Interfaces, too, but I don't see how they could help here. The problem is only with creation of the wrapped object. When I implement `class AircraftW`'s constructor to also allow for `Vehicle.class` to be passed, the rest is fine. But that way I don't have a consistency check.

google-app-engine
tags question: http://stackoverflow.com/q/23040812
tags question: http://stackoverflow.com/q/23072732
tags question: http://stackoverflow.com/q/23087123
tag name: google-app-engine
tags question: http://stackoverflow.com/q/23047290
tags question: http://stackoverflow.com/q/23057810
type: Tag
tags question: http://stackoverflow.com/q/23044349
tags question: http://stackoverflow.com/q/23038524
tags question: http://stackoverflow.com/q/23077456
tags question: http://stackoverflow.com/q/23003381
tags question: http://stackoverflow.com/q/23048040
tags question: http://stackoverflow.com/q/23121614
tags question: http://stackoverflow.com/q/23084910
tags question: http://stackoverflow.com/q/23028965
tags question: http://stackoverflow.com/q/23059791
tags question: http://stackoverflow.com/q/23055616
tags question: http://stackoverflow.com/q/23083216
tags question: http://stackoverflow.com/q/23002936
tags question: http://stackoverflow.com/q/22969652
tags question: http://stackoverflow.com/q/23071791
tags question: http://stackoverflow.com/q/23037783
tags question: http://stackoverflow.com/q/23040387
tags question: http://stackoverflow.com/q/23015761
tags question: http://stackoverflow.com/q/23000684
tags question: http://stackoverflow.com/q/23057678
tags question: http://stackoverflow.com/q/23073655
tags question: http://stackoverflow.com/q/23046822
tags question: http://stackoverflow.com/q/22987376
tags question: http://stackoverflow.com/q/22974475
tags question: http://stackoverflow.com/q/22968539
tags question: http://stackoverflow.com/q/23074886
tags question: http://stackoverflow.com/q/23043117
tags question: http://stackoverflow.com/q/23049083
tags question: http://stackoverflow.com/q/23062469

http://stackoverflow.com/comment/35198882
comment on: http://stackoverflow.com/a/23038601
has text: I am using `jdk1.6.0_23`. No matter what is the implantation. I think you have got the answer of your question `every object belong to a class then it is of which class?`
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35126249
type: Comment
score: 0
has text: https://downloads.teradata.com/download/connectivity/jdbc-driver
type: QuestionComment
comment on: http://stackoverflow.com/q/22998749

http://stackoverflow.com/a/23052364
type: Answer
has comment: http://stackoverflow.com/comment/35227856
has comment: http://stackoverflow.com/comment/35227558
has comment: http://stackoverflow.com/comment/35224299
has comment: http://stackoverflow.com/comment/35228299
upvote count: 1
answers question: http://stackoverflow.com/q/23052170
downvote count: 0
score: 1
has body: Try This Document doc = Jsoup.connect("https://www.facebook.com/plugins/fan.php?connections=100&amp;id=pageid").timeout(0).get(); Elements nameLinks = doc.getElementsByClass("link"); for (Element users : nameLinks) { String name = users.attr("title"); String url = users.attr("href"); System.out.println(name + "-" + url); } It will give all the users name and URl present on the first link defined in your question.
has comment: http://stackoverflow.com/comment/35227605
has comment: http://stackoverflow.com/comment/35227779

http://stackoverflow.com/comment/35361930
comment on: http://stackoverflow.com/q/23126618
score: 0
has text: Making the field required is not an option? The setup to me seems that it is a mandatory selection. I must admit I have no experience with making items disabled, I just let the value submit and deal with the poor selection choice server side.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22969295
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22969132
type: Answer
has body: The method in the implementing class is considered to override the interface method, only when erasures of both methods are identical or erasure of method in implementing class is override compatible with the erasure of method in interface. So what's the erasure of method in interface? It's like this: public Interface2 method(Interface1 a); So, out of your two methods: public SubTypeofInterface2 Method(Interface1 a); //fine public SubTypeofInterface2 Method(SubTypeofInterface1 a); // not accepted Only the first one is override compatible with the erased method. Covariant type in return type is allowed. But the second method is not override compatible. Covariant type are not allowed in parameters while overriding. That is why it fails to compile. It works the same way as the normal non-generic method overriding: interface Test { Object get(Object obj); } class TestImpl implements Test { // Valid override @Override public String get(Object obj) { return null; } // This doesn't override interface method. public String get(String obj) { return null; } }

http://stackoverflow.com/comment/35135209
comment on: http://stackoverflow.com/a/23003108
type: Comment
has text: @user2288575 It does work, I copy and pasted your entire code into eclipse and I only changed what I showed you above. It works. If you enter an incorrect number it will crash the program and post your Exception to the console. If you enter a correct number and month name the program runs fine. Recopy and paste your code from your original post and just change `extends Exception` to `extends RuntimeException`.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35285721
score: 0
has text: @Steinar Good catch! You're right! Someone put | (pipes) instead of \n. In the heat of battle I hadn't thought of that, because that was my first work with zip. I'm not sure, but should you rewrite your comment as an answer?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23071656

http://stackoverflow.com/q/22982672
has body: im beginner with android programming.I have simple problem.. and i dont know what to start with. I took someones else code. I need to get all information hold in this database table and convert it so json string. how may i do that ? here's the code : package com.project.sqlite; import java.util.ArrayList; import java.util.List; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class DatabaseDataHandler extends SQLiteOpenHelper { // All Static variables // Database Version private static final int DATABASE_VERSION = 3; // Database Name private static final String DATABASE_NAME = "simplify_1"; // DATA table name private static final String TABLE_DATA = "FORMS"; // DATA Table Columns names private static final String KEY_DATA_ID = "id"; private static final String KEY_OBJECT_ID = "objectID"; private static final String KEY_TYPE = "type"; private static final String KEY_DATE = "date"; private static final String KEY_JSON = "json"; public DatabaseDataHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { String CREATE_DATA_TABLE = "CREATE TABLE " + TABLE_DATA + "(" + KEY_DATA_ID + " INTEGER PRIMARY KEY," + KEY_OBJECT_ID + " TEXT," + KEY_TYPE + " TEXT," + KEY_DATE + " DATE," + KEY_JSON + " TEXT" + ")"; db.execSQL(CREATE_DATA_TABLE); } // Upgrading database @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // Drop older table if existed db.execSQL("DROP TABLE IF EXISTS " + TABLE_DATA); // Create tables again onCreate(db); } /** * All CRUD(Create, Read, Update, Delete) Operations */ // Add new DATA public void addData(Data data) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_OBJECT_ID, data.getObjectID()); values.put(KEY_TYPE, data.getType()); val…
score: 0
linked to: http://stackoverflow.com/q/18857884
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/35097805
has comment: http://stackoverflow.com/comment/35098343
has comment: http://stackoverflow.com/comment/35103301
type: UnansweredQuestion
has title: Json string to java objects
tagged with: android
has comment: http://stackoverflow.com/comment/35096823
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/22983299

http://stackoverflow.com/comment/35204475
type: QuestionComment
type: Comment
score: 1
has text: @KugathasanAbimaran ,i asking a general question not specific to some example
comment on: http://stackoverflow.com/q/23042236

http://stackoverflow.com/q/23084344
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I have created an CSV exporter where I am converting String in JSON format into the Collection of objects and then into the List of strings. Gson gson = new Gson(); Type collectionType = new TypeToken&lt;Collection&lt;itemModel&gt;&gt;(){}.getType(); Collection&lt;itemModel&gt; objects = gson.fromJson(jsonString, collectionType); // jsonString = "[{"name":"A","number":25},{"name":"B","number":26}]" String filename = "export.csv"; FacesContext fc = FacesContext.getCurrentInstance(); ExternalContext ec = fc.getExternalContext(); ec.responseReset(); ec.setResponseContentType("text/comma-separated-values"); ec.setResponseHeader("Content-Disposition", "attachment; filename=\"" + filename + "\""); OutputStream output = ec.getResponseOutputStream(); List&lt;String&gt; strings = new ArrayList&lt;String&gt;(); for (itemModel obj : objects) { strings.add(obj.getName() + ";" + obj.getNumber() +"\n"); } for (String s : strings) { output.write(s.getBytes()); } fc.responseComplete(); Now, I would like to do the adding of a new string into the List dynamically and replace this row: strings.add(obj.getName() + ";" + obj.getNumber() +"\n"); It should be more robust. Is somehow possible call all getters if I dont know exact names of properties? Or is better solution how to convert String in JSON format into the List of strings? Any advice would be appreciated!
tagged with: jsf-2
score: 0
possible better answer: http://stackoverflow.com/a/23085187
answer count: 2
has comment: http://stackoverflow.com/comment/35281704
accepted answer: http://stackoverflow.com/a/23084884
linked to: http://stackoverflow.com/q/8724866
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/35281039
has answer: http://stackoverflow.com/a/23084884
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23085187
tagged with: jsf
has title: Convert String in JSON format into CSV / List of Strings

http://stackoverflow.com/a/22985966
answers question: http://stackoverflow.com/q/22985468
downvote count: 1
accepted answer of: http://stackoverflow.com/q/22985468
type: AcceptedAnswer
score: 1
has comment: http://stackoverflow.com/comment/35148245
has body: try put the attributes process and partialSubmit in your ajax call with the values you need process like this: &lt;f:ajax event="change" execute="@this" render="dsTransformationRule dsCorrelationRule" process="@this, collectorType" partialSubmit="true" listener="#{activityDataSource.handleCollectorTypeChange}" /&gt; In the process atrribute you can put all ids you need to process with the updated values (like you see in the screen.
upvote count: 2
type: Answer

http://stackoverflow.com/a/34655130
type: Answer
upvote count: 4
downvote count: 0
has body: Follow the steps below if you are using eclipse: Right click on your java project and select Build Path -> Click on Configure Build Path... In project properties window: Click/select Java Compiler at the left panel At the right panel: change the Compiler compliance level from 1.4 to 1.7 or higher Lastly Click on Apply and OK
score: 4
answers question: http://stackoverflow.com/q/23102350

http://stackoverflow.com/comment/35083305
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22968539
has text: maybe the server had not warmed up for some reasons. This may happens. There are some differences between local and production server. Check the logs and especially warm up requests. Then check if you have your instances alive. Maybe you have exceeded a free version limits. BTW The latest version of Jersey is 2.7. But to be safe please use 2.5. The newest one had some issues with cashing and without fixing may not work properly or not work at all :P
score: 0

http://stackoverflow.com/comment/35341547
type: Comment
has text: I ended up using your second solution and it works exactly as I wanted. Thanks a lot man!
comment on: http://stackoverflow.com/a/23117821
type: AnswerComment
score: 0

http://stackoverflow.com/q/23119677
has comment: http://stackoverflow.com/comment/35344679
tagged with: java
has title: Testing test = new Testing(score);Java - Printerwriter
has comment: http://stackoverflow.com/comment/35344576
has answer: http://stackoverflow.com/a/23119796
has comment: http://stackoverflow.com/comment/35344369
type: AnsweredQuestion
upvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/35344493
accepted answer: http://stackoverflow.com/a/23119796
score: -2
has comment: http://stackoverflow.com/comment/35344683
downvote count: 2
tagged with: printwriter
has body: I'm doing a snake game, and I want after the game is over, the score is saved in a file I did this, but there's error in the two lines that sends the value to the Testing Class private boolean isGameOver(int headLocX, int headLocY) { for (int i = SNAKE_LENGTH_DEFAULT; i &lt; totalBodyPart - 2; i++) { Point partLoc = snakeBodyPart[i].getLocation(); if (partLoc.equals(new Point(headLocX, headLocY))) { Testing test = new Testing(score); return true; } } import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; public class Testing { public Testing(int score) { File file = new File("C:\\Users\\Eng. Mohammed\\Desktop\\Snake 1.0.1\\Snake\\Score.Txt"); PrintWriter printWriter = null; try { printWriter = new PrintWriter(file); printWriter.println(score); } catch (FileNotFoundException e) { e.printStackTrace(); } finally { if ( printWriter != null ) { printWriter.close(); } } } }
answer count: 1

http://stackoverflow.com/comment/35203575
comment on: http://stackoverflow.com/a/23041374
has text: oh wait something come up :o, i was packing before adding board
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35076036
type: Comment
score: 0
type: AnswerComment
has text: no i am not using a card layout....
comment on: http://stackoverflow.com/a/22970831

http://stackoverflow.com/comment/35204677
type: AnswerComment
comment on: http://stackoverflow.com/a/23042329
score: 0
type: Comment
has text: Hi ZouZou thanks I just tried it though and it still does not seem to work. Still all cells in the array show as null.

http://stackoverflow.com/comment/35329178
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23111361
has text: Thank you for your answer. I have read about ssl but implementing an ssl certificate seems complicated to me. I also use a shared server which might be an issue.
score: 0

http://stackoverflow.com/q/23078832
score: 0
answer count: 2
tagged with: mergesort
tagged with: canonical-form
has answer: http://stackoverflow.com/a/23079226
type: AnsweredQuestion
has body: I am stuck at making the canonical form of a word(canonical form of a word contains the same letters as the original word, yet in sorted order. eg. canonical form of "computer" is "cemoprtu" (consider their alphabetical order), that of "program" is "agmoprr". ) I use mergeSort to sort the letters of a word, using the following code. Yet it just give me the original word instead of the canonical form. can anyone tell me what's wrong with my code? public static String canonicalForm(String word) { char[] string = new char[word.length()]; for (int i = 0; i &lt; word.length(); i ++) { string[i] = word.charAt(i); } mergeSort(string); String result = ""; for (char ch: string) { result += ch; } System.out.println(result); } public static void mergeSort(char[] string) { if (string.length &gt; 1) { char[] left = Arrays.copyOfRange(string, 0, string.length/2); char[] right = Arrays.copyOfRange(string, string.length/2, string.length); mergeSort(left); mergeSort(right); merge(string, left, right); } } public static void merge(char[] string, char[] left, char[] right) { int i1 = 0; int i2 = 0; for (int i = 0; i &lt; string.length; i ++) { if (i1 &lt; left.length) { if (left[i1] - right[i2] &lt;= 0) { string[i] = left[i1]; i1 ++; } } else if (i2 &gt;= right.length) { string[i] = left[i1]; i1 ++; } else { string[i] = right[i2]; i2 ++; } } } }
tagged with: java
has answer: http://stackoverflow.com/a/23079348
type: Question
possible better answer: http://stackoverflow.com/a/23079348
has title: finding canonical form of a word (related to mergeSort, java)
accepted answer: http://stackoverflow.com/a/23079226

http://stackoverflow.com/comment/35284231
has text: Because this String have the text "Ã�vila" (it is recived from database from MyBatis) and I need "Ávila".
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23082522

http://stackoverflow.com/comment/35309477
comment on: http://stackoverflow.com/a/23100227
has text: So there's absolutely no way to make the compiler recognize another class the way is recognizes the Boolean class? There's no way to make this "unboxing conversion" take place with my own custom Object class?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35096559
score: 0
has text: @Kayaman 1.2.17 which is the latest, [FileAppender has been deprecated and then removed](http://logging.apache.org/log4j/1.2/apidocs/index.html?utm_source=twitterfeed&utm_medium=twitter)
type: QuestionComment
comment on: http://stackoverflow.com/q/22982552
type: Comment

http://stackoverflow.com/q/23040947
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35202843
has comment: http://stackoverflow.com/comment/35202769
tagged with: maven
has comment: http://stackoverflow.com/comment/35202458
has title: Archive for rquired library cannot be read or is not a valid ZIP file
tagged with: java
tagged with: eclipse
tagged with: m2eclipse
type: Question
has comment: http://stackoverflow.com/comment/35202786
has comment: http://stackoverflow.com/comment/35202709
has comment: http://stackoverflow.com/comment/35202538
linked to: http://stackoverflow.com/q/20091177
score: 0
has body: I changed a simple maven project to a maven dynamic web project adding this line to my pom.xml: ... war .... I updated my project using maven -> update project The m2e plugin now rewrote the project meta-files (.project and .classpath, as well as files in the .settings folder). After it was done i got an error in my build path: Archive for required library: '~/m2/repository/com/orientechnologies/orient-commons/1.6.5/orient- commons-1.6.5.pom' in project 'RelationExtraction' cannot be read or is not a valid ZIP The maven dependency: com.orientechnologies orientdb-graphdb 1.6.5 Also i cant run my main anymore: Error: main class myPackage.main.Main could not be found or loaded I tried the following: I deleted all folders in my ~/m2/ folder and updated my project again I restarted eclipse I closed and reopened my project I restarted my computer Inside the folder ~/m2/repository/com/orientechnologies/orient-commons/1.6.5/ are the following files: _maven.repositories orient-commons-1.6.5.jar orient-commons-1.6.5.jar.sha1 orient-commons-1.6.5.pom orient-commons-1.6.5.pom.sha1 I can see in my Maven Dependencies in my project that maven is trying to load the pom and not the jar: When i delete ... war .... Maven loads the correct jar and not the pom.
answer count: 0
has comment: http://stackoverflow.com/comment/35239888

http://stackoverflow.com/comment/35174062
score: 0
comment on: http://stackoverflow.com/q/23024618
type: Comment
type: QuestionComment
has text: Is that more reasonable now?

http://stackoverflow.com/comment/35351919
score: 0
type: Comment
type: QuestionComment
has text: Yeah I am sure, and I have no idea what they mean
comment on: http://stackoverflow.com/q/23123949

http://stackoverflow.com/a/23015199
has comment: http://stackoverflow.com/comment/35229724
score: 1
has body: You need: SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); java.util.Date d = sdf.parse("2014-04-11T13:25:58.025+02:00"); XXX works with Java 7 and later. For your second question, why not this simple approach leaving your timezone and Calendar-code out? Many people associate temporal amounts like 10 minutes with reference to global time, not if you might be during a DST-jump in local timezone. if (d.getTime() + 10 * 60 * 1000L &lt; System.currentTimeMillis()) { System.out.println("too old"); } else { System.out.println("ok"); } UPDATE due to comment: d.getTime() yields the unix epoch time in milliseconds corresponding to 2014-04-11T13:25:58.025+02:00 This epoch value does not change if you choose following similar representation with SAME instant: 2014-04-11T13:25:58.025+02:00 2014-04-11T12:25:58.025+01:00 2014-04-11T11:25:58.025Z (zero offset - zulu time) The representation 2014-04-11T15:25:58.025 has no offset and is therefore not comparable. Remember that such representations consist of local time plus offset. So in order to get global time in UTC timezone you have to SUBTRACT offset, not to add offset.
accepted answer of: http://stackoverflow.com/q/23014783
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23014783
type: Answer
upvote count: 1

http://stackoverflow.com/q/23064960
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35268036
tagged with: jboss
answer count: 1
downvote count: 0
tagged with: file-upload
favorite count: 0
tagged with: richfaces
has comment: http://stackoverflow.com/comment/35246313
has body: I want to attach a file of 250 MB by but at the time of doing the process of attaching the following error appears 10:25:02,458 ERROR Faces Servlet Servlet.service() para servlet Faces Servlet lanzó excepción org.ajax4jsf.exception.FileUploadException: IO Error parsing multipart request at org.ajax4jsf.request.MultipartRequest.getParam(MultipartRequest.java:556) at org.ajax4jsf.request.MultipartRequest.getParameter(MultipartRequest.java:616) at com.sun.faces.context.RequestParameterMap.get(ExternalContextImpl.java:1152) at com.sun.faces.context.RequestParameterMap.get(ExternalContextImpl.java:1140) at java.util.Collections$UnmodifiableMap.get(Collections.java:1282) at org.ajax4jsf.context.AjaxContextImpl.decode(AjaxContextImpl.java:139) at org.ajax4jsf.context.AjaxContext.getCurrentInstance(AjaxContext.java:210) at org.ajax4jsf.application.AjaxViewHandler.createView(AjaxViewHandler.java:85) at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:194) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:367) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.do…
has title: that the following error message "java.io.IOException: Header section is too big" with rich:fileupload
has comment: http://stackoverflow.com/comment/35247506
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23087196

http://stackoverflow.com/a/23017338
upvote count: 1
has body: You had a duplicate number++ which was executed twice when both conditions were true. That overjumps some values: now corrected: int j = 1; int number = 100; while (number &lt; 1001) { if (number % 6 == 0 || number % 5 == 0) { System.out.print(number + ", "); j++; } if (j % 10 == 0 &amp;&amp; j != 0) { System.out.println(); j++; } number++; }
downvote count: 0
has comment: http://stackoverflow.com/comment/35160127
answers question: http://stackoverflow.com/q/23017206
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35243230

http://stackoverflow.com/comment/35334547
has text: @TheodorosChatzigiannakis http://en.wikipedia.org/wiki/Type_safety#Type_safety_issues_in_specific_languages doesn't agree with you
score: 1
comment on: http://stackoverflow.com/q/23114321
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35133175
comment on: http://stackoverflow.com/a/23002093
score: 0
type: AnswerComment
type: Comment
has text: Yup it is neccessary, otherwise you wont see anything in your listview.

http://stackoverflow.com/comment/35272617
type: AnswerComment
comment on: http://stackoverflow.com/a/23078601
score: 0
type: Comment
has text: hey its showing a warning: Undefined attribute name "user"

http://stackoverflow.com/q/23014760
type: Question
answer count: 1
has body: I have an application that uses bugsense. I'm getting reports of nullpointerexception crashes from bugsense in the onpostexecute method of an asynctask. The strange thing is that the report says that the nullpointer exception happens on com.XXXXXX.XXXXX.projectname.InitRequest.onPostExecute(:1) . And unfortunatelly I cannot reproduce the error. java.lang.NullPointerException at com.XXXX.XXXX.InitRequest.onPostExecute(:1) at android.os.AsyncTask.finish(AsyncTask.java:417) at android.os.AsyncTask.access$300(AsyncTask.java:127) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3687) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) at dalvik.system.NativeStart.main(NativeStart.java) and here is the code for the asynctask class InitRequest extends AsyncTask&lt;Void, Void, Pair&lt;HashMap&lt;String,Object&gt;,Exception&gt;&gt;{ private AuthToken authToken; private int amount; private InitCallback pic; private Mode mode; public boolean st = false; public InitRequest(AuthToken authToken, int amount,InitCallback pic, Mode mode){ this.authToken = authToken; this.amount = amount; this.pic = pic; this.mode = mode; } @Override protected void onPreExecute(){ super.onPreExecute(); this.st = true; } @Override protected Pair&lt;HashMap&lt;String,Object&gt;,Exception&gt; doInBackground(Void... params){ try{ Pair&lt;Exception,String&gt; inputStreamOrException = null; if (this.mode.equals(DEVELOP)){ inputStreamOrException = Utilities.getCorrectInputStream( Utilities.buildURL(XXXX)); }else { inputStreamOrException = Utilities.getCorrectInputStream( Utilities.buildURL("zzzzz)); } if (inputStreamOrException.second …
score: 0
tagged with: nullpointerexception
tagged with: android
has answer: http://stackoverflow.com/a/23015115
has comment: http://stackoverflow.com/comment/35155156
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/35154929
type: UnansweredQuestion
tagged with: java
has title: NullPointerException in AsyncTask onPostExecute on line 1

http://stackoverflow.com/comment/35311274
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23101319
type: QuestionComment
has text: @sankrish Yeah am wrapping everything inside form

http://stackoverflow.com/q/23088855
has comment: http://stackoverflow.com/comment/57493168
has comment: http://stackoverflow.com/comment/35290077
has comment: http://stackoverflow.com/comment/35289665
tagged with: jackson
has comment: http://stackoverflow.com/comment/35289313
has comment: http://stackoverflow.com/comment/35295418
upvote count: 3
answer count: 2
has title: Parsing JSON nested object as String
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23090876
has comment: http://stackoverflow.com/comment/35289336
has answer: http://stackoverflow.com/a/23088956
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35289526
linked to: http://stackoverflow.com/q/4783421
score: 2
has body: I have JSON object and I don't want to parse some of nested objects. Instead I want them as String (I have my reasons). Is there an easy way to do it? I've tried to implement custom Deserializer but I found it complicated in different ways (I don't want to concatenate tokens I just need whole object. It also doesn't consider ':' as token so it need special handling) or maybe I'm missing smth. Also putting quotes in json is not an option. I need that json the way it is. JSON example: { "lastName":"Bitman", "jsonObjectIDontWantToParse":{ "somefield":1234 } } Java object I want to parse json to. public class Jack { public String lastName; public String jsonObjectIDontWantToParse; @Override public String toString() { return "lastName=" + lastName + ", jsonObjectIDontWantToParse=" + jsonObjectIDontWantToParse; } } Here's my main class public static void main(String[] args) throws IOException { ObjectMapper mapper = new ObjectMapper(); final String jackString = "{\"lastName\":\"Bitman\",\"jsonObjectIDontWantToParse\":{\"somefield\":1234}}"; Jack user = mapper.readValue(jackString, Jack.class); System.out.println(user); } I expect output to be like this lastName=Bitman, jsonObjectIDontWantToParse={"somefield":1234} Updated: So basically this is example what I'm looking for (except There are no such method). I want to skip any parsing for that node... public class LeaveAsStringDeserializer extends JsonDeserializer&lt;String&gt; { @Override public String deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { return jp.getWholeObject().toString(); } }
tagged with: java
has comment: http://stackoverflow.com/comment/35290072
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/35289214
type: Question

http://stackoverflow.com/a/23113031
type: Answer
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/35331797
answers question: http://stackoverflow.com/q/23112875
has body: From what I understand, the JFrame contains a JPanel, when you add your custom Panel to the JFrame using getContentPane().add(pan), you're actually adding your custom panel to the JFrame's JPanel. I'm guessing you'll have to call frame.getContentPane().getComponents(); to iterate over the components contained in the JFrame's panel.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23112875

http://stackoverflow.com/a/23084580
has comment: http://stackoverflow.com/comment/54175209
has comment: http://stackoverflow.com/comment/35328062
has comment: http://stackoverflow.com/comment/35316866
score: 0
answers question: http://stackoverflow.com/q/23077771
has comment: http://stackoverflow.com/comment/35322495
has comment: http://stackoverflow.com/comment/35322077
has comment: http://stackoverflow.com/comment/35310764
has body: Struts2 is designed to behave differently according to a locale requested by the client. i18n interceptor is a member of the default interceptor stack. So, it is responsible for setting requested locale to the action context, overriding the default settings. It also stores that locale to the session for further retrieving it if the locale is not requested by the request parameter. The action context's locale is used by the default type converter, so setting a locale to the action context should probably override the default locale setting which could be configured via struts.locale and i18n interceptor doesn't change this. If so, no other actions required, just put your date format to the global resource properties according to that locale. You can also use action properties that could be used with i18n requested locale that has different format due to the order of processing localization resources. If you don't need that possibility of switching a locale by the user you should remove i18n interceptor from the stack. How to format the dates and numbers using action context's locale: Formatting Dates and Numbers.
type: Answer

http://stackoverflow.com/comment/35084352
type: QuestionComment
has text: start with string.split
score: 2
comment on: http://stackoverflow.com/q/22975449
type: Comment

http://stackoverflow.com/comment/35212402
comment on: http://stackoverflow.com/q/23046264
type: Comment
has text: If same button is performing more than one functionaries then you can check it by its text. Why you cant use `setText()`?
score: 0
type: QuestionComment

http://stackoverflow.com/q/22995095
has comment: http://stackoverflow.com/comment/35121059
score: 0
has comment: http://stackoverflow.com/comment/35119566
has comment: http://stackoverflow.com/comment/35119490
tagged with: spinner
tagged with: view
answer count: 0
has comment: http://stackoverflow.com/comment/35132282
type: UnansweredQuestion
tagged with: android
has title: How can I make a Spinner only by java?
tagged with: java
type: Question
has body: I tried with the following code, it runs but i don't see any thing... Spinner spv = new Spinner(context); String[] s = {"Normal","Italic","Bold"}; ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt; (context, 0, s); spv.setAdapter(adapter); How could i do it?
has comment: http://stackoverflow.com/comment/35119186
tagged with: android-spinner

http://stackoverflow.com/a/23067848
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23067508
has comment: http://stackoverflow.com/comment/35290643
type: Answer
has comment: http://stackoverflow.com/comment/35258606
upvote count: 1
has body: These are the HTML escape codes. Additionally, HTML features arbitrary escaping with codes of the format &amp;#x3A; and equivalently &amp;#58; A simple string-replace is not going to be efficient with so many strings to replace. I suggest you split the string by entity matches, such as this: String[] parts = str.split("&amp;([A-Za-z]+|[0-9]+|x[A-Fa-f0-9]+);"); if(parts.length &lt;= 1) return str; //No matched entities. Then you can re-build the string with the replaced parts inserted. StringBuilder result = new StringBuilder(str.length()); result.append(parts[0]); //First part always exists. int pos = parts[0].length + 1; //Skip past the first entity and the ampersand. for(int i = 1;i &lt; parts.length;i++) { String entityName = str.substring(pos,str.indexOf(';',pos)); if(entityName.matches("x[A-Fa-f0-9]+") &amp;&amp; entityName.length() &lt;= 5) { result.append((char)Integer.decode("0" + entityName)); } else if(entityName.matches("[0-9]+")) { result.append((char)Integer.decode(entityName)); } else { switch(entityName) { case "euml": result.append('ë'); break; case "auml": result.append('ä'); break; ... default: result.append("&amp;" + entityName + ";"); //Unknown entity. Give the original string. } } result.append(parts[i]); //Append the text after the entity. pos += entityName.length() + parts[i].length() + 2; //Skip past the entity name, the semicolon and the following part. } return result.toString(); Rather than copy-pasting this code, type it in your own project by hand. This gives you the opportunity to look at how the code actually works. I didn't run this code myself, so I can't guarantee it being correct. It can also be made slightly more efficient by pre-compiling the regular expressions.
answers question: http://stackoverflow.com/q/23067508

http://stackoverflow.com/comment/35294669
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23091528
type: QuestionComment
has text: i just ran your code and i get. `0.390000000000` maybe you forgot to save?

http://stackoverflow.com/a/23094200
score: 7
accepted answer of: http://stackoverflow.com/q/23093808
has body: For sake of completeness (even though the question has changed completely) boolean b = matcher.find(); This will match if the regex is contained somewhere in the matching string. If you use matcher.matches you will get the expected behaviour, where it must match the ENTIRE string. Alternatively you can skip the compile step(not recommended if this regex is going to be used several times.) altogether and just write: String regex = "\\d{5}"; String test = "123456"; if(test.matches(regex)){ ... }; Which is essentially what you had in the original question.
upvote count: 7
has comment: http://stackoverflow.com/comment/35299660
has comment: http://stackoverflow.com/comment/35299608
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35299757
answers question: http://stackoverflow.com/q/23093808

http://stackoverflow.com/a/23029232
upvote count: 2
has body: On the first request your container will normally tell the client to set a Cookie via a header like this: Set-Cookie: JSESSIONID=03f52fcdccdfd070be0ada8dw14b; If the client wants to join this session he has to pass this Cookie with every request back to the server. Your Browser does this automatically for you. Other clients may not. Without this Cookie-Information every call from your Android App is new to the server. Simple Example of using Cookie with java.net.URLConnection URLConnection connection = new URL(loginUrl).openConnection(); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); connection.setDoOutput(true); Map&lt;String, String&gt; formParams = new HashMap&lt;String, String&gt;(); formParams.put("username", "John"); // add your login Params StringBuilder encodedParams = new StringBuilder(); for (Map.Entry&lt;String, String&gt; param : formParams.entrySet()) { encodedParams .append(URLEncoder.encode(param.getKey(), "UTF-8")) .append('=') .append(URLEncoder.encode(param.getValue(), "UTF-8")); } OutputStream outputStream = connection.getOutputStream(); outputStream.write(encodedParams.toString().getBytes("UTF-8")); List&lt;String&gt; cookies = connection.getHeaderFields().get("Set-Cookie"); String sessionCookie = null; for (String cookie : cookies) { if (cookie.startsWith("JSESSIONID")) { sessionCookie = cookie.substring(0, cookie.indexOf(';')); // drop path, expires etc. } } // reuse cookie for next page connection = new URL(nextUrl).openConnection(); connection.addRequestProperty("Cookie", sessionCookie); connection.getInputStream(); Unrelated: Restful applications are normally stateless, means not based on a session-state.
has comment: http://stackoverflow.com/comment/35186138
accepted answer of: http://stackoverflow.com/q/23028899
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23028899
type: Answer

http://stackoverflow.com/comment/35361424
has text: "name" is a key in a map
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23129387

http://stackoverflow.com/comment/35117874
type: QuestionComment
comment on: http://stackoverflow.com/q/22994140
has text: updated some more information.
score: 0
type: Comment

http://stackoverflow.com/q/22996691
tagged with: java
tagged with: twitter
has answer: http://stackoverflow.com/a/22997387
type: Question
has body: I am developing a Mule Application that takes json data from some xively feeds and transform them with a Java transformer I made. Then the results are mailed to my e-mail. The content of the messages are the returned String in the toString() method of my custom transformer's returnClass. I am not sure how this all is put together, but it works. However, I want to twit part of the mailed message too. I can't do it so far because the message is loo long. What component could I use to take the Strings transformed and returned for each feed, manipulate them and then return them again so they can be twitted? I use Mule Studio. This is my xml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;mule&gt; &lt;http:polling-connector name="HTTP_Polling_90" cookieSpec="netscape" validateConnections="true" pollingFrequency="90000" sendBufferSize="0" receiveBufferSize="0" receiveBacklog="0" clientSoTimeout="10000" serverSoTimeout="10000" socketSoLinger="0" proxyHostname="api.xively.com" proxyUsername="****" proxyPassword="****" doc:name="HTTP Polling"/&gt; &lt;spring:beans&gt; &lt;spring:bean id="Bean" name="Bean" class="events.Transformer"/&gt; &lt;/spring:beans&gt; &lt;twitter:config name="Twitter" accessKey="****" accessSecret="****" consumerKey="****" consumerSecret="****" doc:name="Twitter"&gt; &lt;twitter:connection-pooling-profile initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW"/&gt; &lt;/twitter:config&gt; &lt;flow name="flow1" doc:name="flow1"&gt; &lt;composite-source doc:name="Composite Source"&gt; &lt;http:inbound-endpoint exchange-pattern="one-way" host="api.xively.com" port="8081" path="v2/feeds/****.json" connector-ref="HTTP_Polling_90" user="****" password="****" contentType="application/json" doc:name="Weather Station (Barcelona)"/&gt; &lt;http:inbound-endpoint exchange-pattern="one-way" host="api.xively.com" port="8081" path="v2/feeds/****.json" connector-ref="HTTP_Polling_90" user="****" password="****" contentType="application/json" doc…
tagged with: mule
tagged with: mule-studio
upvote count: 1
has title: Manipulate a Mule String to be able to twit it
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22997387
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/q/23041526
type: UnansweredQuestion
answer count: 0
linked to: http://stackoverflow.com/q/11913013
tagged with: mybatis
type: Question
has body: I have an user model like this: class User { private int id; private String name; private String password; } Now I am trying to get some users by user ids; The result I want is a hashMap like this: key id 10001 value user1 key id 10002 value user2 and then I can select the user by id and set to the topic. topic.setUser(resultMap.get(id)); my config file: &lt;select id="getUsers" &gt; select id, name, password from user where id in &lt;foreach item="id" index="index" collection="list" open="(" separator="," close=")"&gt; #{id} &lt;/foreach&gt; &lt;/select&gt; Now the question is How to return a map and the key is id and value is the user object thanks in advance :)
has title: mybatis select users by user ids
score: 0
has comment: http://stackoverflow.com/comment/35263309
has comment: http://stackoverflow.com/comment/35207262
tagged with: java

http://stackoverflow.com/comment/35330508
has text: Make sure to add your programming language as a tag. Java, right?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23112143

http://stackoverflow.com/q/23121718
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35347929
has comment: http://stackoverflow.com/comment/35348255
has answer: http://stackoverflow.com/a/23121741
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23121741
has title: How to add all elements of an ArrayList into another ArrayList in java
tagged with: arraylist
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/35347924
answer count: 1
has body: I'm trying to add all the elements of an ArrayList into another ArrayList, I've tried using if (!listTwo.isEmpty()){ finalList.addAll(listTwo); } finalList.addAll(listTwo); However, this keeps sending me an NullPointerException error. Both are ArryList, and listTwo does have elements inside of it. Any idea why it's sending this exception? Thanks a lot
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/35347916
tagged with: addition
type: AnsweredQuestion

http://stackoverflow.com/q/23019214
accepted answer: http://stackoverflow.com/a/23021872
tagged with: maven
upvote count: 4
has comment: http://stackoverflow.com/comment/35163656
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35163582
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35163589
type: Question
has body: Having this dependencies section in my pom.xml: junit junit 3.8.1 test org.apache.cxf cxf-rt-frontend-jaxws 2.7.1 jar runtime org.apache.cxf cxf-rt-transports-http 2.7.1 jar runtime org.springframework spring-web 3.0.7.RELEASE mysql mysql-connector-java 5.1.26 org.hibernate hibernate-core 4.2.6.Final org.apache.cxf cxf-api 2.7.1 org.apache.geronimo.specs geronimo-javamail_1.4_spec org.apache.cxf cxf-rt-transports-http 2.7.1 jar javax.servlet servlet-api 2.5 javax.mail mail 1.4.1 javax.activation activation 1.1.1 I expected the geronimo-javamail_1.4_spec package to be excluded from the build and, indeed, when I run mvn dependency:tree, it is no longer listed there. However, when running the resulting jar, the JarClassLoader still complains about javax/mail classes being hidden by the geronimo ones... Sure enough, when I examine the jar via 7-zip, I see that geronimo-javamail_1.4_spec-1.7.1.jar is still there (comes as part of the org.apache.cxf:cxf-api:jar:2.7.1:compile package). How do I fully exclude a package? i.e. not only remove it from the dependency tree, but also not include it at all in the resulting jar? Adding the onejar relevant xml per the comment below: com.jolira onejar-maven-plugin 1.4.4 com.corp.dept.proj.myclient 0.97 true onejar one-jar Adding the output of the mvn dependency after the scope & debug options were specified per the answer below: C:\Users\withheld\workspace\myclient>mvn dependency:tree -Dscope=runtime -Ddebug=true [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'dependency'. [INFO] org.apache.maven.plugins: checking for updates from onejar-maven-plugin.googlecode.com [INFO] org.codehaus.mojo: checking for updates from onejar-maven-plugin.googlecode.com [INFO] ------------------------------------------------------------------------ [INFO] Building myclient [INFO] task-segment: [dependency:tree] [INFO] ------------------------------------------------------------------------ Downloading: http://repo1.m…
has comment: http://stackoverflow.com/comment/35163516
score: 4
tagged with: onejar
has comment: http://stackoverflow.com/comment/35163719
answer count: 1
tagged with: pom.xml
favorite count: 0
has comment: http://stackoverflow.com/comment/35164517
has title: How to really & fully exclude a package from a jar?
has answer: http://stackoverflow.com/a/23021872

http://stackoverflow.com/a/23078265
has body: You have to create a hash function that returns the same value (hashCode) for both "stack" and "stacks". BTW this is not a good idea. hashCode generation should not be based on what you want to be in a chain (i.e, linked list when collision occurs in the hash table). It should be such that it returns a unique value for each object being added and reduces collision.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35271579
has comment: http://stackoverflow.com/comment/35270811
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35270730
answers question: http://stackoverflow.com/q/23078251
accepted answer of: http://stackoverflow.com/q/23078251

http://stackoverflow.com/a/23018190
downvote count: 0
answers question: http://stackoverflow.com/q/23018136
has body: I don't know what are you trying to achieve but if it is about to control user input consider using a DocumentFilter instead. If you still want to use a KeyListener just cast e.getSource() to JTextField, to ensure to don't have a ClassCastException you should use instanceof operator like example below. if(evt.getSource() instanceof JTextField){ JTextField textfield = (JTextField) e.getSource(); textfield.setText(".."); e.consume(); } Consider extends KeyAdapter rather than implementing KeyListener.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/23758189
score: 0
has body: If the connection profile store is set as a relative path, you have to provide a resourcePath to the birt engine config, before starting up the Platform. For example: engineConfig.setResourcePath("/myResourcePath"); The connection store is searched relatively to this resourcePath.
answers question: http://stackoverflow.com/q/23081082
type: Answer

http://stackoverflow.com/q/23029059
accepted answer: http://stackoverflow.com/a/23029416
type: Question
has body: Why is this Code not working ? This code should extend the Countdowntimer to 10 sec (everytime when point is 20 , 40 , 60) etc.But when I start it and my score is by 20 it shows in a TextView a right value of time.But then it is gone in 1 sec and the Countdowntimer got the old value and continue.Someone a idea ? int bonus_time = 1 , sec = 10000 , point == 0; points_timer =new CountDownTimer(sec,1000) { @Override public void onTick(long millisUntilFinished) { if ( point == (bonus_time * 20)) { ++bonus_time; millisUntilFinished += 10000; sec += 10000; } ++point; } @Override public void onFinish() { bonus_time = 1; } };
has title: Extend time of an Countdowntimer
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23029416
tagged with: countdowntimer
tagged with: android
has answer: http://stackoverflow.com/a/23029117
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23029110
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23029110
upvote count: 1

http://stackoverflow.com/comment/35321471
type: QuestionComment
has text: Indeed, it solves the problem, so why not.
comment on: http://stackoverflow.com/q/23107029
score: 0
type: Comment

http://stackoverflow.com/q/23074527
has comment: http://stackoverflow.com/comment/35264269
score: -1
answer count: 3
upvote count: 0
accepted answer: http://stackoverflow.com/a/23074677
favorite count: 0
tagged with: nullpointerexception
tagged with: android
has title: Edittext field outside scope of alert dialog? Nullpointer Exception
tagged with: android-alertdialog
possible better answer: http://stackoverflow.com/a/23074605
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23074607
has answer: http://stackoverflow.com/a/23074605
has answer: http://stackoverflow.com/a/23074677
downvote count: 1
type: Question
has body: I created an AlertDialog such that when you press a Button, the Dialog pops up and a layout appears with EditTexts. However, I created the layout in the actual code rather than in the xmlfile. For some reason, when the AlertDialog pops up, it's not able to find the EditText field and gives me a NullPointerException. //private Lecture lecture; private LectureManager lectureManager; public void addWork(View view) { LinearLayout layout = new LinearLayout(this); EditText weight = new EditText(this); EditText mark = new EditText(this); mark.setInputType(InputType.TYPE_CLASS_NUMBER); weight.setInputType(InputType.TYPE_CLASS_NUMBER); weight.setId(99); mark.setId(100); layout.addView(mark); layout.addView(weight); AlertDialog.Builder addwork = new AlertDialog.Builder(this); addwork.setView(layout); addwork.setPositiveButton("Add", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { EditText eweight = (EditText) findViewById(99); EditText emark = (EditText) findViewById(100); String coursename = ecoursename.getText().toString(); And for some reason, I'm getting a NullPointerException at the "EditText weight" line. I believe that maybe it's not finding anything with ID 99 and that the EditText might be out of scope? Thanks in advance!
tagged with: java

http://stackoverflow.com/q/23040550
has answer: http://stackoverflow.com/a/23053992
accepted answer: http://stackoverflow.com/a/23053992
tagged with: java
type: Question
has title: how to access List of lists concurrently
has comment: http://stackoverflow.com/comment/35202031
has body: I have a List of Lists , what i want to do is create threads which reads objects(list) and removes it from the "sharedList" , how can make the list threadsafe ? am using synchronizedList , but what if a thread removed and object while another thread was reading another object ? as .remove shifts the objects to the left .... filler class public class DataFetcher implements Runnable { Session session = null; Criteria criteria = null; private List&lt;Parts&gt; partList = null; public DataFetcher() { } @Override public void run() { // while(true) List newPartList =getNParts(DBIndexGuard.getAllowedListSize()); SharedList.addPartList(newPartList); } public List&lt;Parts&gt; getNParts(int listSize) { try { session = HibernateUtils.getSessionFactory().openSession(); criteria = .... // *********** SYNCHRONIZATION OCCURS HERE ********************// criteria.setFirstResult(DBIndexGuard.getNextIndex()); criteria.setMaxResults(listSize); partList = criteria.list(); } catch (Exception e) { e.printStackTrace(); } finally { session.close(); } return partList; } } sharedList class public class SharedList { private static final List&lt;List&lt;Parts&gt;&gt; sharedList = Collections.synchronizedList(new ArrayList()); public List&lt;List&lt;Parts&gt;&gt; SharedList() { return sharedList; } static synchronized void addPartList(List partList) { sharedList.add(partList); } static synchronized List getPartList(int index) { return sharedList.get(index); } static synchronized void removePartList(int index) { sharedList.remove(index); } } the worker thread public class Finder implements Runnable { private List&lt;Parts&gt; partList = null; public Finder () { } @Override public void run() { operateOnList(partList); } public void operateOnList(List&lt;Parts&gt; partList) { for (Parts part : partList) { } } } I will be creating multi finders to work on the sharedList
score: -1
tagged with: arraylist
downvote count: 1
has comment: http://stackoverflow.com/comment/35201835
answer count: 1
has comment: http://stackoverflow.com/comment/35201943
favorite count: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35202216
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/35201993

http://stackoverflow.com/comment/35248798
type: Comment
comment on: http://stackoverflow.com/a/23020026
score: 0
type: AnswerComment
has text: You sir, are a gentlemen, and a scholar.

http://stackoverflow.com/comment/35256868
score: 0
type: Comment
type: AnswerComment
has text: @N0M3 ;) now you know and will know in future ;) good luck in programming - sometimes it's very funny and you're welcome.
comment on: http://stackoverflow.com/a/23070482

spring-data
tags question: http://stackoverflow.com/q/23017419
tags question: http://stackoverflow.com/q/23056091
tags question: http://stackoverflow.com/q/23024428
tags question: http://stackoverflow.com/q/23094415
tags question: http://stackoverflow.com/q/22971966
tags question: http://stackoverflow.com/q/23111863
tags question: http://stackoverflow.com/q/23081178
tags question: http://stackoverflow.com/q/23009458
tags question: http://stackoverflow.com/q/23020497
type: Tag
tag name: spring-data
tags question: http://stackoverflow.com/q/23055277

http://stackoverflow.com/q/22986391
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/22986817
has comment: http://stackoverflow.com/comment/35103245
favorite count: 0
has comment: http://stackoverflow.com/comment/35103134
has body: I am creating a navigations app to the application settings. For that I am creating the following code, but, as I mention above in Title, I am getting a Syntax Error. Kindly Guide me through this problem. here is my MainActivity.Java import android.net.Uri; import android.os.Bundle; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.pm.PackageManager; import android.view.Menu; import android.view.View; public class MainActivity extends Activity { public MainActivity() { } private boolean MyStartActivity(Intent intent) { try { startActivity(intent); } catch (ActivityNotFoundException activitynotfoundexception) { return false; } return true; } protected boolean isAppInstalled(String s) { PackageManager packagemanager = getPackageManager(); try { packagemanager.getPackageInfo(s, 128); } catch (android.content.pm.PackageManager.NameNotFoundException namenotfoundexception) { return false; } return true; } protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(0x7f030000); if (getIntent().getIntExtra("reload", 0) == 1) { if (isAppInstalled("com.sample.test")) { Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS"); intent.addCategory("android.intent.category.DEFAULT"); intent.setData(Uri.parse("package:com.sample.test")); startActivity(intent); } else { Toast.makeText(getApplicationContext(), "Game Not Instaled", 0).show(); } } ((Button)findViewById(0x7f080000)).setOnClickListener(new android.view.View.OnClickListener() { final MainActivity this$0; public void onClick(View view) { if (isAppInstalled("com.sample.test")) { Intent intent1 = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS"); intent1.addCategory("android.intent.category.DEFAULT"); intent1.setData(Uri.parse("package:com.sample.test")); startActivity(intent1); return; } else { Toast.makeText(getApplicationContext(), "Game Not Instaled", 0).show(); return; } } { this$0 = MainA…
tagged with: constructor
tagged with: android
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35103030
has title: Syntax Error: Constructor call must be the first statement in a constructor
has answer: http://stackoverflow.com/a/22986817
has comment: http://stackoverflow.com/comment/35103208
has comment: http://stackoverflow.com/comment/35103088
has comment: http://stackoverflow.com/comment/35103165
has comment: http://stackoverflow.com/comment/35103332
type: Question
has answer: http://stackoverflow.com/a/22986497
accepted answer: http://stackoverflow.com/a/22986497
has comment: http://stackoverflow.com/comment/35102979
upvote count: 2

http://stackoverflow.com/comment/35366914
comment on: http://stackoverflow.com/a/23043902
score: 0
type: AnswerComment
has text: Although it doesn't answer my question exactly, your answer gives me great pointers on fixing my regex. Thank you for your help! That SO FAQ is invaluable. I didn't know about it until you pointed me to it.
type: Comment

http://stackoverflow.com/a/23055997
accepted answer of: http://stackoverflow.com/q/23051879
score: 16
type: AcceptedAnswer
downvote count: 0
has body: In your example, both the static and the non-static method are applicable for the target type of the filter method. In this case, you can't use a method reference, because the ambiguity can not be resolved. See §15.13.1 Compile-Time Declaration of a Method Reference for details, in particular the following quote and the examples below: If the first search produces a static method, and no non-static method is applicable [..], then the compile-time declaration is the result of the first search. Otherwise, if no static method is applicable [..], and the second search produces a non-static method, then the compile-time declaration is the result of the second search. Otherwise, there is no compile-time declaration. In this case, you can use a lambda expression instead of a method reference: a.stream().filter(item -&gt; A.is(item)); The above rule regarding the search for static and non-static methods is somewhat special, because it doesn't matter, which method is the better fit. Even if the static method would take an Object instead of A, it's still ambiguous. For that reason, I recommend as a general guideline: If there are several methods with the same name in a class (including methods inherited from base classes): All methods should have the same access modifiers, All methods should have the same final and abstract modifiers, And all methods should have the same static modifier
answers question: http://stackoverflow.com/q/23051879
type: Answer
upvote count: 16

http://stackoverflow.com/q/23002599
favorite count: 0
has answer: http://stackoverflow.com/a/23002837
upvote count: 1
accepted answer: http://stackoverflow.com/a/23002837
type: AnsweredQuestion
has body: I have written a program in Ruby that checks a web page every so often, and performs some actions if data is found. I have written this using Watir-Webdriver. I also want this program to run as a "daemon". The problem I had with Watir-Webdriver was that I could not run it without a browser popping up everytime. I actually need to write this in Java? Which is best Java package thats similar in functionality to Watir-Webdriver? Is there any way to implement this in Java - to check a webpage and do specific actions - all in the background? Also, I would like this to be cross-platform. Thank you in advance to help
score: 1
tagged with: java
tagged with: cross-platform
tagged with: webdriver
type: Question
has title: Java Programming: Something like Watir-Webdriver running in background
downvote count: 0
answer count: 1

http://stackoverflow.com/a/23027687
has body: if you call Server.reregisterMBeansAfterReconfigure(MBeanServer), MBeans will be registered in the specified MBeanServer for the following objects: all LoggerContexts available the StatusLogger for each LoggerContext the ContextSelector for each LoggerContext all LoggerConfigs for each LoggerContext all Appenders for each LoggerContext You mention you are only seeing LoggerConfigs and Appenders. Does that mean that you don't see any LoggerContexts, StatusLoggers and ContextSelectors? Also, you mention HierarchyDynamicMBean, but I am not sure what it is you want to achieve. If log4j2 had a HierarchyDynamicMBean, what would you do with it? How would you use it?
has comment: http://stackoverflow.com/comment/35204568
answers question: http://stackoverflow.com/q/22991851
score: 0
type: Answer

http://stackoverflow.com/q/23040392
favorite count: 0
upvote count: 26
tagged with: android
has body: I am making GPS android app (with air for android) and what I want is if GPS is off I want to open GPS settings on device or switch GPS on but I don't know how. I want to do it in AS3 or open android settings in Java. Thanks for help!
score: 25
type: AnsweredQuestion
tagged with: actionscript-3
type: Question
has answer: http://stackoverflow.com/a/23040464
has title: How to open GPS settings an android device?
tagged with: java
possible better answer: http://stackoverflow.com/a/23040464
answer count: 2
has answer: http://stackoverflow.com/a/23040461
accepted answer: http://stackoverflow.com/a/23040461
downvote count: 1

http://stackoverflow.com/comment/35126620
has text: Try this one `String output = number + " is" + (IsPrime(number) ? " " : " not ") + "a prime number: ";`
type: AnswerComment
comment on: http://stackoverflow.com/a/22995334
type: Comment
score: 0

http://stackoverflow.com/q/23001873
score: 1
favorite count: 0
has body: I am new to android programming. I am developing an android app. DashboardGridActivity is a main activity. This activity should show grid view on launching of this app. Following are files from my app: DashboardGridActivity: public class DashboardGridActivity extends Activity { GridView myDashboard; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dashboard_grid); myDashboard = (GridView)findViewById(R.id.dashboard); myDashboard.setAdapter(new DashboardAdapter(this)); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.dashboard_grid, 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); } } class ViewHolder { ImageView myItem; ViewHolder(View v) { myItem = (ImageView) v.findViewById(R.id.imageView1); } } class DashboardItems { int imageID; String itemName; DashboardItems(int imageID, String itemName) { this. imageID=imageID; this.itemName= itemName; } } class DashboardAdapter extends BaseAdapter { ArrayList&lt;DashboardItems&gt; dashboardImages; Context context; DashboardAdapter(Context context) { dashboardImages = new ArrayList&lt;DashboardItems&gt;(); Resources res = context.getResources(); String[] tempDashItems = res.getStringArray(R.array.dashboard_names); int[] dashImages = {R.drawable.apartments, R.drawable.atms, R.drawable.banks, R.drawable.book_stores, R.drawable.car_rentals, R.drawable.furniture_shops, R.drawable.gas_stations, R.drawable.gyms, R.drawable.malls, R.drawable.mobile_shops, R.drawable.pharmacy, R.drawable.pizza_places, R.draw…
accepted answer: http://stackoverflow.com/a/23002073
tagged with: android
type: AnsweredQuestion
has title: Skipped 32 frames! The application may be doing too much work on its main thread and then FATAL EXCEPTION: main
tagged with: android-xml
upvote count: 1
type: Question
tagged with: android-layout
tagged with: java
has answer: http://stackoverflow.com/a/23002073
has comment: http://stackoverflow.com/comment/35131759
tagged with: android-gridview
answer count: 1
downvote count: 0

http://stackoverflow.com/q/23005209
has comment: http://stackoverflow.com/comment/43914837
accepted answer: http://stackoverflow.com/a/23006859
upvote count: 1
has answer: http://stackoverflow.com/a/27751871
has comment: http://stackoverflow.com/comment/35164356
tagged with: java
possible better answer: http://stackoverflow.com/a/27751871
answer count: 3
linked to: http://stackoverflow.com/q/27398350
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23006859
downvote count: 0
has answer: http://stackoverflow.com/a/58083750
favorite count: 0
has title: Implement RTP stream media player on Android device
type: Question
tagged with: android
has body: I have to develop an app that will stream RTP video stream from a server and play it on my android device. I also have to create a rtp server on another android device from which this client app will stream video. But, what i found is that Rtp stream is hard to play directly(without RTSP). How can I implement such a player in android/java. I am aware of Vitamio but i doubt if it can play rtp. Please correct me if i am wrong and i really could use some help.
score: 1

http://stackoverflow.com/comment/35209616
comment on: http://stackoverflow.com/q/23044907
has text: Why not just use `instanceof`?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22985664
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22984851
has body: You can do this using MYSQL syntax. Check this thread: MySQL: Compare date strings? But this is not recommended for at least two reasons: Using Hibernate, you should prefer HQL in order for your app to be database agnostic. Converting Date to String for comparison purposes is unnecessary step(only if your dates are stored as strings in db) Hibernate is able to compare java.util.Date correctly with database specific Date types

http://stackoverflow.com/comment/35318048
comment on: http://stackoverflow.com/q/23105270
score: 0
has text: Could the writing and the reading occur in different threads? If yes, you should add the `volatile` keyword to your field declaration (selectedFilePath).
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23096348
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23096116
has body: You need to create an instance for AsyncTask like this and execute your program on background. new AsyncTask&lt;Void, Integer, Long&gt;(){ @Override protected Long doInBackground(Void... params) { try { // call you method here } catch (Exception ex) { // handle the exception here } return null; } }.execute(); runOnUiThread is used to execute some program in main Thread. When you call runOnUiThread , the action will be executed immediately if we are already in UIThread else will be posted in Queue. You need to use the Activity Context associated with your Fragment to `runOnUiThread'. getActivity().runOnUiThread(new Runnable() { @Override public void run() { // execute your code here } });
accepted answer of: http://stackoverflow.com/q/23096116

http://stackoverflow.com/q/23037959
has body: Reading in a list of strings like Bob,Jim,Greg Bob,Allison,Jamie,Craig Bob,Tim,Allen How would I get an ArrayList with Jim Greg as the first element Allison Jamie Craig as the second element Tim Allen as the third element
has answer: http://stackoverflow.com/a/23037997
has comment: http://stackoverflow.com/comment/35197584
has answer: http://stackoverflow.com/a/23038267
has comment: http://stackoverflow.com/comment/35197561
has comment: http://stackoverflow.com/comment/35197576
tagged with: java
has comment: http://stackoverflow.com/comment/35197587
has title: Extracting an ArrayList of names minus the first name
type: Question
has comment: http://stackoverflow.com/comment/35197570
tagged with: arrays
score: 0
answer count: 4
has answer: http://stackoverflow.com/a/23037990
has comment: http://stackoverflow.com/comment/35197598
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23038006

http://stackoverflow.com/q/23053133
type: UnansweredQuestion
has title: Exception:Missing the manifest.properties
type: Question
tagged with: exception
has comment: http://stackoverflow.com/comment/36152135
answer count: 2
tagged with: opennlp
has answer: http://stackoverflow.com/a/23563435
has comment: http://stackoverflow.com/comment/36156293
has body: I am new to opennlp, I am getting Missing the manifest.properties! exception when i excute the following code,please tell me suggestion to avoid this. public class PrePostProcessing_Peregrine { public Map&lt;String,Set&lt;String&gt;&gt; btntMap; public Map&lt;String, String&gt; fishMap; public SentenceModel sModel; public SentenceDetectorME sentDet; public Map&lt;String,Set&lt;String&gt;&gt; topBottomTermSet; public PrePostProcessing_Peregrine() throws IOException { FileInputStream str=new FileInputStream("/home/rajendraprasad.yk/Desktop/data/en-sent.bin"); System.out.println(str+"===================&gt;"); SentenceModel sModel = new SentenceModel(str); System.out.println("===================model =================&gt;"+sModel); sentDet = new SentenceDetectorME(sModel); System.out.println("===================&gt;sentDet "+sentDet); System.err.println("Sentence Detector Initialized"); Exception is: opennlp.tools.util.InvalidFormatException: Missing the manifest.properties! at opennlp.tools.util.model.BaseModel.validateArtifactMap(BaseModel.java:217) at opennlp.tools.sentdetect.SentenceModel.validateArtifactMap(SentenceModel.java:78) at opennlp.tools.util.model.BaseModel.&lt;init&gt;(BaseModel.java:142) at opennlp.tools.sentdetect.SentenceModel.&lt;init&gt;(SentenceModel.java:73) at com.molcon.Text_Mining.PrePostProcessing_Peregrine.&lt;init&gt;(PrePostProcessing_Peregrine.java:66) at com.molcon.Text_Mining.TextMining.peregrineRun(TextMining.java:207) at com.molcon.Text_Mining.TextMining.process_journals_for_Mining(TextMining.java:108) I made mistake at FileInputStream modelIn = new FileInputStream("/home/rajendraprasad.yk/Desktop/data/en-sent.bin"); now I changed to InputStream modelIn = new FileInputStream("/home/rajendraprasad.yk/Desktop/data/en-sent.bin"); from this changes am not getting any exception but not able to load file from SentenceModel. when i execute this line SentenceModel sModel = new SentenceModel(modelIn); am not getting any response,please help
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36156879
has comment: http://stackoverflow.com/comment/36149043
has answer: http://stackoverflow.com/a/23489574

http://stackoverflow.com/comment/137630172
score: 0
type: Comment
has text: @RüdigerSchulz We have not updated to Spring Security 6 yet. We are just starting to deal with removing Apache Tiles, which keeps us on Java 11 for now. It will be quite sometime before we actually have to deal with that particular problem. I'm a bit surprised that Spring Security 6 doesn't have a way to reload the principal every request.
type: AnswerComment
comment on: http://stackoverflow.com/a/34956579

http://stackoverflow.com/q/23007504
type: Question
tagged with: java
tagged with: hibernate
score: -1
has comment: http://stackoverflow.com/comment/35141569
has answer: http://stackoverflow.com/a/23008039
answer count: 2
upvote count: 0
has title: Hibernate Set or List
favorite count: 0
has answer: http://stackoverflow.com/a/23007824
has body: In Hibernate Entities, in what cases is it the better to use List, as opposed to Set? Example of Set public class Department { private Long departmentId; private Set&lt;Employee&gt; employees; // Getter and Setter methods } Example of List public class Department { private Long departmentId; private List&lt;Employee&gt; employees; // Getter and Setter methods }
has comment: http://stackoverflow.com/comment/35143657
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9188718
downvote count: 1

linked-list
tags question: http://stackoverflow.com/q/22995753
tags question: http://stackoverflow.com/q/22985429
tag name: linked-list
tags question: http://stackoverflow.com/q/23123828
tags question: http://stackoverflow.com/q/23021958
tags question: http://stackoverflow.com/q/23117649
tags question: http://stackoverflow.com/q/22991988
tags question: http://stackoverflow.com/q/23122955
tags question: http://stackoverflow.com/q/22977713
type: Tag
tags question: http://stackoverflow.com/q/23062894
tags question: http://stackoverflow.com/q/23049002
tags question: http://stackoverflow.com/q/22978307
tags question: http://stackoverflow.com/q/22972624
tags question: http://stackoverflow.com/q/23033014
tags question: http://stackoverflow.com/q/23128751
tags question: http://stackoverflow.com/q/23077864
tags question: http://stackoverflow.com/q/23006647
tags question: http://stackoverflow.com/q/23117581
tags question: http://stackoverflow.com/q/23056083

http://stackoverflow.com/comment/35146635
type: QuestionComment
comment on: http://stackoverflow.com/q/23010399
has text: It depends how you are reading it from the server. Show some code.
score: 0
type: Comment

http://stackoverflow.com/comment/35525907
score: 0
type: Comment
has text: I can't find getPortalPosition() in Portet
comment on: http://stackoverflow.com/a/23127632
type: AnswerComment

http://stackoverflow.com/comment/35105776
type: Comment
comment on: http://stackoverflow.com/a/22987888
score: 0
type: AnswerComment
has text: It remains the same. What you should change is just _removing the pramaeter's method_ and **not** changing the return type of the method, it must keep `String`.

http://stackoverflow.com/q/22973032
has answer: http://stackoverflow.com/a/22973431
type: Question
tagged with: graph
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35102183
has title: updating graph on each iteration of a loop
has body: I have a bubble graph that I need to update the radius of each bubble on every iteration of a loop. Each iteration the loop analyses a tweet and updates the topic count and then each bubble is updated with this information. The problem I'm having is that the bubbles just grow once all the tweets have been analysed and not after each one. I need the graph to update after each iteration of the loop so you can see the analysis taking place. Here's the code I use to try and do this currently. private void onLiveDemoButtonClicked(ActionEvent event) throws IOException, JWNLException { fFilePath = Paths.get("C:\\Users\\Lynsey\\Documents\\FinalYearProject\\words\\test.txt"); Scanner scanner = new Scanner(fFilePath, ENCODING.name()); int tweetCount = 0; Tweets tweetDemo = new Tweets(); while(scanner.hasNextLine()) { // if(tweetCount &lt;= 100) { tweetCount++; // System.out.println(scanner.nextLine()); String currentTweet = scanner.nextLine(); tweetDemo.processLineByLine(currentTweet); XYChart.Series&lt;Number, Number&gt; s = liveDemoBubbleChart.getData().get(0); s.getData().add(new XYChart.Data(5, 5, ProjectProperties.getInstance().getSportsTweetsCount())); XYChart.Series&lt;Number, Number&gt; p = liveDemoBubbleChart.getData().get(1); p.getData().add(new XYChart.Data(25, 25, ProjectProperties.getInstance().getPoliticsTweetsCount())); XYChart.Series&lt;Number, Number&gt; d = liveDemoBubbleChart.getData().get(2); d.getData().add(new XYChart.Data(55, 55, ProjectProperties.getInstance().getIllnessTweetsCount())); XYChart.Series&lt;Number, Number&gt; w = liveDemoBubbleChart.getData().get(3); w.getData().add(new XYChart.Data(75, 75, ProjectProperties.getInstance().getWarTweetsCount())); XYChart.Series&lt;Number, Number&gt; m = liveDemoBubbleChart.getData().get(4); m.getData().add(new XYChart.Data(95, 95, ProjectProperties.getInstance().getMoneyTweetsCount())); XYChart.Series&lt;Number, Number&gt; u = liveDemoBubbleChart.getData().get(5); u.getData().add(new XYChart.Data(115, 115, …
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35079905
tagged with: java

http://stackoverflow.com/comment/35296513
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23091496
has text: it looks as if #[processingRetry] isn't evaluated to an int, or evaluated at all for that matter... but instead taken as is.
score: 0

http://stackoverflow.com/comment/35320342
has text: why do not you break on `newline`?
comment on: http://stackoverflow.com/q/23106842
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23108359
has title: Getting OutOfMemoryError: PermGen space whiling executing maven build in jenkins
tagged with: java
has body: Triggering a CI build from git to jenkins Using tomcat 7 server,maven 3,jdk 7
score: -1
has comment: http://stackoverflow.com/comment/35323258
answer count: 1
downvote count: 1
tagged with: maven-3
linked to: http://stackoverflow.com/q/11341494
favorite count: 0
has comment: http://stackoverflow.com/comment/35323153
has comment: http://stackoverflow.com/comment/35324138
upvote count: 0
tagged with: jenkins
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23108451
tagged with: tomcat7
type: Question

http://stackoverflow.com/comment/35220084
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23050499
has text: If you are getting a NPE, then for the best help, post the stacktrace and indicate which line throws the NPE.
score: 0

http://stackoverflow.com/comment/35091709
type: AnswerComment
has text: +1 for the regex for splitting. Splitting was the actual challenge in this problem.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22978775

http://stackoverflow.com/a/23078069
accepted answer of: http://stackoverflow.com/q/23077820
answers question: http://stackoverflow.com/q/23077820
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35270280
type: Answer
score: 1
upvote count: 1
has body: Try this. public MySurface(Context context) { super(context); // TODO Auto-generated constructor stub this.setBackgroundColor(Color.TRANSPARENT); this.setZOrderOnTop(true); //necessary getHolder().setFormat(PixelFormat.TRANSPARENT); getHolder().addCallback(this); ourHolder = getHolder(); }

http://stackoverflow.com/q/23080343
downvote count: 0
tagged with: asp.net
tagged with: linux
tagged with: windows
has answer: http://stackoverflow.com/a/23083060
favorite count: 0
has body: I have one application to write in C# (I can write that in Java as well) This application is basically accepts some information from user and using these information we are creating some files on Linux system (This is the idea) Using what libraries I can achieve this ? Assumption: I do have credentials and access to the Linux machine. What is the best way to do this ? How can I do this with .NET and Java ? Application must be on Windows. Mostly application will be developed in ASP.net/C#.net/Java (only windows) Some examples: 1. I will be creating a file say abc.rb on one linux server. 2. Execute a command e.g. sudo app-client or any other command like "service httpd restart"
upvote count: 1
possible better answer: http://stackoverflow.com/a/23080589
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23080589
tagged with: c#
accepted answer: http://stackoverflow.com/a/23083060
score: 1
tagged with: java
type: Question
answer count: 2
has title: Java/C#.NET on windows to execute linux operations

http://stackoverflow.com/q/23023079
has answer: http://stackoverflow.com/a/23023552
tagged with: java
accepted answer: http://stackoverflow.com/a/23023119
type: Question
possible better answer: http://stackoverflow.com/a/23023552
tagged with: arrays
has comment: http://stackoverflow.com/comment/35170971
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35170972
has answer: http://stackoverflow.com/a/23023119
has comment: http://stackoverflow.com/comment/35171001
has body: I have an array of objects. When the array fills up, I want to make a new array twice as large as the old one, and transfer all the elements over. I'm doing something wrong, I think its something to do with I'm not creating the correct reference to the new array. Here's my code, any help figuring this out would be appreciated. private int DIRECTORY_SIZE = 6; Entry [] directory = new Entry[DIRECTORY_SIZE]; private int numberOfElements = 0; public int getNumOfElements(){ return numberOfElements; } public void setDirectorySize(int size){ DIRECTORY_SIZE = size; } public int getDirectorySize(){ return DIRECTORY_SIZE; } public void addEntry(String surname, String initial, String num) { // TODO add an entry to an array, also increments numberOfElements variable tracking whats in array if(getNumOfElements() == getDirectorySize()){ // if array is full doubleArraySize(); // put temp values into new bigger directory array } int i = findFreeLocation(); directory[i] = new Entry(surname, initial, num); numberOfElements++; } private void doubleArraySize(){ Entry[] temp = new Entry[DIRECTORY_SIZE]; //make new temp array same size as old one for(int i = 0; i &lt; DIRECTORY_SIZE ; i++){ temp[i] = directory[i]; // cycle through array putting all values into temp // works up to here } setDirectorySize(DIRECTORY_SIZE*2); // double size of array Entry[] directory = new Entry[DIRECTORY_SIZE]; // create new, double size directory array for(int i = 0; i &lt; temp.length ; i++){ directory[i] = temp[i]; } } private int findFreeLocation() { int i; for (i = 0; i &lt; DIRECTORY_SIZE; i++) { if(directory[i] == null) { break; } } return i; }
has comment: http://stackoverflow.com/comment/35171100
type: AnsweredQuestion
has title: doubling Array size if full

http://stackoverflow.com/comment/35086339
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22976394
type: QuestionComment
has text: let's just say the original array was 1,1,1,1,4,4,5,6. So my cmpArray prints: 41241516. dcmpArray should print out: 1,1,1,1,4,4,5,6.

http://stackoverflow.com/comment/35180264
comment on: http://stackoverflow.com/a/23028451
has text: @HarmeetSingh The grant permission was probably unnecessary
type: AnswerComment
score: 0
type: Comment

jxtreetable
tags question: http://stackoverflow.com/q/23065386
tag name: jxtreetable
type: Tag
tags question: http://stackoverflow.com/q/23093451

http://stackoverflow.com/a/23044034
type: Answer
has body: Path start = Paths.get("test.txt"); try { List&lt;String&gt; lines = Files.readAllLines(start); for (Iterator&lt;String&gt; it = lines.iterator(); it.hasNext();) { String line = it.next(); if (!"@data".equals(line.trim())) { it.remove(); } else { break; } } System.out.println(lines); } catch (IOException e) { e.printStackTrace(); } I was reading about Path online so why not something like this as alternative to Bohemian code? Maybe something could be done using stream() of Java 8 but not still nothing...
score: 0
answers question: http://stackoverflow.com/q/23043670

http://stackoverflow.com/comment/35270738
has text: @Jul That is not a stack trace. That's an exception, and not even a complete one. The exception message tells you the class. Try again. You're not going to get anywhere until you provide proper information.
type: Comment
comment on: http://stackoverflow.com/q/23078110
score: 0
type: QuestionComment

instantiation
type: Tag
tag name: instantiation
tags question: http://stackoverflow.com/q/22970694

http://stackoverflow.com/q/23010101
has comment: http://stackoverflow.com/comment/35146143
has answer: http://stackoverflow.com/a/23010155
type: AnsweredQuestion
has body: I have a set of constant like this: private static final transient String NOME_FILE_RC = "blabla1.xml"; private static final transient String NOME_FILE_NS = "blabla2.xml"; private static final transient String NOME_FILE_NE = "blabla3.xml"; private static final transient String NOME_FILE_DT = "blabla4.xml"; private static final transient String NOME_FILE_MC = "blabla5.xml"; private static final transient String NOME_FILE_NR = "blabla6.xml"; I want to replace FILE with DOCUMENT in eclipse I set find with \w{4}_(FILE)_\w{2} I know that $1 catches FILE string but I don't know how to replace it with DOCUMENT.
score: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/23010157
favorite count: 0
has answer: http://stackoverflow.com/a/23010157
type: Question
tagged with: regex
has comment: http://stackoverflow.com/comment/35146207
has title: How to replace string group with a string in eclipse
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/35146089
accepted answer: http://stackoverflow.com/a/23010155
tagged with: java

http://stackoverflow.com/comment/35353159
type: Comment
type: QuestionComment
has text: have you try CV_ 32F?
comment on: http://stackoverflow.com/q/23123336
score: 0

http://stackoverflow.com/q/22975266
tagged with: string
has comment: http://stackoverflow.com/comment/35084060
favorite count: 0
score: 2
linked to: http://stackoverflow.com/q/3052442
has comment: http://stackoverflow.com/comment/35084092
upvote count: 2
accepted answer: http://stackoverflow.com/a/22975302
linked to: http://stackoverflow.com/q/18339707
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35084365
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35084789
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35084002
has title: When should I creat String as new() and literal?
has answer: http://stackoverflow.com/a/22975302
has comment: http://stackoverflow.com/comment/35084128
has body: I really don't know when and why should I use the constructor for String and not the literal way. I have already looked, found some answers of differences which were not really clear... but nothing about the best practices or "why?" and "when?" I understood that literal definition is treated by the JVM but also that they are not handled by the Garbage Collector (like static staff, annotations ...)... could this really be a problem for the memory of the JVM ? I added here the shortest comparison that I found: What is the difference between creating String as new() and literal? When we create string with new() Operator, it’s created in heap and not added into string pool while String created using literal are created in String pool itself which exists in PermGen area of heap. Thank you for your time and help.

http://stackoverflow.com/comment/100072873
has text: Where is the WordUtils.capitalize method ?
type: Comment
comment on: http://stackoverflow.com/a/34969223
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35160915
score: 0
type: Comment
type: QuestionComment
has text: Do you have 5 Listview items each containing a Button or every single ListView item contains 5 Buttons ?
comment on: http://stackoverflow.com/q/23017816

http://stackoverflow.com/comment/35131750
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23001712
has text: But not enough it seems. Please put just a little more effort into your question.
score: 0

http://stackoverflow.com/q/23019189
tagged with: sockets
has answer: http://stackoverflow.com/a/23019236
has comment: http://stackoverflow.com/comment/35186386
type: UnansweredQuestion
tagged with: java
downvote count: 1
type: Question
has body: My client code: import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.nio.ByteBuffer; import java.util.Scanner; public class UDPClient { public static void main (String[] args) throws IOException{ DatagramSocket ds = new DatagramSocket(); System.out.println("Insert number: "); Scanner s= new Scanner(System.in); int num = s.nextInt(); byte[] byteSend = ByteBuffer.allocate(4).putInt(num).array(); InetAddress address = InetAddress.getByName("localhost"); int port = 1999; DatagramPacket dpSend = new DatagramPacket(byteSend, byteSend.length , address ,port); ds.send(dpSend); byte[] byteReceive = new byte[1]; byte[] byteAck = "*".getBytes(); DatagramPacket dpReceive = new DatagramPacket(byteReceive, byteReceive.length); DatagramPacket dpAck = new DatagramPacket(byteAck, byteAck.length , address, port); for (int i=1; i&lt;=num; i++){ ds.receive(dpReceive); String randomString = new String(dpReceive.getData()); System.out.println(randomString); ds.send(dpAck); } ds.close(); } } My server code: import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.nio.ByteBuffer; public class UDPServer { public static void main(String[] args) throws IOException { DatagramSocket ds = new DatagramSocket(1999); while (true) { byte[] byteReceive = new byte[4]; //size of type int: 4 bytes DatagramPacket dp = new DatagramPacket(byteReceive, byteReceive.length); ds.receive(dp); int num = ByteBuffer.wrap(dp.getData()).getInt(); InetAddress address = dp.getAddress(); int port = dp.getPort(); byte[] byteSend = "&amp;&amp;&amp;&amp;&amp;".getBytes(); Byte b = rno[0]; // Boxing conversion converts `byte` to `Byte` int i = b.intValue(); DatagramPacket dpSend = new DatagramPacket(byteSend, byteSend.length, address, port); byte[] byteAck = new byte[1]; DatagramPacket dpAck = new DatagramPacket(byteAck, byteAck.length); for (int i = 1; i &lt;= num; i++…
tagged with: datagram
score: -1
tagged with: udpclient
upvote count: 0
answer count: 1
favorite count: 0
has title: How do I convert a ByteArray into int via UDP Datagram
tagged with: byte

http://stackoverflow.com/comment/139526967
score: 0
type: Comment
type: QuestionComment
has text: this question is in an obsolete version.
comment on: http://stackoverflow.com/q/23082038

http://stackoverflow.com/q/22973833
has comment: http://stackoverflow.com/comment/35081790
has title: Should I use static method or public method ... android
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22974500
has comment: http://stackoverflow.com/comment/35082022
has comment: http://stackoverflow.com/comment/35084147
has answer: http://stackoverflow.com/a/22973927
has comment: http://stackoverflow.com/comment/35082004
tagged with: android
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22973927
has comment: http://stackoverflow.com/comment/35081889
has comment: http://stackoverflow.com/comment/35084852
has comment: http://stackoverflow.com/comment/35081480
type: Question
tagged with: oop
has body: I want to create DownloadData class and there implement a method to download the data from my web service ! in this way : public class DownloadData { public static string getData("url"){ ..... return data;} } so should I declare the method as static and then i could call it by the class name with out create DownloadData object; or to "not" declare it as static and then I should create an object to call the method. edit: I can't use getData method in several thread if I declare another static fields in this way : public class DownloadData { static int num=0; public static string getData("url"){ ..... return data;} } thank you very much
has answer: http://stackoverflow.com/a/22974500
has comment: http://stackoverflow.com/comment/35082118
has comment: http://stackoverflow.com/comment/35082088

http://stackoverflow.com/comment/35240840
has text: Spring has extensive logging. Why did you not enable it and read any problems in there. Saves us from guessing.
comment on: http://stackoverflow.com/q/23052490
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/105337179
has text: I am facing the same issue in my chained mapper, where both of them almost seem to be running simultaneously because the data set is very small. Did you manage to find a solution?
comment on: http://stackoverflow.com/q/23012536
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23113415
answers question: http://stackoverflow.com/q/23113221
type: Answer
score: 1
has body: I wouldn't recommend RegEx..but since it was part of your question and I want to get faster at writing expressions, I whipped this up: (?:\w+,){3}(.*) This will match (but not capture) 3 sets of 1+ word characters ([a-zA-Z0-9_]) followed by a comma. Then we will match and capture everything else in the string. See example here: Regex101 Additionally, you can just match the first 3 sets of 1+ word characters ([a-zA-Z0-9_]) followed by a comma: ^(\w+,){3} And then use Java to replace this match with an empty string: Regex101
upvote count: 1
downvote count: 0

qt
tags question: http://stackoverflow.com/q/23084779
type: Tag
tag name: qt

http://stackoverflow.com/q/23045601
score: -1
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/23045893
tagged with: java
has title: Java classpath related
has body: I had two classes package xcom; public class A { } package xcom; public class B extends A { } The directory structure is : foo/test/xcom/A.java foo/test/xcom/B.java I first compiled A.java, then deleted the A.java file so that xcom now contains B.java and A.class, now finally using again xcom as current directory I compiled B.java using command 'javac B.java' and B.java was produced in same directory, this is where I got confused, because by default javac command does not search current directory for class , so why does this program compiled.Please help!!
type: AnsweredQuestion
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23045893
type: Question

http://stackoverflow.com/q/23056804
has body: Hey Im making a new project which requires you to download some files from my Dropbox. I added a new class called DownloadFile which has the code to download a file. For some reason the app crashes when I click download. Thanks. Heres the DownloadFile: package com.Matt7262.download.app; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; //Chat bot library import org.alicebot.ab.Chat; import org.alicebot.ab.Bot; import android.view.View; import android.widget.Button; import android.os.Environment; import android.widget.TextView; import android.widget.Toast; import java.io.InputStream; import java.net.URL; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import android.widget.ProgressBar; import java.net.URL; import java.net.URLConnection; import android.app.Activity; import android.app.ProgressDialog; import android.os.Environment; import android.view.View.OnClickListener; public class DownloadFile extends ActionBarActivity{ public void updateProgress(int currentSize, int totalSize) { Toast.makeText(getApplicationContext(), "Loading Files...", Toast.LENGTH_SHORT).show(); } public void Download() { try { //set the download URL, a url that points to a file on the internet //this is the file to be downloaded URL url = new URL("https://dl.dropboxusercontent.com/shz/9cyfz0b45mj6szr/7pBuupNz3N/xecta?token_hash=AAEs9cDFswt98D1IhLnab4dHwhwh5z2Lmhq_N6H-2M0LWg&amp;top_level_offset=6"); //create the new connection HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); //set up some things on the connection urlConnection.setRequestMethod("GET"); urlConnection.setDoOutput(true); //and connect! urlConnection.connect(); //set the path where we want to save the file //in this c…
has title: Android Java - How to download zip file from URL?
tagged with: android
linked to: http://stackoverflow.com/q/3382996
accepted answer: http://stackoverflow.com/a/23057753
upvote count: 4
tagged with: android-studio
has answer: http://stackoverflow.com/a/23057753
has answer: http://stackoverflow.com/a/76032483
has comment: http://stackoverflow.com/comment/35232870
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35231552
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35231424
has comment: http://stackoverflow.com/comment/35231310
possible better answer: http://stackoverflow.com/a/76032483
score: 4
favorite count: 0

http://stackoverflow.com/comment/35304412
type: QuestionComment
has text: The exception is: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 66 at java.lang.String.substring(Unknown Source) at WebCrawler.WebCrawler.linkParser(WebCrawler.java:127) at WebCrawler.WebCrawler.main(WebCrawler.java:28)
type: Comment
comment on: http://stackoverflow.com/q/23096881
score: 0

http://stackoverflow.com/q/23126565
has comment: http://stackoverflow.com/comment/35356647
has comment: http://stackoverflow.com/comment/35358355
score: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/35381942
type: UnansweredQuestion
has title: text data put into PQ heapsort
has body: I am trying to input data from a text file into a dynamic array and then sort it using PQ Heap sort the program works with regular 1-d array but when using text file it does not work: here the code #include &lt;iostream&gt; #include&lt;fstream&gt; #include&lt;string&gt; using namespace std; void swapData(int&amp;, int&amp; ); class PQHeapSort{ public: PQHeapSort(int DataSize) : NIndex(0) { PQ = new int[DataSize];} ~PQHeapSort() {delete[] PQ; } void InsertData(int); int RemoveData(); void DisplayData(); void BubbleDown(int*, int, int); void BubbleUp (int*, int); private: int *PQ; int NIndex; }; void PQHeapSort::BubbleUp(int a[], int bindex){ while (bindex&gt;1 &amp;&amp; a[bindex] &lt; a[bindex/2]){ if(a[bindex] &lt; a[bindex/2]){ swapData(a[bindex], a[bindex/2]);} bindex= bindex/2; } } void PQHeapSort::BubbleDown(int a[], int b, int c){ while (2*b &lt;= c){ int child = 2*b; if(child&lt;c &amp;&amp; a[child]&gt;a[child+1]){ child++; } if (a[b]&gt;a[child]) { swapData(a[b], a[child]); b = child; } else return; } } void PQHeapSort::InsertData(int item){ PQ[++NIndex] = item; BubbleUp(PQ, NIndex); } int PQHeapSort:: RemoveData(){ swapData(PQ[NIndex], PQ[1]); BubbleDown(PQ, 1, NIndex-1); return PQ[NIndex--]; } void PQHeapSort::DisplayData(){ for(int i = 1; i&lt;=NIndex; i++){ cout&lt;&lt;PQ[i]&lt;&lt;" "; } } void swapData(int &amp;a, int &amp;b){ int tempData = b; b = a; a = tempData; } int main() { int ArraySize = 0; string inputFile; ifstream inFile; cout &lt;&lt; "Please enter the name of the input file: "; cin &gt;&gt; inputFile; inFile.open(inputFile.c_str()); int data; while(inFile&gt;&gt;data){ ArraySize++; } int *TextData = 0 TextData = new int[ArraySize]; for(int i=0; i&lt;ArraySize; i++){ inFile&gt;&gt;TextData[i]; PQHeapSort *q = new PQHeapSort(ArraySize-1); q-&gt;InsertData(TextData[i]); q-&gt;DisplayData(); cout&lt;&lt;"min data remove"&lt;&lt; q-&gt;RemoveData()&lt;&lt;endl; q-&gt;DisplayData(); } return 0; } how would you convert this into Java
tagged with: c++
answer count: 0
type: Question
tagged with: java

http://stackoverflow.com/q/23061902
tagged with: batik
favorite count: 0
tagged with: http://stackoverflow.com/tag/svg
answer count: 0
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has body: I'm trying to rotate an SVGGraphics2D and then export it to PNG format and I'm having problems. Can you help me? Exception in thread "main" org.apache.batik.transcoder.TranscoderException: null Enclosed Exception: The "xmlns" attribute was already specified for element "svg". at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:136) at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156) at inclan.icon.svg.rasterizer.SVGRasterizer.transcodeToPNG(SVGRasterizer.java:382) at inclan.icon.svg.rasterizer.SVGRasterizer.main(SVGRasterizer.java:370) My code: protected TranscoderInput input; protected TranscoderOutput output; public static void main(String [] args) throws Exception { SVGGraphics2D gra = getSVGGraphics2D(new ByteArrayInputStream(getXML().getBytes())); tilt(gra); FileOutputStream ops = new FileOutputStream(new File("C://Users//pablosouza//Desktop//svg//asf-logo-png.png")); SVGRasterizer r = new SVGRasterizer(getInputStream(gra), ops); r.transcodeToPNG(); } public static SVGGraphics2D getSVGGraphics2D(InputStream iStream){ SVGGraphics2D svg = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document parse = builder.parse(iStream); SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(parse); svg = new SVGGraphics2D(ctx,false); } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return svg; } public SVGRasterizer(InputStream inputStream, FileOutputStream ops) { this.input = new TranscoderInput(inputStream); this.output = new TranscoderOutput(ops); } private void transcodeToPNG() throws TranscoderException { PNGTranscoder png = new PNGTranscoder(); png.addTranscodingHint(PNGTranscoder.…
has comment: http://stackoverflow.com/comment/35242485
has comment: http://stackoverflow.com/comment/35249031
has title: Error transcoding SVGGraphics2D to PNG
has comment: http://stackoverflow.com/comment/35242902
upvote count: 1

http://stackoverflow.com/q/23102790
has body: I am looking to gather some professional advises and precautions to do Secure Coding using Java. Couple of them I am already considering: Should not log unwanted/excessive/sensitive information. SQL injection should be taken care in parameterised queries, should use PreparedStatement or CallableStatement instead of Statement. All the resources (db connections, input/output streams) should be release carefully. Internal Exceptions should be caught and sanitized before propagating to upstream callers as it may reveal sensitive information. Should clear the sensitive information even from memory when done as it can appear in core dump. In case of inter-process communication, sensitive arguments should be encrypted. Should use private for variables unless having good reason not to. Should provide copy methods for sensitive classes. Should prefer static factory method for object construction over public constructor. Should avoid serialization of class that might hold sensitive information. Appreciate any add up from the community.
type: Question
tagged with: java
score: -1
upvote count: 1
answer count: 1
favorite count: 0
tagged with: security
has comment: http://stackoverflow.com/comment/35314370
type: UnansweredQuestion
has title: Precautions to Secure Java Coding
has comment: http://stackoverflow.com/comment/35473603
has comment: http://stackoverflow.com/comment/35324058
downvote count: 2
has answer: http://stackoverflow.com/a/23102837

http://stackoverflow.com/q/23041067
score: 1
has title: Adding and deleting from JTable
linked to: http://stackoverflow.com/q/6900628
favorite count: 0
type: UnansweredQuestion
tagged with: addition
upvote count: 1
tagged with: swing
tagged with: java
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23042739
has body: I have a JTable with custom model and custom CellEditor and CellRenderer and I want to delete and add data in this table. How do I do this? My model: public class frandtabmodule extends AbstractTableModel { Vector list; public frandtabmodule(Vector frand_list ) { this.list = frand_list; } @Override public Class getColumnClass(int columnIndex) { return Frand.class; } @Override public int getColumnCount() { return 1; } @Override public String getColumnName(int columnIndex) { return " "; } @Override public int getRowCount() { return (list == null) ? 0 : list.size(); } @Override public Object getValueAt(int rowIndex, int columnIndex) { int i =0 ; System.out.println(" raw"+rowIndex+" clumn"+columnIndex +"/n -------------------------------------------"+i++); return (list == null) ? null : list.get(rowIndex); } @Override public boolean isCellEditable(int columnIndex, int rowIndex) { return true; } @Override public void fireTableRowsDeleted(int firstRow, int lastRow) { this.list.remove(firstRow); this.fireTableDataChanged(); } } My CellEditor and CellRenderer: public class renderediter extends AbstractCellEditor implements TableCellEditor, TableCellRenderer { //Clientdef1 clientdef ; Frand list; public renderediter(){ //clientdef = new Clientdef1(); } /*private void updateData(Frand feed, boolean isSelected, JTable table) { this.feed = feed; clientdef.setconncted(feed.iscon); clientdef.name.setText(feed.name); if (isSelected) { clientdef.setBackground(table.getSelectionBackground()); }else{ clientdef.setBackground(table.getSelectionForeground()); } }*/ @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { Frand frad = (Frand)value; System.err.println("-------------------------\n f1 called\n ------------------"); //updateData(feed, true, table); frad.def.setBackground(table.getSelectionBackground()); return frad.def; } @Override public Object getCellEditorValue() { return null; } @Override public Compone…
tagged with: jtable

http://stackoverflow.com/comment/35219754
comment on: http://stackoverflow.com/q/23050210
has text: Great point, but it still did not work. I'll update the above code though
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35312732
has text: location is the file's path, example c:\\a.txt
type: Comment
comment on: http://stackoverflow.com/a/23098067
type: AnswerComment
score: 0

http://stackoverflow.com/q/22974731
tagged with: jdialog
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22974940
has body: I have a Solitaire program that contains two different games. To access the games I have a menu bar with a Game Menu containing Carpet Solitaire and Clock Solitaire. By default the program starts up in Carpet solitaire and I would like to choose Game -> Clock Solitaire then have a new window pop up with clock solitaire and the old Carpet solitaire window to close. Currently my program will open the clock window but will not close the old Carpet window. public void clockGame() { JButton[] buttons = { new JButton("Close"), new JButton("New Game") }; final JDialog dialog = new JDialog(GUI, "Click a button"); final JOptionPane optionPane = new JOptionPane("Would you like to start a new game of Clock Solitaire?", JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE, null, buttons, buttons[1]); buttons[0].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.setVisible(false); } }); buttons[1].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // What can I put here to close the Carpet Window new ClockSolitaire(); dialog.setVisible(false); } }); dialog.setContentPane(optionPane); dialog.pack(); dialog.setLocationRelativeTo(GUI); dialog.setVisible(true); } What can I add to the second actionPerformed so the old window closes?
has title: Close only one Jframe window
has answer: http://stackoverflow.com/a/22974812
score: 0
answer count: 2
tagged with: swing
possible better answer: http://stackoverflow.com/a/22974812
accepted answer: http://stackoverflow.com/a/22974940
tagged with: java
has comment: http://stackoverflow.com/comment/35083128
tagged with: multiple-instances
tagged with: user-interface

http://stackoverflow.com/q/23009907
has comment: http://stackoverflow.com/comment/35146424
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23010036
has comment: http://stackoverflow.com/comment/35145728
tagged with: java
score: -1
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35145747
has title: infinite while loop gives java.lang.OutOfMemoryError: Java heap space
favorite count: 0
has comment: http://stackoverflow.com/comment/35145790
has comment: http://stackoverflow.com/comment/35145713
has body: if i want to run a while loop up to infinity and i am getting Java heap space but i am using "system garbage cleaner " to clean up memory. so how can i solve this problem. try{ while(true){ try{ attach=sample.readMails(); System.gc(); } catch (IOException e){ // TODO Auto-generated catch block e.printStackTrace(); System.out.println("Error In readMails--&gt;downloads"); } } }catch (Exception e){ // TODO Auto-generated catch block e.printStackTrace(); System.out.println("Error In Infinite While"); }
has comment: http://stackoverflow.com/comment/35145736

http://stackoverflow.com/q/23115177
type: Question
has comment: http://stackoverflow.com/comment/35335807
linked to: http://stackoverflow.com/q/19418962
has answer: http://stackoverflow.com/a/23115213
answer count: 6
score: 0
has answer: http://stackoverflow.com/a/23115231
accepted answer: http://stackoverflow.com/a/23115231
has comment: http://stackoverflow.com/comment/35336115
has answer: http://stackoverflow.com/a/23115221
has body: I have been asked this question in an interview, I said both would return false. but when I crossed checked it one was true other was false can anyone explain it? String s1 = "H"; String s2 = "e"; String s3 = s1+s2; String s4 = "He"; System.out.println(s3 == s4);//false String s5="h"; String s6="h"; System.out.println(s5 == s6);//true
tagged with: string
linked to: http://stackoverflow.com/q/767372
has title: Java Strings Output confusion
has answer: http://stackoverflow.com/a/23115217
has comment: http://stackoverflow.com/comment/35336055
has answer: http://stackoverflow.com/a/23115608
possible better answer: http://stackoverflow.com/a/23115217
linked to: http://stackoverflow.com/q/17489250
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35336303
tagged with: java
has answer: http://stackoverflow.com/a/23115716

http://stackoverflow.com/comment/35140590
has text: http://developer.android.com/training/articles/security-ssl.html#HttpsExample
comment on: http://stackoverflow.com/q/23006955
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23057207
has comment: http://stackoverflow.com/comment/35232142
type: Answer
has comment: http://stackoverflow.com/comment/35232915
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23055158
has body: For observing file/dir changes using JDK 6, you could use: WatchService for Java 6 For JDK 7, WatchService is part of NIO package: http://java.dzone.com/news/how-watch-file-system-changes
has comment: http://stackoverflow.com/comment/35232515
downvote count: 0

http://stackoverflow.com/a/23139447
accepted answer of: http://stackoverflow.com/q/23119394
has comment: http://stackoverflow.com/comment/35389640
has body: If you have a lot of unique values in attributes that you index, you would probably benefit from IndexQuantization discussed on the site. This is a way to tune the tradeoff between memory usage and retrieval speed. But it's especially useful to reduce the size of indexes in memory, if you have a large number of unique values. FYI you can also ask questions in the CQEngine discussion forum. Hope that helps!
score: 5
answers question: http://stackoverflow.com/q/23119394
upvote count: 5
has comment: http://stackoverflow.com/comment/35389697
has comment: http://stackoverflow.com/comment/35389555
has comment: http://stackoverflow.com/comment/35383157
has comment: http://stackoverflow.com/comment/35399704
type: AcceptedAnswer
downvote count: 0
type: Answer

output
tags question: http://stackoverflow.com/q/23109863
tags question: http://stackoverflow.com/q/23049016
tag name: output
type: Tag
tags question: http://stackoverflow.com/q/23125289
tags question: http://stackoverflow.com/q/23074778
tags question: http://stackoverflow.com/q/22994023
tags question: http://stackoverflow.com/q/23023472
tags question: http://stackoverflow.com/q/23024244
tags question: http://stackoverflow.com/q/23045731
tags question: http://stackoverflow.com/q/23069436

http://stackoverflow.com/a/23037666
has comment: http://stackoverflow.com/comment/35197050
upvote count: 1
has body: When you say getNthValue(1), this returns you the value at index 1, which is the second element since indices are 0-based. So in your linked list, you have the value 1 at index 0, and the value 2 and index 1.
has comment: http://stackoverflow.com/comment/35197013
downvote count: 0
has comment: http://stackoverflow.com/comment/35197081
answers question: http://stackoverflow.com/q/23037645
type: Answer
score: 1

http://stackoverflow.com/a/23077830
accepted answer of: http://stackoverflow.com/q/23077692
score: 0
answers question: http://stackoverflow.com/q/23077692
type: Answer
has body: I placed parentheses around the [^\\.]*\\.[^\\.]+{2,}.* in the middle and captured it into group 2 and then concatenated the first group and second group into String a. I'm not sure if this is the exact pattern you wanted, but it's the right string. public class test { public static void main(String ar[]) throws java.io.IOException { String regex = "(\\.\\.[a-zA-Z0-9])([^\\.]*\\.[^\\.]+{2,}.*)([a-z]{2,}\\.\\.)"; String useStr = "..aa.aaa..bb.."; Pattern pattern = Pattern.compile(regex); Matcher match = pattern.matcher(useStr); while (match.find()) { //String a = useStr.substring(match.start(), match.end()); String a = match.group(1) + match.group(2); System.out.println(a); } } } This sets a to and subsequently prints out: ..aa.aaa..
type: AcceptedAnswer

http://stackoverflow.com/comment/35228951
comment on: http://stackoverflow.com/q/23055559
score: 0
type: Comment
type: QuestionComment
has text: Are you saying you can able to print only the last Object and not all the Objects added?Is this your problem?

http://stackoverflow.com/q/23024957
has comment: http://stackoverflow.com/comment/35174556
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23025218
tagged with: java
tagged with: loops
has answer: http://stackoverflow.com/a/23025010
type: Question
tagged with: object
tagged with: arrays
tagged with: sorting
has comment: http://stackoverflow.com/comment/35177926
has title: Find index of objects in an array with same name, sort them by value, then change their values
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35174707
has answer: http://stackoverflow.com/a/23031900
has body: I'm really stuck at the end of my code, this a snippet of where I get lost. My goal was to create an array of objects from a class I made (not shown) called Books. It stores their ISBN, title, and price. The code is supposed to ask a user for a book title and ISBN # and if it matches any of the books in the array, all the books with the same ISBN and title will be sorted from the lowest price to the highest, and then all of their prices will be changed to the price of the book with the lowest price. I commented where I get lost. Thanks a lot! The books class looks like this: class Books { private String title; private int ISBN; private int price; public Books(){ title = "The Outsiders"; ISBN = 1234; price = 14; } //regular constructor public Books(String T, int I, int P){ title = T; ISBN = I; price = P; } //Copy Constructor public Books(Books aBook){ this.title = aBook.title; this.ISBN = aBook.ISBN; this.price = aBook.price; } This is the beginning of my class I'm working in: //Beginning of ModifyBooks Class Books[] Library = new Books[10]; Library[0] = new Books("blah", 1726374, 12.00); Library[1] = new Books("Lovely Bones", 111112, 20.00); Library[2] = new Books("Birds in a Fence", 111113, 13.00); Library[3] = new Books("Hunger Games", 111114, 14.50); Library[4] = new Books("Titanic", 738394, 12.5); Library[5] = new Books("Heroes", 7373849, 21.00); Library[6] = new Books(Library[1]); Library[7] = new Books(Library[1]); Library[8] = new Books(Library[2]); Library[9] = new Books(Library[3]); //Changing all prices of books for (int i = 0 ; i &lt; Library.length ; i++){ Library[i].price = i + 5; } //Keyboard configuration Scanner kb = new Scanner(System.in); System.out.println("Please enter a book's title:"); String UserTitle = kb.nextLine(); System.out.println("Please enter a book's ISBN Number:"); int UserISBN = kb.nextInt(); System.out.println("Your entered book's title is " + UserTitle + " and the ISBN is " + UserISBN); double[] sameBook = new double[10]; int coun…

http://stackoverflow.com/q/22999794
has body: I have a Dropbox workspace, and recently(this has never happened before), I came home(I edited some code at school also in the Dropbox workspace), and now Eclipse crashes everytime I use that workspace, but not any of my other workspaces. I have reinstalled Eclipse and tried to allocate from 512mb to 2gigs of RAM but nothing has happened. I've trimmed down the error code b/c it's over 52,000 characters long. Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product !ENTRY org.eclipse.egit.ui 2 0 2014-03-23 14:36:48.729 !MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory. The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in this system level configuration. The Git installation location can be configured on the Team &gt; Git &gt; Configuration preference page's 'System Settings' tab. This warning can be switched off on the Team &gt; Git &gt; Confirmations and Warnings preference page. !ENTRY org.eclipse.egit.ui 2 0 2014-03-23 14:36:48.754 !MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git user global configuration and to define the default location to store repositories: 'C:\Users\Gannon'. If this is not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and EGit might behave differently since they see different configuration options. This warning can be switched off on the Team &gt; Git &gt; Confirmations and Warnings preference page. !SESSION 2014-03-25 09:32:12.798 ----------------------------------------------- eclipse.buildId=M20130204-1200 java.version=1.7.0_21 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US Framework arguments…
has answer: http://stackoverflow.com/a/22999980
has comment: http://stackoverflow.com/comment/37707258
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7847359
accepted answer: http://stackoverflow.com/a/22999980
type: Question
tagged with: dropbox
tagged with: java
tagged with: eclipse
score: 0
has title: Eclipse Kepler crashes in a certain workspace
answer count: 1

http://stackoverflow.com/q/22982157
score: 22
upvote count: 22
answer count: 3
has answer: http://stackoverflow.com/a/22982249
possible better answer: http://stackoverflow.com/a/22982325
favorite count: 0
accepted answer: http://stackoverflow.com/a/22982249
type: AnsweredQuestion
tagged with: clone
has title: How do I copy or clone a LinkedList-implemented Queue in Java?
tagged with: java
has body: I have a Queue q1, that is implemented as a LinkedList, and I want to define a Queue q2, that is a separate, but identical identical instance of Queue q1. How do I do that since Queue does not implement Cloneable?
tagged with: queue
type: Question
has answer: http://stackoverflow.com/a/22982277
tagged with: cloneable
downvote count: 0
has answer: http://stackoverflow.com/a/22982325

http://stackoverflow.com/comment/35328016
type: QuestionComment
comment on: http://stackoverflow.com/q/23015586
score: 0
has text: @mrak using TransparentWebMarkupContainer for both widgetBox and widgetContent indeed solves the problem. Please add as answer and I'll accept it. Thanks.
type: Comment

http://stackoverflow.com/q/23017816
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/35283203
has answer: http://stackoverflow.com/a/23018225
has answer: http://stackoverflow.com/a/23018628
has comment: http://stackoverflow.com/comment/35164652
type: Question
has comment: http://stackoverflow.com/comment/35160915
has comment: http://stackoverflow.com/comment/35294995
has comment: http://stackoverflow.com/comment/35166211
tagged with: button
has answer: http://stackoverflow.com/a/23252929
accepted answer: http://stackoverflow.com/a/23252929
favorite count: 0
has title: How can I find my button ID's in a ListView row Android Java?
tagged with: listview
answer count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/35160950
has comment: http://stackoverflow.com/comment/35161655
tagged with: http://stackoverflow.com/tag/xml
possible better answer: http://stackoverflow.com/a/23018225
downvote count: 2
has comment: http://stackoverflow.com/comment/35161677
has body: I have 1 listview, 5 rows, so when I run the code, I got 5 item_Titel, 5 item_Datum, 5 item_Intro and 5 item_Button. But I don't know how I can find the R.Id. from each item, each row. When u use loose textviews and buttons you can call it in your XML like: @id/"clicked_button1", @id/"clicked_button2', @id/"clicked_button3" etc. Then I can use switch case and fill it, example: public class OnClick implements OnClickListener { @Override public void onClick(View v) { switch (v.getId()) { case R.id.clicked_Button1: Url = 1; break; case R.id.clicked_Button2: Url = 2; break; case R.id.clicked_Button2: Url = 3; break; But now I'm using a listview.. But how can I find out which R.id."item_Button???!!!" I need to use now? I hope my question / explanation is a bit clearer now! ;-) Thank you for helping me! Added XML item_view: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;TextView android:id="@+id/item_Titel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:layout_marginBottom="5dp" android:layout_marginLeft="3dp" android:layout_marginRight="3dp" android:textColor="#FFFFFF" android:textSize="20dp" /&gt; &lt;TextView android:id="@+id/item_Datum" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/item_Titel" android:layout_marginBottom="5dp" android:layout_marginLeft="3dp" android:layout_marginRight="3dp" android:textColor="#FFFFFF" android:textSize="13dp" /&gt; &lt;TextView android:id="@+id/item_Intro" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/item_Datum" android:layout_marginBottom="5dp" android:layout_marginLeft="3dp" android:layout_marginRight="3dp" android:textColor="#FFFFFF" android:textSize="15dp" /&gt; &lt;Button android:id="@+id/item_Button" and…
has comment: http://stackoverflow.com/comment/35160773
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/36410205
comment on: http://stackoverflow.com/a/23512333
type: Comment
has text: @jewelsea I think that my "workaround" solution is too inefficient, but in a spare time I will certainly improve it and donate solution.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23119905
has title: parsing date from string but getting wrong value
tagged with: string
has answer: http://stackoverflow.com/a/23120635
has comment: http://stackoverflow.com/comment/35346237
type: Question
has comment: http://stackoverflow.com/comment/35344911
has body: So, I want to compare two dates and I have an if loop to function if one date is after the other. My method: Start and End Dates are user inputted variables and are in the form Month/Day/Year. String startDate = "02/20/2012"; String endDate = "03/20/2012"; Date startDate1 = new SimpleDateFormat("MM/dd/yyyy").parse(startDate); Date endDate1 = new SimpleDateFormat("MM/dd/yyyy").parse(endDate); however, startDate1 is showing this: Mon Feb 20 00:00:00 EST 2012 and, endDate1 is showing this: Tue Mar 20 00:00:00 EDT 2012 I don't understand what i'm doing wrong here. The loop: if (endDate1.after(startDate1)){ blah blah blah }
has comment: http://stackoverflow.com/comment/35344932
score: 0
has answer: http://stackoverflow.com/a/23120230
has answer: http://stackoverflow.com/a/23120023
has comment: http://stackoverflow.com/comment/35344993
has answer: http://stackoverflow.com/a/23119950
tagged with: java
type: UnansweredQuestion
tagged with: date
has comment: http://stackoverflow.com/comment/35345356
answer count: 4

http://stackoverflow.com/q/23067532
type: Question
type: AnsweredQuestion
tagged with: java
score: 10
has title: How to check if bean property exist win BeanUtils or similar?
upvote count: 10
has body: Is there ready made routine to check if bean has getter for specific property name given by string?
accepted answer: http://stackoverflow.com/a/23067602
answer count: 1
downvote count: 0
tagged with: javabeans
favorite count: 0
tagged with: apache-commons-beanutils
has answer: http://stackoverflow.com/a/23067602

wifi
tag name: wifi
type: Tag
tags question: http://stackoverflow.com/q/22998178
tags question: http://stackoverflow.com/q/23127684
tags question: http://stackoverflow.com/q/23113016

http://stackoverflow.com/a/23032809
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23032697
type: Answer
upvote count: 2
has body: 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. Not only that, JScrollPanes do not work well when the viewport view (the component that you display inside of the JScrollPane) uses null layout. Not only that, if you set the bounds or even the preferred size of a JTextArea, it will not expand inside the JScrollPane and you won't see scrollbars. Solution: Avoid using null layouts like the plague. Learn and use the layout managers: The Swing Layout Manager Tutorials Never set a JTextArea's size or preferredSize. Instead consider setting its columns and rows. For example: import java.awt.BorderLayout; import javax.swing.*; public class MainFrame2 extends JPanel { private JTabbedPane tabbedPane = new JTabbedPane(); private JTextArea textArea = new JTextArea(20, 40); public MainFrame2() { tabbedPane.add("Bahahahaha", new JPanel()); tabbedPane.add("TextArea Info", createTextAreaPane()); setLayout(new BorderLayout()); add(tabbedPane, BorderLayout.CENTER); } private JComponent createTextAreaPane() { JPanel btnPanel = new JPanel(); btnPanel.add(new JButton("Save")); JPanel textAreaPane = new JPanel(new BorderLayout()); textAreaPane.add(new JScrollPane(textArea), BorderLayout.CENTER); textAreaPane.add(btnPanel, BorderLayout.SOUTH); return textAreaPane; } private static void createAndShowGui() { MainFrame2 mainPanel = new MainFrame2(); JFrame frame = new JFrame("Main Frame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(mainPanel); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGui(); } }); } }
answers question: http://stackoverflow.com/q/23032697
score: 2

http://stackoverflow.com/q/22997908
linked to: http://stackoverflow.com/q/3478795
has answer: http://stackoverflow.com/a/22997954
tagged with: java
score: -4
type: Question
has comment: http://stackoverflow.com/comment/35124802
duplicate of: http://stackoverflow.com/q/3478795
upvote count: 1
answer count: 1
has title: How to find how many objects are live for a particular class at a particular instance?
favorite count: 0
downvote count: 5
type: UnansweredQuestion
has body: Using static increment in Constructor can give me total objects created, but it does not give me live objects count. so how can i get the live objects at a particular instance?

http://stackoverflow.com/comment/35172704
type: Comment
comment on: http://stackoverflow.com/a/23023770
score: 0
type: AnswerComment
has text: May you write a full example of a code which would suit my example? I would really appreciate it.

http://stackoverflow.com/q/23015210
linked to: http://stackoverflow.com/q/2095397
downvote count: 4
answer count: 2
tagged with: user-interface
tagged with: web
favorite count: 0
has answer: http://stackoverflow.com/a/23016143
has answer: http://stackoverflow.com/a/23015664
has comment: http://stackoverflow.com/comment/35156442
score: -1
upvote count: 3
type: UnansweredQuestion
tagged with: java-ee-7
has title: Choose appropriate UI technology in Java EE application
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/35156110
tagged with: java
has body: There are several approaches to choose from when creating new Java EE 7 application. JSP JSF (Facelets) plain HTML 5 + JavaScript ??? The question is - please, show the conditions when it is better to use one or another UI technology, what are the pros and cons of using each of them, unique and cool features of the technology, in a couple of words, to make a complete picture inside my head. Sorry if this question seems you stupid. Thank you. UPDATE 1: Also, what would be the best technology to use if the app should be as much cross-platform (i.e. desktop browsers, mobile browsers, etc.) as possible. UPDATE 2: If nowadays almost everyone knows HTML and JS with its frameworks - why then to use JSP or JSF?

http://stackoverflow.com/comment/35077329
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22971712
has text: You are shadowing many of your instance variables, like in your `PogGame` constructor. Also don't compare Strings using `==`. Use `equals()`.
type: Comment

http://stackoverflow.com/comment/35187532
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22997332
has text: @user3275947, does that help? The way you did it and the way I did it are just two of the many possible ways to go about this; but I hope my answer was able to solve your question. Beyond doing it this way, I can think of one other decent way off the top of my head to do this and that would be to use a loop and a sleep function.

http://stackoverflow.com/comment/35362291
type: Comment
comment on: http://stackoverflow.com/a/23129681
type: AnswerComment
has text: This will upto my need functionality wise, but i am thinking about large set of key values which has to be iterated large number of times
score: 0

http://stackoverflow.com/q/23092714
has answer: http://stackoverflow.com/a/23093130
has answer: http://stackoverflow.com/a/23093023
has comment: http://stackoverflow.com/comment/35296867
score: 0
answer count: 2
has title: JScrollPane won't display
has body: I'd like to create a simple GUI based 'Echo' application with the ability to scroll up and down through previous input. So far, everything is working except when I add the JTextPane to the JScrollPane, I lose the input and the scroll never appears. Can someone point me in the right direction? Here is the code I have so far: import java.awt.*; import javax.swing.*; public class FileReaderGui { private JFrame frame; private JPanel inputPanel; private JTextField userInput; private JScrollPane scrollPane; private JTextPane display; JButton print; public void show() { frame = new JFrame(); frame.setSize(400, 200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); buildInputPanel(); buildDisplayPanel(); frame.getContentPane().add(inputPanel, BorderLayout.SOUTH); frame.getContentPane().add(scrollPane, BorderLayout.CENTER); frame.setVisible(true); } public void buildDisplayPanel() { display = new JTextPane(); scrollPane = new JScrollPane(display); } public void buildInputPanel() { inputPanel = new JPanel(); userInput = new JTextField(); userInput.setColumns(20); inputPanel.add(userInput); print = new JButton("Print"); print.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String current = display.getText(); String input = userInput.getText(); String newText = String.format("%s\n%s", current, input); display.setText(newText); } }); inputPanel.add(print); } } And, here is the caller: public class FileReader { public void go() { FileReaderGui gui = new FileReaderGui(); gui.show(); } public static void main(String[] args) { new FileReader().go(); } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35296958
has comment: http://stackoverflow.com/comment/35298115
tagged with: swing
type: Question
tagged with: java

http://stackoverflow.com/a/23106117
answers question: http://stackoverflow.com/q/23105992
score: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35319226
has body: Probably you miss the manifest file or in the manifest file is not specified the entry point class (http://docs.oracle.com/javase/tutorial/deployment/jar/appman.html).
upvote count: 1
has comment: http://stackoverflow.com/comment/35319413

sortedmap
tags question: http://stackoverflow.com/q/23076465
tag name: sortedmap
type: Tag
tags question: http://stackoverflow.com/q/22975224

http://stackoverflow.com/q/23047823
has comment: http://stackoverflow.com/comment/35215891
favorite count: 0
has title: Export java project to jar file in eclipse trouble
answer count: 0
has comment: http://stackoverflow.com/comment/35215215
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35215820
has comment: http://stackoverflow.com/comment/35216086
has comment: http://stackoverflow.com/comment/35216004
upvote count: 1
has comment: http://stackoverflow.com/comment/35215672
type: Question
has comment: http://stackoverflow.com/comment/35215765
score: 1
tagged with: java
has body: I am trying to export my java project into a jar file however I am having difficulty. The jar file is like a damaged version of the project with the audio and images missing. My file structure on Eclipses navigator looks like this; *SkyWars *Settings *Audio *bin *images *src *skyWars (package folder) *classpath *project I was told to tick Export generated class files and resources in the jar export pane, click next, then make sure the main class is selected in the final screen before finishing. Ive trued everything from Exporting the route folder SkyWars to trying src and skyWars. Is there something wrong with the structure of my project?
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35215370
has comment: http://stackoverflow.com/comment/35216130
downvote count: 0
has comment: http://stackoverflow.com/comment/35216050
tagged with: jar

http://stackoverflow.com/comment/35523676
type: Comment
score: 0
has text: Thank you. I knew about IndexedEmbedded, but as I remember, it is prohibited to set empty prefix for it (I don't need a prefix for the nested entities, I need their names in one field).
comment on: http://stackoverflow.com/a/23216293
type: AnswerComment

http://stackoverflow.com/a/22991970
upvote count: 0
has comment: http://stackoverflow.com/comment/119905527
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/22991590
score: -1
has body: Well there is several ways you could go about doing it. For the date you could try using some methods like String Split to break up the dates by '/' and see if the dates are within a relevant range. String string = "4/10/2014"; String[] parts = string.split("/"); String part1 = parts[0]; // 4 String part2 = parts[1]; // 10 String part3 = parts[2]; // 2014 Then do a while loop and loop the user back to the beginning for new input if the values aren't Int's or are to high or low. Heres a link from a previous question about Int verification: Link!

http://stackoverflow.com/q/23084228
linked to: http://stackoverflow.com/q/13973233
type: AnsweredQuestion
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/35280694
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35280570
accepted answer: http://stackoverflow.com/a/23084332
downvote count: 5
linked to: http://stackoverflow.com/q/22969348
has comment: http://stackoverflow.com/comment/35280564
has title: Java's null value is added to the String
answer count: 2
possible better answer: http://stackoverflow.com/a/23084302
has comment: http://stackoverflow.com/comment/35280551
has comment: http://stackoverflow.com/comment/35280844
has answer: http://stackoverflow.com/a/23084302
favorite count: 0
has comment: http://stackoverflow.com/comment/35280528
has answer: http://stackoverflow.com/a/23084332
has body: Yesterday I was working on an android project &amp; found that null value too is concatenated to a String also it effects the String length , while empty string doesn't have any effect. Why is it so ? UPDATED QUESTION : Why is it so ? null is supposed to hold nothing ! import java.util.*; import java.lang.*; import java.io.*; class Sample { public static void main (String[] args) { String nullVar = null; String emptyVar = ""; String newNullVar = nullVar + "Some,String"; String newEmptyVar = emptyVar + "Some,String"; System.out.println(newNullVar + " &amp; length is " +newNullVar.length()); System.out.println(newEmptyVar + " &amp; length is " +newEmptyVar.length()); } } OUTPUT : nullSome,String &amp; length is 15 Some,String &amp; length is 11 Output Online

http://stackoverflow.com/a/23127971
has comment: http://stackoverflow.com/comment/35514296
has comment: http://stackoverflow.com/comment/35370540
answers question: http://stackoverflow.com/q/23110422
has comment: http://stackoverflow.com/comment/35484487
upvote count: 4
has comment: http://stackoverflow.com/comment/35367941
downvote count: 0
score: 4
type: Answer
has body: You can use structural search / replace (from menu Edit - > Find -> Structural ..., it's a built in plugin called "Structural search"): Search template: List&lt;$TYPE$&gt; $listVar$ = $init$; for ($TYPE$ $var$ : $listVar$) { $BLOCK$; } Replace template: $TYPE$[] $listVar$ = $init$; for (int i = 0; i &lt; $listVar$.length; i++) { $TYPE$ $var$ = $listVar$[i]; $BLOCK$; } You need to set unlimited number for $BLOCK$ variable to correctly process whole for block, or even fiddle little bit with regexp to catch lines that don't end with ;. Note that this won't change return type of createItems() method ($init$ in the template). But you are left with bunch of compile time errors.

http://stackoverflow.com/q/23090669
has comment: http://stackoverflow.com/comment/35293112
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/35293253
has comment: http://stackoverflow.com/comment/35293816
has comment: http://stackoverflow.com/comment/35292731
has answer: http://stackoverflow.com/a/23090755
has comment: http://stackoverflow.com/comment/35292667
upvote count: 7
linked to: http://stackoverflow.com/q/1514553
type: Question
tagged with: java
has body: How is memory allocated for a variable declaration in Python vs. Java? Without a compilation step how does an interpreted language know how much memory is needed for a variable?
has comment: http://stackoverflow.com/comment/35292623
downvote count: 4
accepted answer: http://stackoverflow.com/a/23090755
has comment: http://stackoverflow.com/comment/35293346
has title: Why do we need to declare the variable before we use it in some languages, but not in others?
has comment: http://stackoverflow.com/comment/35292942
answer count: 1
has comment: http://stackoverflow.com/comment/35292993
linked to: http://stackoverflow.com/q/11007627
favorite count: 0
has comment: http://stackoverflow.com/comment/35292662
linked to: http://stackoverflow.com/q/370357
has comment: http://stackoverflow.com/comment/35292590
tagged with: python
has comment: http://stackoverflow.com/comment/35294697

http://stackoverflow.com/comment/35275789
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23060994
has text: @Gray: what GermannArlington said was right. each socket is for a different user.
score: 0

http://stackoverflow.com/a/23022777
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23022731
upvote count: 2
has body: That is called the exit status or return code. It tells the shell whether your program ran without error (return code 0) or with an error (any other return code value, which one you choose indicates the type of error.)
score: 2

http://stackoverflow.com/a/23090487
has body: String.compareTo returns all whole int values above and below zero. Therefore your code should look like this: @Override public int compareTo(Osoba o) { if (!this.surname.equalsIgnoreCase(o.getSurname())) { return this.surname.compareToIngoreCase(o.getSurname()); } else { return this.name.compareToIngoreCase(o.getName()); } }
answers question: http://stackoverflow.com/q/23090342
score: 0
type: Answer

http://stackoverflow.com/a/23040461
type: Answer
has body: You can simply start an activity with this action: startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)); I use it inside a dialog: public static void displayPromptForEnablingGPS(final Activity activity) { final AlertDialog.Builder builder = new AlertDialog.Builder(activity); final String action = Settings.ACTION_LOCATION_SOURCE_SETTINGS; final String message = "Do you want open GPS setting?"; builder.setMessage(message) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int id) { activity.startActivity(new Intent(action)); d.dismiss(); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int id) { d.cancel(); } }); builder.create().show(); }
accepted answer of: http://stackoverflow.com/q/23040392
has comment: http://stackoverflow.com/comment/78300811
has comment: http://stackoverflow.com/comment/115157686
downvote count: 0
score: 58
answers question: http://stackoverflow.com/q/23040392
upvote count: 58
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/85559384

http://stackoverflow.com/comment/35128785
type: Comment
comment on: http://stackoverflow.com/a/23000011
type: AnswerComment
has text: Thank you JB. Do you know how I would put an exception for the month names? It doesn't allow me to do an if else statement.
score: 0

http://stackoverflow.com/a/23052666
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23052649
downvote count: 0
has body: You are no where initializing BillAction for Bill object. By default the instance variables are set to null. So calling a method on BillAction will result in NullPointerException. You need to override the default constructor and make sure you initialize the BillAction attribute as well in that. Or simply initialize it as mentioned by Sanjay in his answer.

http://stackoverflow.com/comment/35281335
comment on: http://stackoverflow.com/q/23084644
score: 2
has text: post your logcat then
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35350603
comment on: http://stackoverflow.com/q/23123201
has text: the metho CheckResult Int is not applicable on this line jl.setText.(answers.checkResult());
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22989101
favorite count: 0
tagged with: restful-authentication
has title: Java Authentication Form - Etat HTTP 408 - The time allowed for the login process has been exceeded
type: UnansweredQuestion
score: 3
has body: we need to authenticate users when they access certain group of web services. For that we use auth-method FORM. When user enters info inside text area and clicks the button, application will try to call a web service. This web service is secured and user needs to authenticate first. The auth form will be displayed as a popup (jquery effect). Here is the code: ... ... Create a new Clinic Username Password Clinic Name: The problem is that whenever i submit the right info for login, it redirects to this 408 error: Etat HTTP 408 - The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browser Any idea for a solution?
has comment: http://stackoverflow.com/comment/44992403
has comment: http://stackoverflow.com/comment/45019116
answer count: 0
upvote count: 3
tagged with: java
type: Question
downvote count: 0
tagged with: jquery
tagged with: http-status-code-408

http://stackoverflow.com/a/23096796
has comment: http://stackoverflow.com/comment/35304581
score: 0
answers question: http://stackoverflow.com/q/23096698
has comment: http://stackoverflow.com/comment/35304222
has comment: http://stackoverflow.com/comment/35304406
type: Answer
has body: Would something like this suit? JButton[][] s = new JButton[5][]; for (int i = 0; i&lt; 5; i++){ if (i == 0) { s[i] = new JButton[6]; } else { s[i] = new JButton[5]; } }

logic
tags question: http://stackoverflow.com/q/23011980
tags question: http://stackoverflow.com/q/23051709
tags question: http://stackoverflow.com/q/23125945
tags question: http://stackoverflow.com/q/23035047
tags question: http://stackoverflow.com/q/23048216
tag name: logic
type: Tag
tags question: http://stackoverflow.com/q/23101742
tags question: http://stackoverflow.com/q/22996752
tags question: http://stackoverflow.com/q/23093893

http://stackoverflow.com/a/23141118
answers question: http://stackoverflow.com/q/23096822
upvote count: 1
has body: I think the condition used to calculate q is not right: if (b &lt; 0) q = (-b - distSqrt)/2; else q = (-b + distSqrt)/2; Here, you're deciding upon the sign of b. You should calculate both the values. It's clear that the first one, (-b - distSqrt)/2 would always give the smaller value of q, because distSqrt is always non-negative. Only if (-b - distSqrt)/2 is negative, you should check (-b + distSqrt)/2 which might be positive in some cases. This case will appear when the origin of the ray is located inside the sphere. And is the t1 = c/q thing necessary? When you have the smaller positive value of q, you are done (because a must be positive, and 1 if the direction is an unit vector). In my implementation, I did the calculation this way: double Sphere::getIntersection(Ray ray) { Vector v = ray.origin - center; double b = 2 * dot(ray.dir, v); double c = dot(v, v) - radius * radius; double d = b * b - 4 * c; if(d &gt; 0) { double x1 = (-b - sqrt(d)) / 2; double x2 = (-b + sqrt(d)) / 2; if(x1 &gt;= 0 &amp;&amp; x2 &gt;= 0) return x1; if(x1 &lt; 0 &amp;&amp; x2 &gt;= 0) return x2; } return -1; } and it worked well.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/35129338
has text: What is the problem with using the same name for a variable and a method? Except it may be confusing...
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23000404

http://stackoverflow.com/comment/35235605
has text: Thank you so much. I cannot believe I didn't see that :)
comment on: http://stackoverflow.com/a/23003127
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/23034673
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23029707
downvote count: 0
answers question: http://stackoverflow.com/q/23029707
has comment: http://stackoverflow.com/comment/35225286
has body: Your code looks correct for the use case. One possible problem is that you could be accidentally using Jackson 2 annotations with Jackson 1 ObjectMapper (I can see latter is Jackson from package names in exception). Version of annotations and mapper must match; otherwise annotations will be ignored, and this would explain problems you are seeing.
score: 4
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/23093808
has title: Check if a string consists of exactly 5 digits in Java
has comment: http://stackoverflow.com/comment/35299442
has answer: http://stackoverflow.com/a/23094200
has comment: http://stackoverflow.com/comment/35299378
has answer: http://stackoverflow.com/a/23093851
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35299002
has comment: http://stackoverflow.com/comment/35298939
has comment: http://stackoverflow.com/comment/35299312
favorite count: 0
possible better answer: http://stackoverflow.com/a/23093851
has comment: http://stackoverflow.com/comment/35299273
has comment: http://stackoverflow.com/comment/35298894
has comment: http://stackoverflow.com/comment/73005821
type: Question
has comment: http://stackoverflow.com/comment/35299118
tagged with: regex
accepted answer: http://stackoverflow.com/a/23094200
score: -1
has comment: http://stackoverflow.com/comment/35299628
has body: In a Java application I need to check if a given string contains only digits 0-9 and is exactly five digits long My first attempt is this: public static void main(String[] args) { String testString = "000000"; String myPattern = "\\d{5}"; Pattern validCharacterPattern = Pattern.compile(myPattern); Matcher matcher = validCharacterPattern.matcher(testString); boolean b = matcher.find(); if (b) System.out.println("Valid"); else System.out.println("Invalid"); } However the above expression is also true for e.g. 123456. What do I need to change?
answer count: 2
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/35299488
linked to: http://stackoverflow.com/q/4975644
has comment: http://stackoverflow.com/comment/35299421
has comment: http://stackoverflow.com/comment/35298899
tagged with: java
has comment: http://stackoverflow.com/comment/35299390

http://stackoverflow.com/a/23238697
type: Answer
answers question: http://stackoverflow.com/q/23104624
has body: problem solved, I worked on the structure of JRBeanCollectionDataSource
score: 0

http://stackoverflow.com/comment/35207565
has text: ok but its still printiong out only one element which come most often, but what i want is if i have like 51 51 51 52 52 52 53 54 55 56, to print out 51 and 52, how can i do this?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23035761
type: Comment

http://stackoverflow.com/q/23122492
tagged with: swing
accepted answer: http://stackoverflow.com/a/23122528
type: Question
tagged with: graphics
linked to: http://stackoverflow.com/q/3673056
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35349397
has body: I'm currently working with JFrame and I'm trying to draw a rectangle but I don't know how to execute the code paint(Graphics g), how do I get the Graphics object? package com.raggaer.frame; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JFrame; public class Frame { private JFrame frame; public Frame() { this.frame = new JFrame("Java Snake"); this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.frame.setSize(new Dimension(500, 500)); // DRAW?? this.frame.setVisible(true); } public void paint(Graphics g) { g.drawRect(10, 10, 200, 200); } }
tagged with: jframe
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23122528
tagged with: paint
tagged with: java
has title: Java JFrame draw

http://stackoverflow.com/comment/35299894
comment on: http://stackoverflow.com/q/23094309
has text: @AntonH yeah I tried implementing it but on the wrong class! it works now - thanks!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22973272
answers question: http://stackoverflow.com/q/22973025
has body: public static void main(String... args) { if (args.length != 4) { err.format("Usage: java Deet &lt;classname&gt; &lt;langauge&gt; &lt;country&gt; &lt;variant&gt;%n"); return; } try { Class&lt;?&gt; c = Class.forName(args[0]); Object t = c.newInstance(); Method[] allMethods = c.getDeclaredMethods(); for (Method m : allMethods) { String mname = m.getName(); if (!mname.startsWith("test") || (m.getGenericReturnType() != boolean.class)) { continue; } Type[] pType = m.getGenericParameterTypes(); if ((pType.length != 1) || Locale.class.isAssignableFrom(pType[0].getClass())) { continue; } out.format("invoking %s()%n", mname); try { m.setAccessible(true); Object o = m.invoke(t, new Locale(args[1], args[2], args[3])); out.format("%s() returned %b%n", mname, (Boolean) o); // Handle any exceptions thrown by method to be invoked. } catch (InvocationTargetException x) { Throwable cause = x.getCause(); err.format("invocation of %s failed: %s%n", mname, cause.getMessage()); } } // production code should handle these exceptions more gracefully } catch (ClassNotFoundException x) { x.printStackTrace(); } catch (InstantiationException x) { x.printStackTrace(); } catch (IllegalAccessException x) { x.printStackTrace(); } }
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22973025

http://stackoverflow.com/a/23061939
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35245339
has comment: http://stackoverflow.com/comment/35241208
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23061528
has body: The reason the transaction is not getting rolled back is beacause the RuntimeException is not getting propagated to the actual Spring proxy which manages the transaction rollback code. And the reason it is not being propagated is that you have caught it and have not rethrown. try{ return getAudioFilesBasedOnCategories(); }catch (RuntimeException e) { e.printStackTrace(); //**THIS IS WRONG** } Instead do this try{ return getAudioFilesBasedOnCategories(); }catch (RuntimeException e) { //log the error throw e; // throw back } Also you probably do not need to give rollbackFor attribute as by default on RuntimeException, the transaction is rolled back.
accepted answer of: http://stackoverflow.com/q/23061528
type: Answer

http://stackoverflow.com/comment/35270372
has text: Yes, we can. What you have tried ?
score: 0
comment on: http://stackoverflow.com/q/23078182
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23022497
downvote count: 0
answers question: http://stackoverflow.com/q/23021876
type: Answer
upvote count: 1
has body: You have a number of problems with your brackets. Make sure when you're creating a loop that you wrap the contents of the loop in curly brackets {}. When you're writing a condition, make sure you wrap each section in curly brackets. Here's the first half of the corrected program, I'll leave to you to write the rest. import java.util.Scanner; import java.lang.Thread; public class Calculator { // missing opening bracket public static void main(String[] args) throws InterruptedException { int B1; int C1; int D1; for(;;) { // missing opening bracket System.out.println("How May i asist you with your calculation."); // removed extra opening bracket here System.out.println("So what opperation do you want to use. "); Scanner scanner = new Scanner(System.in); // you only need one scanner String in = scanner.nextLine(); String response; if (in.equals("+")){ System.out.println("Enter the first Number. "); B1 = scanner.nextInt(); // only declare variables once System.out.println("Enter The last Number. "); C1 = scanner.nextInt(); D1 = B1 + C1; System.out.println(" you answer is " + D1 + "."); Thread.sleep(1000); System.out.println("Again?"); scanner.nextLine(); // clear out the previous newline response = scanner.nextLine(); if (response.equals("Yes")) { System.out.println("Ok"); } if (response.equals("No")) { // wrapped in brackets System.out.println("Ok. ill see you later"); break; } } else if (in.equals("-")){ System.out.println("Enter the first Number. "); B1 = scanner.nextInt(); System.out.println("Enter The last Number. "); C1 = scanner.nextInt(); D1 = B1 - C1; System.out.println(" you answer is " + D1 + "."); Thread.sleep(1000); System.out.println("Again?"); scanner.nextLine(); // clear out the previous newline response = scanner.nextLine(); if (response.equals("Yes")){ System.out.println("Ok"); } if (response.equals("No")) { System.out.println("Ok. ill see you later"); break; } } // changed opening bracket to closing bracket } } }
score: 1

http://stackoverflow.com/comment/35346884
score: 0
comment on: http://stackoverflow.com/a/23117409
type: Comment
type: AnswerComment
has text: @Peter ok thank you, I updated answer with that option

http://stackoverflow.com/comment/35299616
has text: I've looked through your previous questions, and all the answers seem correct to me. `How can I start a new activity based upon which item in the carousel is touched?` Implement a listener that calls `onItemSelected` when an item is touched (selected), and start a new activity with an `Intent`. What is the confusion?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23092498

http://stackoverflow.com/a/49778322
downvote count: 0
has body: To achieve your goal, you can use this library for running JavaScript in Android apps.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22973051

http://stackoverflow.com/q/22988210
has answer: http://stackoverflow.com/a/22988462
has body: I'm doing a java.nio.file.Files.move(path, path.resolveSibling("newfilename")) to rename a directory on windows 7. But I'm getting the following exception: java.nio.file.AccessDeniedException: oldfilename -&gt; newfilename at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:387) at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:287) at java.nio.file.Files.move(Files.java:1345) What is causing this? I'm using Java 7. The target path does not exist before the invocation of Files.move(). UPDATE From javadoc: When moving a directory requires that its entries be moved then this method fails (by throwing an IOException). My directory is non-empty and contains regular files, so maybe that is the reason that it cannot be used here? I'm having problems understanding the "requires that its entries be moved" wording. When is this the case?
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/51806024
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/66643123
has answer: http://stackoverflow.com/a/39626075
has title: java.nio.file.AccessDeniedException while using Files.move()
has answer: http://stackoverflow.com/a/26328523
tagged with: java
has answer: http://stackoverflow.com/a/33630549
tagged with: file
score: 6
type: Question
upvote count: 6
has answer: http://stackoverflow.com/a/46906296
answer count: 6
linked to: http://stackoverflow.com/q/28670576
tagged with: nio
has answer: http://stackoverflow.com/a/45143486
has comment: http://stackoverflow.com/comment/35107647

http://stackoverflow.com/a/23090886
upvote count: 1
score: 1
has body: This is my understanding: To explain easily, Assume we are trying to create such framework, which is capable of reading annotations and inject / create beans dynamically. First part, we should have our own annotations / have to follow any standard annotations such as Java Validation API JSR303 Second, we should read the annotations at startup and cache these information in some colletcions which ever suits for us. if it for Web application, i would create a listener and instruct the developers to start the listener while starting the app ( or startup servlet .. lot of options) This class / listener/Startup servlet would read all classes ( may be we can provide some xml file where we can ask them to configure the details) / read the config files and read the annotations using Java Reflection API . At this moment, we have required details. Such as MyBean Location :com.bean Scope : request /hotelRegister MySecondBean Location :com.bean Scope : Session /hotelRegister So for each request we have to create MyBean if the related url request. and MySecondBean should create the only once per session. Now the creation / manage the life cycle of bean. But where and when ? Frameworks like JSF / Spring / Struts used to have single entry point to the web application. which needs to be configured in web.xml as startup servlet. Assume we are having one Servlet ( MyServlet) which needs to be configure as startup Servlet. So any request through this servlet would go via doPost or doGet method in this method. in these method, we should be able to find what is the resource requested ( for example say /hotelRegister configuration ). From the configuration this servlet would know they have to create myBean as request scope , So using reflection it would create myBean and call the crossponding method in that Bean. and this servlet maintain the instance life cycle. once the request serviced this object removed from scope ( for example this object may put in HttpRequest attribute). if its m…
downvote count: 0
answers question: http://stackoverflow.com/q/23090405
type: Answer

http://stackoverflow.com/q/23083940
tagged with: java
has answer: http://stackoverflow.com/a/23084531
tagged with: maven
type: Question
has body: I just imported redisson 1.0.3 via maven, set up a redis-server on localhost on default port and wanted to try the redisson redis client. My test code looks as following: Redisson redis = Redisson.create(); Map m = redis.getMap("someMap"); But I'm getting: java.lang.NoSuchFieldError: WRITE_BIGDECIMAL_AS_PLAIN at org.redisson.codec.JsonJacksonCodec.createObjectMapper(JsonJacksonCodec.java:90) at org.redisson.codec.JsonJacksonCodec.<init>(JsonJacksonCodec.java:43) at org.redisson.Config.<init>(Config.java:44) at org.redisson.Redisson.create(Redisson.java:85) at ... As suggested in Redisson: WRITE_BIGDECIMAL_AS_PLAIN I added the dependency: com.fasterxml.jackson.core jackson-core 2.3.3 But no change... I guess redisson's dependencies are somehow broken but how can I fix this?
tagged with: jackson
score: 2
accepted answer: http://stackoverflow.com/a/23084531
downvote count: 0
answer count: 1
favorite count: 0
tagged with: redis
has title: Redisson NoSuchFieldError: WRITE_BIGDECIMAL_AS_PLAIN
tagged with: client
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/a/22969396
has comment: http://stackoverflow.com/comment/35074365
has comment: http://stackoverflow.com/comment/35074394
has comment: http://stackoverflow.com/comment/35075219
accepted answer of: http://stackoverflow.com/q/22968979
has comment: http://stackoverflow.com/comment/35073318
upvote count: 2
has body: What i have done to add google-play-services is that import a new project into eclipse workspace, and that path of that was be android-sdk-macosx/extras/google/google_play_services/libproject/google-play-services_lib and add as library in your project.. that it .. simple!! you might require to add support library in your project.
answers question: http://stackoverflow.com/q/22968979
has comment: http://stackoverflow.com/comment/35074712
has comment: http://stackoverflow.com/comment/35073381
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35073718
has comment: http://stackoverflow.com/comment/35075321
has comment: http://stackoverflow.com/comment/35074214
has comment: http://stackoverflow.com/comment/35073796
has comment: http://stackoverflow.com/comment/35074402
has comment: http://stackoverflow.com/comment/35074770
has comment: http://stackoverflow.com/comment/35073068
has comment: http://stackoverflow.com/comment/35075176
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35074364

http://stackoverflow.com/q/23022374
upvote count: 0
answer count: 1
favorite count: 0
tagged with: static
has comment: http://stackoverflow.com/comment/35169687
has body: Consider the following code : public class TestClass { int j=10; static int h=j; TestClass() { System.out.println(h); } public static void main(String[] args) { TestClass obj= new TestClass(); } } Why this generates error even when i have already declared j above h .
has title: Static variable initialization in java
type: UnansweredQuestion
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/23022394
type: Question
score: -3
tagged with: class
has comment: http://stackoverflow.com/comment/35170023

http://stackoverflow.com/a/23086677
downvote count: 0
has comment: http://stackoverflow.com/comment/35285162
score: 1
has body: Well it seems your file name is tileset.png and not tileset.jpg.
has comment: http://stackoverflow.com/comment/35285470
has comment: http://stackoverflow.com/comment/35285220
answers question: http://stackoverflow.com/q/23086639
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23086639
has comment: http://stackoverflow.com/comment/35285181
has comment: http://stackoverflow.com/comment/35285138
type: Answer

http://stackoverflow.com/q/22999876
type: Question
has comment: http://stackoverflow.com/comment/35128350
score: 0
tagged with: java
answer count: 1
linked to: http://stackoverflow.com/q/1396016
has answer: http://stackoverflow.com/a/22999994
type: UnansweredQuestion
tagged with: bytebuffer
has body: I allocate a big bytebuffer and read in some information (not use all the space associated with this buffer). Then I want to exactly input the used bytes into a file after filp(); what should I do. ByteBuffer buffer = new ByteBuffer.allocate(1024); buffer.getInt(1); buffer.getInt(2); buffer.flip(); for example, after above code, I just write fc.write(buffer)? How I tell the computer that I only need 8 bytes to input to the fc? thanks!
tagged with: file-io
has title: how to write a fixed number of bytes from a bytebuffer into the file in java

http://stackoverflow.com/comment/35345620
comment on: http://stackoverflow.com/q/23116326
has text: Okay I've changed that as just string,string tree map but I'm still getting that error. Let me update my code because I've moved a lot around
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35223285
type: Comment
comment on: http://stackoverflow.com/a/23052312
score: 0
type: AnswerComment
has text: Thank you so much, you solved my problem that's taken me so long.

http://stackoverflow.com/comment/35266291
type: Comment
has text: you should have ` ` if you have *.do as url-pattern.
comment on: http://stackoverflow.com/a/23074420
type: AnswerComment
score: 0

http://stackoverflow.com/q/23084546
tagged with: libreoffice
has body: I have to save a property of type String in metadata of .odt file. I'm using Java but the documentation is very poor (the worst documentation I ever seen) and I have no idea how to set metadata programmatically. I have an instance of the current document open in LibreOffice but I don't know how to save info in metadata. Ideas ?
tagged with: openoffice.org
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40496490
type: Question
has title: Save metadata information in .odt file in LibreOffice
answer count: 1
has answer: http://stackoverflow.com/a/25876952
score: 0

http://stackoverflow.com/comment/35288036
type: AnswerComment
comment on: http://stackoverflow.com/a/23046176
type: Comment
has text: ya i know we can access cloud datastore, but i just dont know how
score: 0

http://stackoverflow.com/comment/35089941
has text: You can adapt AJed's answer to work on plain old arrays rather than ArrayLists. Note that his algorithm requires your two arrays (array1 and array2) to be sorted, though! Also, his algorithm gives you the intersection rather than the difference of the two arrays! It was more meant as an example of another approach entirely.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22978378

http://stackoverflow.com/a/28281262
type: Answer
has body: I had the same problem after updating Hibernate from 4.2.x to 4.3.x. Setting the "hibernate.transaction.flush_before_completion" property to true solved the issue for me. true https://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/ "If enabled, the session will be automatically flushed during the before completion phase of the transaction. Built-in and automatic session context management is preferred, see Section 2.5, “Contextual sessions”".
score: 0
answers question: http://stackoverflow.com/q/23015554

http://stackoverflow.com/a/70548317
type: Answer
downvote count: 0
score: 1
has body: By placing a zero in front of the number is an integer in octal form. 010 is in octal form so its value is 8 Guess output of this program on your own : public class sol{ public static void main(String[] args){ int p = 010; int q = 06; System.out.println(p); System.out.println(q); } } output is : 8 6
answers question: http://stackoverflow.com/q/23039871
upvote count: 1

http://stackoverflow.com/a/28628278
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22977635
has body: I got this to work by executing the following code: exec("start cmd /c test.bat", $output); var_dump($output);

http://stackoverflow.com/comment/35102398
score: 0
comment on: http://stackoverflow.com/q/22985023
has text: I can do as yo mentioned only if there is one row and one combobox.every time I add a new row to the table a new combobox is generated..so how can I write an action listern to them.. I am not getting Idea..
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35216674
score: 1
comment on: http://stackoverflow.com/q/23048613
has text: i will give you a hint, have a look at code for method `replace(char oldChar, char newChar)` in String class, but i won't do your homework for you
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23093893
has body: Can anyone assist me as to why my seconds are not printing out correctly? The hours and minutes are both correct, but it is not printing out anything for the secs variable. The items in my arraylist are in System.currentTimeMillis(), which is why I have to convert them. //divides 'logoutTimeTotal' by 'loginTimeTotal' to get 'totalTimeLoggedIn' long totalTimeLoggedIn = (((totalTimeArray.get(1) - totalTimeArray.get(0)) / 1000) / 60); //creates 2 variables that convert time logged in to hours and minutes long hr = totalTimeLoggedIn / 60; long min = totalTimeLoggedIn - (hr * 60); long secs = totalTimeLoggedIn; //creates String variable with hours and minutes logged in String timeLoggedStr = hr + " Hours " + min + " Minutes " + secs + " Seconds"; Thanks
has answer: http://stackoverflow.com/a/23094060
score: 0
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/23094024
accepted answer: http://stackoverflow.com/a/23094060
type: AnsweredQuestion
has title: Issue converting to seconds
possible better answer: http://stackoverflow.com/a/23094024
tagged with: logic
type: Question

http://stackoverflow.com/comment/91431513
has text: this works.... but if you could explain why this works it would be sweet!
comment on: http://stackoverflow.com/a/22972181
type: Comment
score: 1
type: AnswerComment

jboss5.x
tag name: jboss5.x
type: Tag
tags question: http://stackoverflow.com/q/22985043

http://stackoverflow.com/a/23074001
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/23073822
has body: Fibonacci grows exponentially. The base is phi (the golden ratio), so it's not quite as fast as 2^n, but it's still pretty fast. only the smallest 94 or so Fibonacci numbers can be represented by an unsigned 64-bit integer, so a lookup table is probably your best option. However, if you really did want to compute it, you could invert the closed form solution to get something like: int fibIndex(long n) { return Math.round(Math.log(n * Math.sqrt(5))/Math.log(PHI)); } this may be of by one, and of course cannot distinguish between the double 1s early in the sequence.
answers question: http://stackoverflow.com/q/23073822
type: AcceptedAnswer
upvote count: 3
type: Answer

akka
type: Tag
tags question: http://stackoverflow.com/q/23005344
tags question: http://stackoverflow.com/q/23030059
tag name: akka
tags question: http://stackoverflow.com/q/23023059

http://stackoverflow.com/comment/35185957
type: QuestionComment
comment on: http://stackoverflow.com/q/23030991
score: 0
has text: It seems like just a new question didn't justify beginning a new activity
type: Comment

http://stackoverflow.com/a/24912192
type: Answer
has body: I had exactly the same problem until I used InstrumentationLoadTimeWeaver. I found answer here: loadTimeWeaver
score: 0
answers question: http://stackoverflow.com/q/23030281

http://stackoverflow.com/comment/35090095
type: Comment
has text: srry i dont understand
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22977502

http://stackoverflow.com/comment/35205629
type: AnswerComment
has text: Apart from the casting and all the float problems that introduces, *don't convert primitives to strings using string concatenation* (`+""`), the `String.valueOf` methods are there just for that.
type: Comment
comment on: http://stackoverflow.com/a/23034489
score: 0

http://stackoverflow.com/comment/50046018
score: 6
type: AnswerComment
comment on: http://stackoverflow.com/a/23042606
type: Comment
has text: `isIndicator` is the solution.

http://stackoverflow.com/comment/35340792
type: AnswerComment
type: Comment
has text: #cybersam thanks for your answer.but can you tell how to check that.because i am new this.can you clarify me?
comment on: http://stackoverflow.com/a/23117655
score: 0

http://stackoverflow.com/comment/35090315
type: AnswerComment
type: Comment
has text: @ yagnesh, i think i was unclear in the begining. check my codes again.
comment on: http://stackoverflow.com/a/22978903
score: 0

http://stackoverflow.com/q/23025622
has answer: http://stackoverflow.com/a/23025663
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35175786
has title: Java Serialization to file
tagged with: java
type: UnansweredQuestion
tagged with: serialization
has comment: http://stackoverflow.com/comment/35175767
type: Question
has body: I was just wondering when serializing any object in java to a file using the ObjectOutputStream, do all the methods to it also get serialized or only the data gets stored to the file?

http://stackoverflow.com/q/22995982
tagged with: listselectionlistener
tagged with: jlist
accepted answer: http://stackoverflow.com/a/22996294
tagged with: swing
tagged with: model-view-controller
has answer: http://stackoverflow.com/a/22996294
type: AnsweredQuestion
has title: Java - How do you correctly add a ListSelectionListener to a controller?
tagged with: java
type: Question
score: 0
answer count: 1
has body: I've recently been struggling with a Java problem that has been driving me mad. I've been attempting to add a ListSelectionListener in my Controller to a JList in my View but when I have successfully managed to attach the listener to something, it has not been the JList that has been drawing on the screen. The code below gives a basic idea of what I am attempting to do. This is my class with my main method: package Application; public class Main { /** * @param args */ public static void main(String[] args) { View v = new View(); Controller c = new Controller(v); } } This is my View: package Application; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import javax.swing.BorderFactory; import javax.swing.DefaultListModel; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; import javax.swing.ScrollPaneConstants; public class View extends JFrame { /* Components for the JList */ public DefaultListModel&lt;String&gt; listModel = new DefaultListModel&lt;String&gt;(); public JList&lt;String&gt; selectedItems = new JList&lt;String&gt;(listModel); JScrollPane scroll = new JScrollPane(selectedItems); public View() { // set the window title this.setTitle("JList Test"); // set the window size this.setSize(new Dimension(400, 400)); // set the window start position this.setLocation(25, 25); // set the window layout FlowLayout layout = new FlowLayout(); layout.setHgap(0); layout.setVgap(0); this.setLayout(layout); // set the window background this.getContentPane().setBackground(Color.BLACK); // make the window non-resizable this.setResizable(false); // set the default close operation this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // setup and add the JList initJList(); this.add(scroll); // add elements to the list model listModel.addElement(" Item 1 "); listModel.addElement(" Item 2 "); listModel.addElement(" Item 3 "); // make the gui visible this.setVisible(true); } privat…

http://stackoverflow.com/q/22984386
has comment: http://stackoverflow.com/comment/35101434
has answer: http://stackoverflow.com/a/23323600
type: AnsweredQuestion
has body: I have randomly generated table. Currently I am able to get table cell data using selenium.getTable(XPath) but I am not able change that value. My functions are : public static String getGridCellValue(Selenium selenium, String strGridId, int nRowIndex, int nCellIndex) { String strXPath = "//div[@id='"+strGridId+"']/table/tbody/tr[2]/td/div/div/table."+(nRowIndex + 1)+"."+(nCellIndex); return selenium.getTable(strXPath); } But I am not able to write set method as : public static void setGridCellValue(Selenium selenium, String strGridId, int nRowIndex, int nCellIndex, String strValue) { String strXPath = "//div[@id='"+strGridId+"']/table/tbody/tr[2]/td/div/div/table."+(nRowIndex + 1)+"."+(nCellIndex); selenium.type(strXPath, strValue); } It is saying com.thoughtworks.selenium.SeleniumException: Element //div[@id='gridPShipsRel']/table/tbody/tr[2]/td/div/div/table.1.5 not found Does anyone know how to set table value in selenium ?
has title: How to change table data in selenium
has comment: http://stackoverflow.com/comment/35099894
score: 1
possible better answer: http://stackoverflow.com/a/23323600
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/35111635
has answer: http://stackoverflow.com/a/22985523
upvote count: 1
tagged with: selenium-rc
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22985523
downvote count: 0
has comment: http://stackoverflow.com/comment/35101494
favorite count: 0
tagged with: xpath

http://stackoverflow.com/comment/35125003
score: 1
has text: It appends (adds to the end of, in this case, the string contained in stringBuffer) a `new line` character. You may need to go over a basic tutorial, it would be in there.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22998128

http://stackoverflow.com/comment/35137916
comment on: http://stackoverflow.com/q/23005468
has text: What the hell has this to do with `php`?
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/35278269
type: Comment
has text: Hi, is that something like event-driven?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23082780

http://stackoverflow.com/a/42539636
score: 1
answers question: http://stackoverflow.com/q/23073699
upvote count: 1
type: Answer
has body: static void squeezeLeft(int[] array) { int arrayIndex = 0; if (array.length != 0) {//check the length of array whether it is zero or not for (int i = 0; i &lt; array.length; i++) { if (array[i] != 0 &amp;&amp; arrayIndex &lt; array.length) {//check the non zero element of array if (i != arrayIndex) {//if the index of non zero element not equal to array index //only then swap the zero element and non zero element array[arrayIndex] = array[i]; array[i] = 0; } arrayIndex++; //increase array index after finding non zero element } } } }
downvote count: 0

http://stackoverflow.com/comment/35264399
comment on: http://stackoverflow.com/q/23074446
score: 0
has text: my mistake. GenericDaoImpl has constructor. i missed that
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35218510
type: QuestionComment
has text: Java is always pass by value. However, the value of an Object type is its' reference address. See also the default `toString` implementation of any Object type.
comment on: http://stackoverflow.com/q/23049628
score: 0
type: Comment

http://stackoverflow.com/comment/35265923
type: AnswerComment
has text: @HarikrishnanT do not only try to *solve* the problem. It would be better if you understand the problem and why this proposed solution worked.
score: 4
type: Comment
comment on: http://stackoverflow.com/a/23075551

http://stackoverflow.com/comment/35080675
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22972944
has text: I've never seen a Y. : )

http://stackoverflow.com/comment/35328548
type: QuestionComment
comment on: http://stackoverflow.com/q/23110337
type: Comment
score: 0
has text: Is that the complete stack trace?

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/22982160
tags question: http://stackoverflow.com/q/23040114
tags question: http://stackoverflow.com/q/22980510
tags question: http://stackoverflow.com/q/22976655
tags question: http://stackoverflow.com/q/23027356
tags question: http://stackoverflow.com/q/23026118
tags question: http://stackoverflow.com/q/23072055
tags question: http://stackoverflow.com/q/23045759
type: Tag
tags question: http://stackoverflow.com/q/23072188

http://stackoverflow.com/q/23062113
has comment: http://stackoverflow.com/comment/35383298
type: Question
upvote count: 2
downvote count: 0
tagged with: callback
has comment: http://stackoverflow.com/comment/46289321
favorite count: 0
has comment: http://stackoverflow.com/comment/35366015
has title: Callback function pointer jna
linked to: http://stackoverflow.com/q/17282785
score: 2
answer count: 0
type: UnansweredQuestion
has body: So i have native function in C declared as int NgSetEvent (int event, long callback). long Callback represent the callback function pointer. Callback prototype is declared as int oncodeline(int code, int documentid, char *string). The callback should be registered with method NgSetEvent. The problem is how to get pointer to that function which should be long or Nativelong? I have tried a lot of different aproaches but none of them gave a result. Callback was never invoked. I have tried to do like it says in Turn a Callback into a Pointer in JNA, but with no success. i don't know what to try anymore. Any help will be appreciated. OnCodeline public interface OnCodeline extends Callback { int oncodeline (int code, int documentid, byte[] string); } OnCodelineStruct public class OnCodelineStruct extends Structure { public OnCodeline onc; @Override protected List getFieldOrder() { return Arrays.asList(new String[] { "onc" }); } } Main class OnCodelineStruct onCodelinStruct; onCodelinStruct = new OnCodelineStruct(); onCodelinStruct.onc = new OnCodeline() { @Override public int oncodeline(int code, int documentid, byte[] string) { System.out.println("This IS a CALLBACK!"); return 0; } }; sbDll.NgSetEvent(0, onCodelinStruct.getPointer().getNativeLong(0));
has comment: http://stackoverflow.com/comment/47973419
tagged with: java

http://stackoverflow.com/q/23129212
has answer: http://stackoverflow.com/a/65586534
type: Question
has answer: http://stackoverflow.com/a/23129439
linked to: http://stackoverflow.com/q/38922754
downvote count: 0
has answer: http://stackoverflow.com/a/58022456
favorite count: 0
answer count: 9
has answer: http://stackoverflow.com/a/23143980
linked to: http://stackoverflow.com/q/314540
has answer: http://stackoverflow.com/a/23129266
tagged with: datetime
score: 5
has body: I want to add 5 seconds to current time Date date = new Date(); date.setSeconds(date.getSeconds()+ 5); System.out.println("old Value is: "+date); System.out.println("New Value is: "+ date); It generates the correct output exactly what I needed as: Old Value is: Thu Apr 17 14:10:33 PKT 2014 New Value is: Thu Apr 17 14:10:38 PKT 2014 but it gives me a warning error message as Multiple markers at this line - The method getSeconds() from the type Date is deprecated - The method setSeconds(int) from the type Date is deprecated What this means. Is it safe to ignore this warning? if not then how to handle it?
has answer: http://stackoverflow.com/a/23129252
has comment: http://stackoverflow.com/comment/35361062
has answer: http://stackoverflow.com/a/23129378
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/70969097
has title: Adding/Subtracting 5 seconds from Java Date - Showing deprected warning
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/23129441

http://stackoverflow.com/comment/47973419
comment on: http://stackoverflow.com/q/23062113
type: Comment
type: QuestionComment
has text: I got this dll file with device so i can't change it, the method is like as it is. And i still have problem understanding this concept what to put in method NgSetEvent. I tried everything that was on my mind, but no result. Callback is never invoked. This is original method in DLL: int NgSetEvent (int event, long callback); and body of callback function: Int oncodeline(int code, int documentid, char *string).
score: 0

http://stackoverflow.com/comment/35236283
has text: @Polppan `java.util.Date` does not may contain a timestamp, it IS a timestamp. And about `java.sql.Date`: While semantically representing a date, it is not for use outside of jdbc context. And both types have no format information associated with.
type: AnswerComment
comment on: http://stackoverflow.com/a/23058411
type: Comment
score: 1

http://stackoverflow.com/a/22994692
has body: Try this while(true){ int tmp=line.indexOf(" "); if(tmp==-1) break; System.out.println(ar[i]); ar[i++]=Integer.parseInt(line.substring(0,tmp)); line =line.substring(tmp+1); }
score: 0
answers question: http://stackoverflow.com/q/22993727
type: Answer

http://stackoverflow.com/comment/35193845
comment on: http://stackoverflow.com/a/23035551
score: 0
type: AnswerComment
has text: Don't forget to add the required call to super.paintComponent
type: Comment

http://stackoverflow.com/q/23095354
upvote count: 2
accepted answer: http://stackoverflow.com/a/23095469
has title: Running Junit test from command line
tagged with: command-line
score: 2
type: AnsweredQuestion
has body: So I wrote a class called Item and using Junit wrote a test called ItemTest and I want to execute my test from a command line. This is steps that I followed: set the path, to run java.exe and set the classpath to libraries ...&gt; set path="C:\Program Files (x86)\Java\jdk1.7.0_40\bin" ...&gt; set classpath=C:\Program Files (x86)\Java\hamcrest-core-1.3.jar; C:\Program Files (x86)\Java\junit-4.11.jar then i simply run org.junit.runner.JUnitCore to see if added libs were in classpath ...&gt;java org.junit.runner.JUnitCore the output was JUnit version 4.11 Time: 0,001 OK (0 tests) Then I compiled without an error Item and ItemTest C:\Users\User\IdeaProjects\My_project\src&gt;javac .\main\java\Item.java .\test\java\ItemTest.java Then try ro run this classes C:\Users\User\IdeaProjects\My_project\src&gt;java org.junit.runner.JUnitCore main.java.Item test.java.ItemTest In the end I got this JUnit version 4.11 Exception in thread "main" java.lang.NoClassDefFoundError: main/java/Item (wrong name: Item) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:792) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14 2) 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:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at org.junit.runner.JUnitCore.runMain(JUnitCore.java:86) at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:47) at org.junit.runner.JUnitCore.main(JUnitCore.java:40…
tagged with: java
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/23095469
tagged with: hamcrest
tagged with: junit
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/23112162
score: 3
upvote count: 3
has body: This regex should work: html = html.replaceAll("(?is)&lt;table.+?/table&gt;", ""); Where (?is) will make it match across multiple lines and ignore case. But I suggest you should not manipulate HTML using regex as it can be error prone.
answers question: http://stackoverflow.com/q/23111808
downvote count: 0
type: Answer

http://stackoverflow.com/a/23110098
has body: Arbitrary and unstructured point data has to be converted in some way The simplest way is to have a height map already. If you do not have this you are confronted with a point cloud. Either you need to map it into a height map or resolve the surface under it. Generating surface from point cloud AutoCad Implementation
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23075922

http://stackoverflow.com/q/22970279
answer count: 2
has answer: http://stackoverflow.com/a/22970837
has answer: http://stackoverflow.com/a/22970558
has title: Null Pointer Exception While doing MergeSort Method
tagged with: mergesort
has comment: http://stackoverflow.com/comment/35075019
favorite count: 0
possible better answer: http://stackoverflow.com/a/22970558
has body: I want to create a class and use it as a data type to create a MergeSort program using array. I created to program but it's giving me null pointer exception and I don't know why. Employee Class public class Employee implements Comparable&lt;Employee&gt; { private String firstname; private int idNumber; private String lastname; Employee(String fname, String lname, int id) { firstname = fname; idNumber = id; lastname = lname; } public void setFirstName(String fname) {firstname = fname;} public String getFirstName() {return firstname;} public void setidNumber(int id) {idNumber = id;} public int getidNumber() {return idNumber;} public void setLastName(String lname) {lastname = lname;} public String getLastName() {return lastname;} public String toString() { String str = "\nName: " + firstname + " " + lastname + "\nID: " + idNumber; return str; } public int compareTo(Employee Employee2) { int nameDiff = lastname.compareToIgnoreCase(Employee2.lastname); if(nameDiff != 0) return nameDiff; return -1; } } Array Class class Array { public Employee[] A; public int nElems; public Array(int max) { A = new Employee[max]; nElems = 0; } public void insert(Employee value) { int j; for(j = 0; j &lt; nElems; j++) if(A[j].equals(value)) break; for(int k = nElems; k &gt; j; k--) A[k] = A[k-1]; A[j] = value; nElems++; } public void display() { for(int j = 0; j &lt; nElems; j++) System.out.print(A[j] + " "); System.out.println(" "); } public static void merge(Employee[] L, Employee[] R, Employee[] A) { int nL = L.length; int nR = R.length; int i = 0; int j = 0; int k = 0; while(i &lt; nL &amp;&amp; j &lt; nR) { if(L[i].compareTo(R[j]) &lt;= 0) { A[k] = L[i]; k++; i++; } else { A[k] = R[j]; k++; j++; } } while(i &lt; nL) { A[k] = L[i]; k++; i++; } while (j &lt; nR) { A[k] = R[j]; k++; j++; } } private static void _mergeSort(Employee[] A) { int n = A.length; int i , j, mid; if(n &lt; 2) return; mid = n/2; Employee[] left = new Employee[mid]; Employee[] right = new Employee[n - mid]; for(i =…
tagged with: merge
has comment: http://stackoverflow.com/comment/35074987
accepted answer: http://stackoverflow.com/a/22970837
type: AnsweredQuestion
score: 0
linked to: http://stackoverflow.com/q/23117581
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35074690
tagged with: java
has comment: http://stackoverflow.com/comment/35074585

http://stackoverflow.com/q/22983527
has body: I have a requirement in which I have to get the mbean server dynamically and register a new MBean to it.The Mbean Server is created using spring.Can anyone suggest me how can it be implemented? Thanks,
has title: Regarding Dynamic Registration of MBean
accepted answer: http://stackoverflow.com/a/22984749
type: AnsweredQuestion
type: Question
tagged with: jmx
has answer: http://stackoverflow.com/a/22984749
score: 0
tagged with: java
answer count: 1
tagged with: spring-jmx

http://stackoverflow.com/comment/35328256
comment on: http://stackoverflow.com/q/23107683
type: Comment
type: QuestionComment
score: 0
has text: Now I call My Function In This Way : Date date=new Date(); String strDate=convertDateToString(date); Calendar cal=Calendar.getInstance(); cal=getCalendarFromString(strDate); activityData.setDueDate(cal);

http://stackoverflow.com/comment/35233314
score: 0
has text: Sorry... i am getting this exception: 1 counts of IllegalAnnotationExceptions Invalid @XmlElementRef : Type "class Attribute" or any of its subclasses are not known to this context. This is wired.. because the Attribute.class is not part of the XmlElementRef.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23057726

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/23059127
tags question: http://stackoverflow.com/q/23049239
type: Tag
tags question: http://stackoverflow.com/q/23045704

http://stackoverflow.com/comment/35198240
type: Comment
type: QuestionComment
has text: Please show what have you done to solve it. Where do you stuck?
comment on: http://stackoverflow.com/q/23038325
score: 0

http://stackoverflow.com/q/23019482
tagged with: reflection
tagged with: java
has body: I m learning java reflection. I tried System.exit(3); Class.forName("java.lang.System").getMethod("exit", Integer.TYPE).invoke(null, 3); and it works. I successfully also ran System.out.println(Class.forName("java.lang.System").getMethod("currentTimeMillis").invoke(null)); Now how can i invoke System.out.println reflectively java.lang.Class.forName("java.lang.System").getMethod("out.println", String.class).invoke(null, "Hi!"); is giving error. I know System does not have out function. So suggest a way to call System.out.println reflectively Here is the complete example public class ReflectionDemo1 { public static void main(String[] args) throws Exception { // java.lang.System.exit(3); // java.lang.Class.forName("java.lang.System").getMethod("exit", Integer.TYPE).invoke(null, 3); // java.lang.System.currentTimeMillis() // System.out.println(Class.forName("java.lang.System").getMethod("currentTimeMillis").invoke(null)); // System.out.println("Hi!"); java.lang.Class.forName("java.lang.System").getMethod("out.println", String.class).invoke(null, "Hi!"); } }
type: Question
has answer: http://stackoverflow.com/a/23019771
has title: java reflection System.out.println
answer count: 2
possible better answer: http://stackoverflow.com/a/74241202
downvote count: 0
has answer: http://stackoverflow.com/a/74241202
accepted answer: http://stackoverflow.com/a/23019771
favorite count: 0
upvote count: 2
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/23073757
has comment: http://stackoverflow.com/comment/35291319
has answer: http://stackoverflow.com/a/23073776
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/35291105
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/35291131
favorite count: 0
score: -1
type: UnansweredQuestion
has body: Hi im doing a request with this url = "http://nominatim.openstreetmap.org/search?q=26+rue+du+four+75006+paris&amp;format=json&amp;polygon_svg=1&amp;addressdetails=1" (for example) and its return me a json file and i tried to parse it : public class DepartureAddress { String adresseDepart = OsmRoadTaskActivity.Estartpoint.getText().toString(); static double lat; static double lng; public DepartureAddress() { } public static void getGPSCoordonates(String adresseDepart) { String adresseDepartFormate = adresseDepart.replaceAll(" ", "+"); String url = "http://nominatim.openstreetmap.org/search?q="+adresseDepartFormate+"&amp;format=json&amp;polygon_svg=1"; HttpGet httpget = new HttpGet(url); HttpClient client = new DefaultHttpClient(); HttpResponse response; StringBuilder sb = new StringBuilder(); String result = ""; try { response = client.execute(httpget); HttpEntity entity = response.getEntity(); InputStream stream = entity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader( stream, "iso-8859-1"), 8); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } stream.close(); result = sb.toString(); } catch (IOException e) { e.printStackTrace(); } try { JSONArray jarray = new JSONArray(result); for (int i = 0; i &lt; jarray.length(); i++) { JSONObject jobject = jarray.getJSONObject(i); lat = jobject.getDouble("lat"); lng = jobject.getDouble("lon"); } } catch (JSONException e) { e.printStackTrace(); } } But the app puts a marker in the middle of the ocean... What am i missing ? Thanks
has comment: http://stackoverflow.com/comment/35291414
has comment: http://stackoverflow.com/comment/35291264
downvote count: 1
has title: Parse JSON file android code already wrote
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/35180847
comment on: http://stackoverflow.com/a/23027078
type: Comment
has text: Sure why not,I have created the scanner object inside the main static method. If we create this outside the main method then it will not be assessable in the main method because a non static variable can not access in the static method and finally it will produce an error. After creating the Scanner object I am taking the input from user by using scanner's object and finally I am saving it in another variable
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35201535
has text: Thank you everyone for the tips and help. I really appreciate it. The trick was to use an arraylist.
comment on: http://stackoverflow.com/q/23036670
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22978903
has comment: http://stackoverflow.com/comment/35090543
has body: Change below line : short[][] transposedImage = new short[arrayLength][arrayWidth]; instead of short[][] transposedImage = new short[arrayWidth][arrayLength]; This is your code after change : int arrayLength = 29; // row length int arrayWidth = 10; // column length short[][] transposedImage = new short[arrayLength][arrayWidth]; short[][] decompressedImage = new short[arrayWidth][arrayLength]; // store transposed values for (int i=0;i&lt;arrayWidth; i++){ for (int j=0;j&lt;arrayLength; j++){ transposedImage[j][i]=decompressedImage[i][j]; } }
score: 0
answers question: http://stackoverflow.com/q/22978696
has comment: http://stackoverflow.com/comment/35090315
type: Answer

http://stackoverflow.com/comment/35351363
type: QuestionComment
comment on: http://stackoverflow.com/q/23123668
has text: Post your error please
score: 0
type: Comment

http://stackoverflow.com/a/23066021
score: 0
has comment: http://stackoverflow.com/comment/35251599
has body: The XML view is a description of a class hierarchy. Each object in the XML represents a java class that inherits from View. The instances that contain other class inherit from a subclass, ViewGroup. When you make a call like this: myActivity.setContentView(R.layout.activity_main_screen); What you are in effect doing is instantiating all of the objects defined in the view and associating them with your Activity. You can use your custom View subclasses in the XML by supplying the full package name (e.g. com.myapp.MyViewSubclass) in the XML definition. Here is a concrete example: &lt;com.myapp.MyViewSubclass android:id="@+id/myView1" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; Now, within the java code, if you wanted to access this view, after calling myActivity.setContentView you would do something like this: MyViewSubclass instance = (MyViewSubclass)myActivity.findViewById(R.id.myView1); So R.java is a file that is created automatically by parsing all your XML files. R.id.myView1 is an integer that resolves to the item inside your XML file, and it will reference the object that you loaded once you load it using setContentView.
answers question: http://stackoverflow.com/q/23063636
type: Answer

http://stackoverflow.com/q/23083883
has comment: http://stackoverflow.com/comment/35280348
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23084471
accepted answer: http://stackoverflow.com/a/23084471
tagged with: spring
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
tagged with: java
has body: I need to load both external and internal property files in my spring application. Once I declare the external file as below <context:property-placeholder location="file:${JBOSS_HOME}/123.properties" /> I can access the properties defined in this external file. But all properties related to the property file in my class path Could not resolved. My Application Context ** ** <context:property-placeholder location="file:${JBOSS_HOME}/123.properties" /> constants.properties I am getting property value of the external property file but not the value of the internal property file. Exception in thread "main" Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'helloWorldBean' defined in class path resource [applicationContext.xml]: Could not resolve placeholder 'internalProperty1' in string value "${internalProperty1}" at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:209) at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.processProperties(PropertySourcesPlaceholderConfigurer.java:174) at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory(PropertySourcesPlaceholderConfigurer.java:151) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:669) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplsamicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83) at com.javacodegeeks.snippets.enterprise.App.main(App.java:13) Ca…
type: Question
has comment: http://stackoverflow.com/comment/35279946
has title: Load internal (Classpath) and external property file in a Spring Application
upvote count: 2

http://stackoverflow.com/comment/35149846
comment on: http://stackoverflow.com/a/23007782
type: AnswerComment
has text: "Fetch the most visited URL" is not a machine learning problem -- it's a SQL query. Neither of these is a recommender problem. You need to dramatically clarify what you are trying to do.
score: 0
type: Comment

http://stackoverflow.com/a/22985366
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22985298
has body: Try this way: Spinner spinner1 = (Spinner) findViewById(R.id.spin1); ArrayAdapter aa= new ArrayAdapter(this,android.R.layout.simple_spinner_item, accounttype); aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner1.setAdapter(aa); spinner1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos, long id) { Object item = parent.getItemAtPosition(pos); String spin_value = item.toString(); } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { // TODO Auto-generated method stub } });
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35229321
score: 0
type: Comment
has text: yes i have <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
type: AnswerComment
comment on: http://stackoverflow.com/a/23055768

http://stackoverflow.com/q/23096314
tagged with: garbage-collection
type: Question
has answer: http://stackoverflow.com/a/23102291
score: 0
has body: I have a java program that stores a lot of data, on a whim I tried running it with the following VM argument: -XX:+PrintGCDetails On program closure, it printed: Heap PSYoungGen total 238016K, used 100138K [0x00000000eaeb0000, 0x00000000fd460000, 0x0000000100000000) eden space 224640K, 38% used [0x00000000eaeb0000,0x00000000f0378dc0,0x00000000f8a10000) from space 13376K, 99% used [0x00000000fbd50000,0x00000000fca51a60,0x00000000fca60000) to space 10240K, 0% used [0x00000000fca60000,0x00000000fca60000,0x00000000fd460000) PSOldGen total 92608K, used 88569K [0x00000000c0c00000, 0x00000000c6670000, 0x00000000eaeb0000) object space 92608K, 95% used [0x00000000c0c00000,0x00000000c627e660,0x00000000c6670000) PSPermGen total 64256K, used 64244K [0x00000000bba00000, 0x00000000bf8c0000, 0x00000000c0c00000) object space 64256K, 99% used [0x00000000bba00000,0x00000000bf8bd300,0x00000000bf8c0000) I'm assuming the 99% (and 95%) used portions suggest I need to do some tweaking. I'm just not sure of what.
has title: How to read GCDetails
answer count: 1
has comment: http://stackoverflow.com/comment/35303414
has comment: http://stackoverflow.com/comment/35344846
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/35135332
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23003972
has text: Yeah was just a quick example not the entire code. Should of been more clear on that sorry.
type: Comment

http://stackoverflow.com/q/23021877
answer count: 1
has answer: http://stackoverflow.com/a/23021962
type: UnansweredQuestion
tagged with: conflict
tagged with: java
tagged with: nodes
type: Question
tagged with: graph
has title: Implementing Conflict Graph Java
has body: I am trying to create a program that decides whether or not a set of courses have conflicting times, and from those that do not, create the largest subset of courses. My idea is to create a graph with nodes being the courses and edges connecting the nodes being conflicts. I would then color each node with no two adjacent nodes having the same color. Then I would pick the subset of courses as the ones with the most frequent color. I know there are many different ways to represent graphs in Java, however, I have never created one before, and am wondering what approaches would be good to use in my case. OR would there a more efficient approach to this problem?
score: 0

http://stackoverflow.com/a/23017121
answers question: http://stackoverflow.com/q/23016737
downvote count: 0
score: 1
has body: Add this to your class Competition: public void threeStrongest() { Competition temp = this; int best = this.current.getScore(); int best2 = 0; int best3 = 0; int i = 0; while(i &lt; 3) { if(temp.current.getScore() &gt; best){ best3 = best2; best2 = best; best = temp.current.getScore(); } else if(temp.current.getScore() &gt; best2){ best3 = best2; best2 = temp.current.getScore(); } else { best3 = temp.current.getScore(); } i++; temp = temp.next; } while(temp != null) { if(temp.current.getScore() &gt; best){ best3 = best2; best2 = best; best = temp.current.getScore(); } else if(temp.current.getScore() &gt; best2){ best3 = best2; best2 = temp.current.getScore(); } else if(temp.current.getScore() &gt; best3){ best3 = temp.current.getScore(); } temp = temp.next; } System.out.println(best + " " + best2 + " " + best3); } This works for the example you gave. Hopefully it works for all examples too. EDIT: Don't forget to add this method to your main like this: competition.threeStrongest();
upvote count: 1
type: Answer

http://stackoverflow.com/comment/35296405
has text: I see. So I guess there is no way to just have ANTLR get rid of the intermediate node? In principle there's also a matter of space efficiency here isn't there?
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23092428

http://stackoverflow.com/q/23036546
accepted answer: http://stackoverflow.com/a/23036585
has body: In C# I can create my own implicit conversion for my classes as follows... public static implicit operator TypeYouWantToChangeTo (ClassYouAreChanging c) { TypeYouWantToChangeTo x; //convert c to x return x; } How do you make a class be able to implicitly convert to another class? Also in C# I can change implicit to explicit to also create the ability to cast manually. How do you accomplish this in Java?
score: 19
has comment: http://stackoverflow.com/comment/121959082
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35194860
type: Question
linked to: http://stackoverflow.com/q/295224
answer count: 1
downvote count: 1
favorite count: 0
upvote count: 20
has title: Custom Implicit Conversion in Java
has comment: http://stackoverflow.com/comment/35194880
has answer: http://stackoverflow.com/a/23036585

http://stackoverflow.com/q/23000615
has answer: http://stackoverflow.com/a/23000709
accepted answer: http://stackoverflow.com/a/23000709
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/23000638
has answer: http://stackoverflow.com/a/23000638
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35129562
type: Question
has body: I'm getting an outofbounds exception from the following code: myArray.get(myArray.size() - 1) I know it's due to the fact that myArray contains no items. I tried adding this before checking for the last added item in the array: If (myArray.size() == -1){ myArray.add(string) } But that didn't make any difference. What am I doing wrong?
tagged with: java
has title: Outofbounds exception on empty ArrayList
score: 0
answer count: 2

http://stackoverflow.com/a/22997674
type: Answer
has comment: http://stackoverflow.com/comment/35124313
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22997531
accepted answer of: http://stackoverflow.com/q/22997531
has body: URLEncoder is not the equivalent of the code you have written. The equivalent of that is new URI(null, string, null).toASCIIString() Despite its name, URLEncoder isn't for encoding URLs. It is for encoding URL arguments, and POST key-value pairs.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/103689524
type: Comment
score: 3
has text: You can also replace `dont-execute` with `none` which appears to be better understood by IntelliJ while not documented
comment on: http://stackoverflow.com/a/23055558
type: AnswerComment

http://stackoverflow.com/q/23082466
downvote count: 1
tagged with: java
tagged with: file-browser
score: -1
type: Question
tagged with: apache
answer count: 1
has body: i've been assigned a project named " browser for documents ". I'm telling you the name of the project cause the teacher gaves us very few hints and asked us to ask and find everything ourselves so i will try to explain what i'm looking for as good as i can. So the project is about a web file browser(directory) in which there are documents(word, excel, pdf, etc) and the purpose is that the user will be able to perform the following actions on these documents. 1) A way for a good document presentantion( for examaple the ability to see a mini picture of the documents insides if you put the cursor on the documents name). 2) The ability to search for a key word in the file names and the insides of the documents. 3) The user will have to log in with his username and password in order to be able to take actions on the documents inside the directory and 4) the ability to be able to download these files not only 1 by 1 but also all together. These are some of the features that we have to acomplish. The only thing that we know is that we have to use "apache" in order to do some of this staff. Our problem is that we have no idea where to begin searching so if anyone can give us any hint it would be really really helpfull. Thank you for your time :)
favorite count: 0
tagged with: directory
has answer: http://stackoverflow.com/a/23082649
upvote count: 0
type: UnansweredQuestion
has title: How to make file browser (apache)

http://stackoverflow.com/a/23117433
has comment: http://stackoverflow.com/comment/35341509
downvote count: 0
has comment: http://stackoverflow.com/comment/35341582
has body: You should simply check if val's going to be out of range in your getFreq function. You probably also need to check if there's actually an element at the target index (i.e. it's not null). Also, as pointed out in the other answer, you're passing an 'invalid' string to your function, because 1 results in a negative val value / index - either you should avoid doing this, or you could add that check to your function as well. public int getFreq(String word) { int val = word.charAt(0) - 64; if (val &lt; 0 || val &gt;= c.length || c[val] == null) return -1; ... }
score: 1
has comment: http://stackoverflow.com/comment/35342290
answers question: http://stackoverflow.com/q/23117151
has comment: http://stackoverflow.com/comment/35342240
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23117151
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35341303
has comment: http://stackoverflow.com/comment/35340264
type: Answer
has comment: http://stackoverflow.com/comment/35340483

http://stackoverflow.com/comment/35115011
type: AnswerComment
comment on: http://stackoverflow.com/a/22992630
type: Comment
has text: concatination is fine if you are concatenating multiple things. doubleString = "not empty" + doubleValue;
score: 0

http://stackoverflow.com/a/23003087
upvote count: 2
has comment: http://stackoverflow.com/comment/35134491
answers question: http://stackoverflow.com/q/23001815
accepted answer of: http://stackoverflow.com/q/23001815
type: AcceptedAnswer
downvote count: 0
has body: The side effect of your getFinalScore method is that it alters the finalScore with the return value of getBuddyScore before finally returning. As a result, each call to getFinalScore will increase the value. In your loop, I see you calling that method four times; if you step through the code, you should see four completely different values within the same iteration. I am guessing you want to do this instead? return finalScore + buddy.getBuddyScore();
type: Answer
score: 2

http://stackoverflow.com/q/23047114
answer count: 2
upvote count: 1
has title: JMenu submenu mouse listener didn't listen; action listener did--why?
favorite count: 0
has answer: http://stackoverflow.com/a/23047187
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: mouselistener
tagged with: java
tagged with: jmenu
possible better answer: http://stackoverflow.com/a/28186458
type: Question
tagged with: actionlistener
has answer: http://stackoverflow.com/a/28186458
tagged with: jmenuitem
has body: I just began using JMenu. To ease into it, I decided to use Netbeans form design tool, which has worked great for all components in this app. Clicking a top-level menu item works great. For one menu item, I made a submenu with 3 items, each with a mouse click listener. Here's relevant code for one of the 3 submenus: private JMenuItem mnuEditDicAddAllScratch; mnuEditDicAddAllScratch = new JMenuItem(); private void mnuEditDicAddAllScratchMouseClicked(MouseEvent evt) { new WordsToAdd(); // never happened } mnuEditDicAddAllScratch.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { mnuEditDicAddAllScratchMouseClicked(evt); } }); mnuEdit.add(mnuEditDicAddAllScratch); It didn't work. Clicks ignored. So I tried an Action listener: private void mnuEditDicAddAllScratchActionPerformed(ActionEvent evt) { new WordsToAdd(); // WORKED } mnuEditDicAddAllScratch.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mnuEditDicAddAllScratchActionPerformed(evt); } }); And it worked. So a question is, "Why didn't mouse click listener listen?" Also, "If I should stay away from mouse click events, why or under what circumstances?" (And, pre-emptive strike: I should stay away from Netbeans form designer.)
accepted answer: http://stackoverflow.com/a/23047187

http://stackoverflow.com/comment/35134204
type: QuestionComment
comment on: http://stackoverflow.com/q/23003271
score: 0
has text: It doesn't matter what you're trying to do. You have some expectations. Ask your self why do you have them? It seems like you are expecting to use a `byte[]` as a `String`. Do you see what's wrong with that?
type: Comment

http://stackoverflow.com/q/22984004
type: Question
answer count: 2
tagged with: arrays
has body: I have an method getDiff() in a class called Computation that computes the difference between two values and returns the absolute value of the result as shown below: public int getDiff() { Computation amg = new Computation(); setTemp = 55; dT = (actualMouldTemp - setTemp); AMT = (int) Math.abs(dT); System.out.println("The temperature difference is : "+ AMT); return AMT; } I want the value AMT returned to be stored in an Array then used in further calculations for heating time as as shown below: public double getHeatingTime1() { Controller jose = new Controller(); int[] Results = new int[4]; //Results [] = new int[4]; //Results [] = Computation.class; Q = 3; //heating in kW Cp = 4.2; //Specific heat capacity of water volume = 6; //AMT = System.out.println("AMT IS " + Results[1]); long HT1 = (long) ((volume * Cp * Results[1]) / Q); return HT1; } The problem is that I created an array that stores these results but I am failing to see the value of Results[1] in the method getHeatingTime1() as it is giving me a zero as my heating time and on the print line. How best do I represent such an Array in my code? Thank you I am using the class Computation as the class that handles all calculation for my JADE agents. So what happens is that the values used in getDiff() for the actualMouldTemp is a value returned by the method getAnswer() as show below: public double getAnswer() { TemperatureControlAgent ta = new TemperatureControlAgent(); TemperatureControlAgent.CoolingOrdersServer lp = ta.new CoolingOrdersServer(); int rand1[] = new int[3]; RandomVariableGenerator var = new RandomVariableGenerator(); rand1 = RandomVariableGenerator.getRand(); meltTemp = 245; setTemp = 55; System.out.println("Melt Temp is : "+ meltTemp); //System.out.println("Melt Temp is : "+ MA); actualMouldTemp = (int) ((0 - 51.4)+(0.302 * meltTemp) +(1.64 * rand1[0])+ (0.201 * rand1[1])); System.out.println("The actual mould temperature is :" +actualMouldTemp + " Degrees celcius" ); //getDiff(actualMouldTemp…
has answer: http://stackoverflow.com/a/22984076
has title: Returning a value from a method and storing it into an Array for use on another method
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35099054
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22986081
tagged with: methods

http://stackoverflow.com/comment/35150592
comment on: http://stackoverflow.com/a/23008726
type: Comment
has text: @Arvind one question, I have this error: "parent is not public in Component; cannot be accessed from outside package" when I write this sentence: public void actionPerformed(ActionEvent e) { setVisible(false); parent.setString("this is a test"); dispose(); } Do you know how to solve it?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35202701
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23024907
score: 0
has text: @AndreiStefan - Absolutely - this is actually an exercise in a Spring course I'm taking, and the next step is to code to interfaces. Great catch, though! It appears that this was my error! I haven't coded DepartmentService yet, but I included it in the pointcut.

http://stackoverflow.com/a/23082616
has body: Android's AsyncTask is a generic type. When you need an async task that has no sense of intermediate progress data, you should declare it as MyTask extends AsyncTask&lt;Something, Void, Something&gt; using the class Void as the specification of the Progress type variable, and, following usual generic rules, if you decide to overwrite onProgressUpdate you will have to declare it as onProgressUpdate(Void... values). Hence Void... does not mean anything other than the usual vararg method whose type happened to be Void.
score: 3
downvote count: 0
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23082358
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23082358

http://stackoverflow.com/q/23115424
has body: I'd like to call a specific method on a class given as a parameter like this: public static Entity selectEntityMenu(Class cl){ ArrayList&lt;Entity&gt; allEntities = cl.getAll(); //... All passed in classes (subclasses of Entity) implement the static getAll() method. How can this be realized?
has comment: http://stackoverflow.com/comment/35336280
has answer: http://stackoverflow.com/a/23115862
accepted answer: http://stackoverflow.com/a/23115862
type: AnsweredQuestion
has title: How to call a method on a subclass passed as a paramter?
tagged with: java
type: Question
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/35337130
answer count: 1
has comment: http://stackoverflow.com/comment/35343628

http://stackoverflow.com/q/23028273
accepted answer: http://stackoverflow.com/a/23028380
tagged with: java
tagged with: swing
type: Question
tagged with: jpanel
has answer: http://stackoverflow.com/a/23028335
linked to: http://stackoverflow.com/q/8336262
score: 0
has body: I need to invoke getWidth() on my JPanel object "gameboard" and store it in a variable "width". It would seem like a simple int width = gameboard.getWidth(); However I get an error "cannot reference field before it is defined". Which led me to believe that the wrong object was being referred to, so I changed it to int width = this.gameboard.getWidth(); Now Eclipse shows that gameboard refers to GameBoard Game.gameboard (which is the JPanel object I want), but I get a Exception in thread "AWT-EventQueue-0" Here is some of the code, I hope its enough to explain my situation (all the code is 1000+ lines as its something my professor wrote that he is having us modify). class Game extends JFrame { /* Type your variable declarations here */ // Score of game int score = 0; // Get board size // int width = this.gameboard.getWidth(); // int height = this.gameboard.getHeight(); // Game objects -- Was going to pass width and height variable to these Sprite cat = new Sprite(new ImageIcon("cat.gif").getImage(), 267, 167); Sprite bananas1 = new Sprite(new ImageIcon("bananas.png").getImage(), randomNumber(0, gameboard.getWidth()), randomNumber(0, 480)); Sprite bananas2 = new Sprite(new ImageIcon("bananas.png").getImage(), randomNumber(gameboard.getWidth(),640), randomNumber(0, 480)); ... /** The panel where all of the game's images are rendered */ GameBoard gameboard = null; ... /** * Constructor for the game. * &lt;p&gt; * &lt;pre&gt; * The following tasks are performed: * a frame is displayed on the screen * a clock is created; the clock invoked repaint 15 times per second * a keyboard listener listens for presses of the arrow keys &amp; space bar * &lt;/pre&gt; * &lt;p&gt; */ public Game() { /* how large is the window? */ setSize(640,480); /* if the end-user clicks on the x in the upper right corner, */ /* close this app */ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); /* allow the window to receive the focus; */ /* we want this window to see key presses */ setFocusable(true)…
answer count: 3
tagged with: this
has answer: http://stackoverflow.com/a/23028334
has comment: http://stackoverflow.com/comment/35179954
linked to: http://stackoverflow.com/q/19020702
has title: How to invoke getWidth on a JPanel object
possible better answer: http://stackoverflow.com/a/23028335
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23028380

http://stackoverflow.com/a/23081313
upvote count: 4
downvote count: 0
has body: DD is day in year. You want dd for day in month. See the Javadoc.
score: 4
accepted answer of: http://stackoverflow.com/q/23081215
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23081215
type: Answer

http://stackoverflow.com/q/22990102
has comment: http://stackoverflow.com/comment/35113758
has comment: http://stackoverflow.com/comment/35137208
has body: I am experiencing my first taste in android development. Took me sometime to get the environment set-up and to load the current project. I am reviewing the project and I'm lacking the knowledge in recognizing the basics. I actually referred to the auto-generated AndroidManifest.xml to determine which class started the application and which one initially launches. I reviewed the files inside their respective packages and I am trying to determine which imported libraries are determining this. For the application, I think it's pretty obvious: import android.app.Application; Here is a snippet of the AndroidManifest.xml: &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.nlrt.sanome" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="14" android:targetSdkVersion="18" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt; &lt;!-- TODO: I should look into this warning about allowing backup: Should explicitly set android:allowBackup to true or false (it's true by default, and that can have some security implications for the application's data) --&gt; &lt;application android:theme="@style/sanome_theme" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:name="com.menus.SanoApplication" &gt; &lt;!-- LOGIN --&gt; &lt;activity android:name="com.login.LoginActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysVisible|adjustResize" android:label="@string/title_activity_main_login" &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;!-- MENUS --&gt; &…
answer count: 2
possible better answer: http://stackoverflow.com/a/22991393
has answer: http://stackoverflow.com/a/22990984
downvote count: 0
has answer: http://stackoverflow.com/a/22991393
tagged with: netbeans-7
has comment: http://stackoverflow.com/comment/35113165
favorite count: 0
has comment: http://stackoverflow.com/comment/35110701
tagged with: android
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22990984
has comment: http://stackoverflow.com/comment/35110269
has title: Which Android library determines the application and the activity which initially launches?
score: 1
has comment: http://stackoverflow.com/comment/35110769
tagged with: java
has comment: http://stackoverflow.com/comment/35110127
has comment: http://stackoverflow.com/comment/35110141
type: Question
has comment: http://stackoverflow.com/comment/35113606

http://stackoverflow.com/comment/35312008
comment on: http://stackoverflow.com/q/23101316
score: 0
type: Comment
type: QuestionComment
has text: Well new Date() also has the current time.

http://stackoverflow.com/q/23108934
tagged with: dynamic-jasper
tagged with: struts2
type: Question
has answer: http://stackoverflow.com/a/23111435
favorite count: 0
upvote count: 2
tagged with: maven
answer count: 1
has title: DynamicJasper with Struts 2 integration error
linked to: http://stackoverflow.com/q/17821441
tagged with: java
accepted answer: http://stackoverflow.com/a/23111435
tagged with: jasper-reports
score: 2
type: AnsweredQuestion
downvote count: 0
has body: I am trying to integrate DynamicJasper report with Struts2 in my project. Strut2 (with XWork 2.2.1 jar) is already using JasperReports (version 4.7.1). As per the official dynamic jasper reports documention I have added DynamicJasper (version 5.0.0) and for Struts 2 integration added the dependency DynamicJasper-Struts2 (version 1.3) the latest available version. I have the following error thrown during execution org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [default] in context with path [/proj] threw exception [Filter execution threw an exception] with root cause java.lang.NoSuchMethodError: com.opensymphony.xwork2.ActionContext.get(Ljava/lang/Object;)Ljava/lang/Object; at ar.com.fdvs.dj.struts2.DJStruts2Result.doExecute(DJStruts2Result.java:138) at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122) at com.opensymphony.xwork2.DefaultActionInvocation.invoke…

http://stackoverflow.com/comment/35243412
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22970837
has text: Possibly, you should just post it as another question though as I might not be able to help you immediately.
score: 0

http://stackoverflow.com/a/23047975
has comment: http://stackoverflow.com/comment/35216331
answers question: http://stackoverflow.com/q/23023100
has comment: http://stackoverflow.com/comment/35216238
accepted answer of: http://stackoverflow.com/q/23023100
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: I've just tested your resource and there's nothing wrong with that. I don't see what you're benefiting from in extending ResourceConfig and using that as an init-param (you may of course be doing a lot more than this example). I would scrap that and just add the following as the only init-param which pulls your Resource in directly. jersey.config.server.provider.classnames com.adaequare.resource.Hello (You can also use "jersey.config.server.provider.packages" and specify the package name if you'd prefer) Also, I always find the Jersey monitoring statistics enabled via mbeans really helpful in determining if my resources have been properly deployed. To do so, add the following init-param, start jconsole (in the java/bin dir) and connect to the process - jersey offers a lot of information on deployed resources jersey.config.server.monitoring.statistics.mbeans.enabled true Finally, see this for an example using Jetty (this test server is what I plugged your resource in to test with)
has comment: http://stackoverflow.com/comment/35216311
has comment: http://stackoverflow.com/comment/35264890

http://stackoverflow.com/comment/35190775
has text: Several options here. One is: remove the current declaration of `final int i = 0;`, and instead, add a declaration of `int i=0;` *before* the `handle...` method (so that `i` is a field of the anonymous EventHandler class).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23033221
score: 0

http://stackoverflow.com/q/23039600
tagged with: jframe
tagged with: swing
accepted answer: http://stackoverflow.com/a/23039854
has title: How to set a JFrame location beside another JFrame?
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35200828
type: Question
linked to: http://stackoverflow.com/q/9554636
tagged with: location
tagged with: layout
has body: In Java, how could I set a JFrame to automatically go beside another JFrame? So, say I have two JFrame objects, frameA and frameB, and when the program runs, it sets frameAs location to be in the middle of the screen by using: setLocationRelativeTo(null); Now what I want is to make frameB to be on the right side of frameA, so they would be right beside each other. (frameAs right side would be touching frameBs left side) How would you do this?
answer count: 2
has answer: http://stackoverflow.com/a/23039642
has comment: http://stackoverflow.com/comment/35200809
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23039854
possible better answer: http://stackoverflow.com/a/23039642

http://stackoverflow.com/q/23128165
upvote count: 1
has title: Java: Get Value of an object and parse it as a long
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/35359366
score: 1
tagged with: long-integer
tagged with: java
has answer: http://stackoverflow.com/a/23128259
has answer: http://stackoverflow.com/a/23128203
has answer: http://stackoverflow.com/a/23128336
has body: I have an object which its first field is a number (BigDecimal, int...). I want to parse it to a long but when parsing it it says that the method "ValueOf" is not applicable for Object. I have tried this. if (list != null && !list.isEmpty()) { for (Object[] obj : list) { Object obj1 = obj[0]; Dto dto= new Dto(); dto.setId(Long.valueOf((obj[0]))); But there is an error
downvote count: 0
has comment: http://stackoverflow.com/comment/35359324
favorite count: 0
answer count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35359465

binary
tags question: http://stackoverflow.com/q/22971805
tags question: http://stackoverflow.com/q/23121982
tags question: http://stackoverflow.com/q/22987107
tags question: http://stackoverflow.com/q/23095004
tag name: binary
tags question: http://stackoverflow.com/q/23082517
tags question: http://stackoverflow.com/q/23123656
tags question: http://stackoverflow.com/q/22997087
type: Tag

http://stackoverflow.com/comment/35176923
has text: Sorry I haven't, ill take a look at it next time!
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23026264
type: QuestionComment

http://stackoverflow.com/comment/35277518
comment on: http://stackoverflow.com/q/23082104
has text: This may be the way, I used profile once to set the filter. This linked document says that profiles can be used to alter plugins and other POM parts. But I miss HOW section. I am maven newbie. Shall I in //profiles/profile specify maven-war-plugin configuration?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35244734
type: AnswerComment
score: 0
type: Comment
has text: Thanks, the two versions are already in two differnet workspaces, otherwise eclipse would claim that the project cannot be imported, because already existing (in that workspace).
comment on: http://stackoverflow.com/a/23063998

http://stackoverflow.com/comment/35180594
type: AnswerComment
comment on: http://stackoverflow.com/a/23028380
score: 0
type: Comment
has text: It really makes little difference, until the frame is realised (made visible on the screen) and the `GameBoard` is laid out, `getWidth` and `getHeight` will return `0`. You need to be able to determine when this state changes.

http://stackoverflow.com/q/23026969
has comment: http://stackoverflow.com/comment/35219953
tagged with: eclipse
has answer: http://stackoverflow.com/a/24195376
has comment: http://stackoverflow.com/comment/35303916
has comment: http://stackoverflow.com/comment/35270322
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has title: How to prevent a View from loading multiple times after the first call?
type: Question
has comment: http://stackoverflow.com/comment/35219821
has comment: http://stackoverflow.com/comment/35219919
accepted answer: http://stackoverflow.com/a/24195376
has comment: http://stackoverflow.com/comment/35219207
has comment: http://stackoverflow.com/comment/35219839
upvote count: 2
has comment: http://stackoverflow.com/comment/35215355
answer count: 1
tagged with: gwt
has comment: http://stackoverflow.com/comment/35220000
has comment: http://stackoverflow.com/comment/35207102
tagged with: java
has body: When I open "EditAwardsView1" for the first time the Window.alert displays once. I enter data, select the "Save" button and my save to the DB occurs once. So far so good. However, I then go back to the previous view "SelectPerson" and then open "EditAwardsView1" a second time. This time Window.alert displays twice and I get one "Uncaught exception escaped" error. I enter data, select the "Save" button and my save to the DB occurs twice. If I repeat this again (go back to "SelectPerson" and then back to "EditAwardsView1") Window.alert displays five times and I get four "Uncaught exception escaped" errors. I enter data, select the "Save" button and my save to the DB occurs five times. The calling code from the "SelectPerson" view is: btnEditAward.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { navHandler2.go("EditAwards1"); } }); btnEditAward.setStyleName("gwt-PushButton-up"); btnEditAward.setText("Edit Awards"); btnEditAward.setWidth("184px"); btnEditAward.setHeight("40px"); horizontalPanel.add(btnEditAward); The entry point in "EditAwards1" is: public EditAwardsView1(final NavHandler navHandler) { rpc = (DBConnectionAsync) GWT.create(DBConnection.class); ServiceDefTarget target = (ServiceDefTarget) rpc; String moduleRelativeURL = GWT.getModuleBaseURL() + "MySQLConnection"; target.setServiceEntryPoint(moduleRelativeURL); navHandler2 = navHandler; //On load of page get the stored view data //TODO Fix null pointer on reload. verticalPanel.addAttachHandler(new Handler() { int pog = 0; public void onAttachOrDetach(AttachEvent event) { if (pog == 0) { pog++; verticalPanel.clear(); listBoxAwardType.clear(); awardGrouped = null; Window.alert("EditAwardsView1."); //Retrieve stored data for this view. AsyncCallback&lt;ViewData&gt; callback = new ViewDataHandler2&lt;ViewData&gt;(EditAwardsView1.this); rpc.getViewData(callback); }else{ pog = 0; } } }); initWidget(verticalPanel); } The calling code from "EditAwardsView1" to return to the "SelectPerso…

http://stackoverflow.com/comment/35074232
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22969946
has text: possible duplicate of [How to run maven from java?](http://stackoverflow.com/questions/5141788/how-to-run-maven-from-java)

http://stackoverflow.com/a/23051216
type: AcceptedAnswer
upvote count: 9
has body: To return the correct http status code, your exception mapper could look something like this: @Provider public class RestExceptionMapper implements ExceptionMapper&lt;Throwable&gt; { private static final Logger log = LoggerFactory.getLogger(RestExceptionMapper.class); @Override public Response toResponse(Throwable exception) { log.error("toResponse() caught exception", exception); return Response.status(getStatusCode(exception)) .entity(getEntity(exception)) .build(); } /* * Get appropriate HTTP status code for an exception. */ private int getStatusCode(Throwable exception) { if (exception instanceof WebApplicationException) { return ((WebApplicationException)exception).getResponse().getStatus(); } return Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(); } /* * Get response body for an exception. */ private Object getEntity(Throwable exception) { // return stack trace for debugging (probably don't want this in prod...) StringWriter errorMsg = new StringWriter(); exception.printStackTrace(new PrintWriter(errorMsg)); return errorMsg.toString(); } } Also it sounds like you are interested in cascading exception mappers, but according to the spec this isn't possible: JAX-RS 2.0 Spec, Chapter 4.4 "Exception mapping providers map a checked or runtime exception to an instance of Response. An exception mapping provider implements the ExceptionMapper interface and may be annotated with @Provider for automatic discovery. When choosing an exception mapping provider to map an exception, an implementation MUST use the provider whose generic type is the nearest superclass of the exception. When a resource class or provider method throws an exception for which there is an exception mapping provider, the matching provider is used to obtain a Response instance. The resulting Response is processed as if a web resource method had returned the Response, see Section 3.3.3. In particular, a mapped Response MUST be processed using the ContainerResponse filter chain defined in Chapter …
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23048212
answers question: http://stackoverflow.com/q/23048212
score: 9

http://stackoverflow.com/q/23012293
has comment: http://stackoverflow.com/comment/35171326
has comment: http://stackoverflow.com/comment/35150673
has answer: http://stackoverflow.com/a/23012444
accepted answer: http://stackoverflow.com/a/23012444
tagged with: policy
has comment: http://stackoverflow.com/comment/35172780
has body: I have a java rmi server and a java rmi client in two separate and different machines. The server is basically a fibonacy calculator. It receives a bunch of numbers and calculates a Fibonacci sequence based on them. The client simply sends a bunch of numbers for the server to calculate. The FiboServer project consists of three classes: IFibonacci.java: an interface Fibonacci.java: implements the previously defined interface FibonacciServer.java: Has the main, and runs the server FibonacciServer.java: package fiboserver; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; public class FibonacciServer { public static void main(String args[]){ if (System.getSecurityManager() == null) { System.setProperty("java.security.policy", "server.policy"); System.setSecurityManager(new SecurityManager()); } try{ IFibonacci fib = new Fibonacci(); // Bind the remote object's stub in the registry Registry registry = LocateRegistry.createRegistry(1099); registry.rebind("fibonacci", fib); System.out.println("Fibonacci Server ready."); }catch(RemoteException rex){ System.err.println("Exception in Fibonacci.main " + rex); } } } The client project merely has one class: FibonacciClient.java. FibonacciClient.java: package fiboclient; import fiboserver.IFibonacci; import java.math.BigInteger; import java.rmi.NotBoundException; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; public class FibonacciClient { public static void main(String[] args) { if (System.getSecurityManager() == null) { System.setProperty("java.security.policy", "client.policy"); System.setSecurityManager(new SecurityManager()); } try{ //args[0] = server Public IP Registry registry = LocateRegistry.getRegistry(args[0]); IFibonacci calculator = (IFibonacci) registry.lookup("fibonacci"); //the rest of the args are just numbers to calculate for(int i = 1; i &lt; args.length; i++){ try{ BigInteger index = new Bi…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35150422
has comment: http://stackoverflow.com/comment/35172863
tagged with: rmi
tagged with: java
has comment: http://stackoverflow.com/comment/35153072
has comment: http://stackoverflow.com/comment/35151565
has comment: http://stackoverflow.com/comment/35150235
type: Question
has title: RMI client cannot lookup server - java.rmi.UnmarshalException
has comment: http://stackoverflow.com/comment/35150469
has comment: http://stackoverflow.com/comment/35151607
answer count: 1
has comment: http://stackoverflow.com/comment/35152747
has comment: http://stackoverflow.com/comment/35150320
has comment: http://stackoverflow.com/comment/35150536
score: 0

http://stackoverflow.com/q/23066544
accepted answer: http://stackoverflow.com/a/23070487
has comment: http://stackoverflow.com/comment/35256897
has comment: http://stackoverflow.com/comment/35258069
tagged with: subprocess
upvote count: 3
has comment: http://stackoverflow.com/comment/35257089
downvote count: 2
has title: Executing a process in Java with a password
type: AnsweredQuestion
score: 1
tagged with: java
has body: I have a process which needs to be run through Java and, unfortunately the password needs to be given to the process in plain-text. Since the event is so transient and we are working behind massive firewalls, I am actually not worried about the password being transmitted to a subprocess like this. What I am a little worried about is that the Process and ProcessBuilder classes only take commands as String objects, not char[] arrays. So, I have to rely on the garbage collector to destroy the String objects at its discretion, allowing someone to possibly take a heap dump of my program later and get a password. Its a remote possibility, but I am looking for: A better way to start a sub process that does not use String objects, but char[] A way to ensure a String object is properly destroyed after it is used. (Just to note, due to how this process takes in commands, submitting the password with the inital command is the only way to interact with the sub-process -- see this: Java seems to be sending carriage returns to a sub-process? comments section in original post) NOTE- The password is not going to the Main() function via commandline. The password is collected using swing JPasswordField, then being written to the ProcessBuilder command array. IDEA-- I wonder if there is a way through reflection to get the private final char[] value from the String and erase it?
has answer: http://stackoverflow.com/a/23070487
possible better answer: http://stackoverflow.com/a/23066997
tagged with: memory
has answer: http://stackoverflow.com/a/23066997
type: Question
has comment: http://stackoverflow.com/comment/35257619
answer count: 2
tagged with: string
favorite count: 0
tagged with: security
linked to: http://stackoverflow.com/q/22970688

http://stackoverflow.com/a/33970760
accepted answer of: http://stackoverflow.com/q/22986667
downvote count: 0
score: 1
has body: The JDBC-ODBC Bridge has been removed from Java 8. For an alternative, see the related question here: Manipulating an Access database from Java without ODBC
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22986667
type: Answer

http://stackoverflow.com/a/23103243
score: 4
has comment: http://stackoverflow.com/comment/35322374
has body: Ensure your object has a copy constructor that allows you to make a deeply-cloned copy of your class. Then call this when you return the object, e.g. SomeClass instance = // .... public SomeClass getInstance() { return new SomeClass(instance); } This won't make the returned object immutable. But it doesn't need to be - you just don't want the external code making changes to your copy of the data.
has comment: http://stackoverflow.com/comment/35338998
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/23103158
accepted answer of: http://stackoverflow.com/q/23103158
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22994379
answers question: http://stackoverflow.com/q/22972094
has body: I was forgetting about the "package" declaration at the top of the file. According to the Java Language Specification: 7.4.2. Unnamed Packages A compilation unit that has no package declaration is part of an unnamed package. Unnamed packages are provided by the Java SE platform principally for convenience when developing small or temporary applications or when just beginning development. An unnamed package cannot have subpackages, since the syntax of a package declaration always includes a reference to a named top level package. So, adding the following line solved the issue: package my.project.path.example;
score: 0
type: Answer

http://stackoverflow.com/q/23001085
has answer: http://stackoverflow.com/a/23001140
has comment: http://stackoverflow.com/comment/35130462
upvote count: 0
answer count: 1
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/35131069
tagged with: byte
has title: Coverting String to byte in Java
tagged with: hex
has body: Having: byte temp; and a String which represents a binary number: String binary = "00100100"; I want to convert this binary number to hex and store it in byte, so: as 00100100 binary equals 24 hex, I want to obtain: temp = 24; or temp = 0x24;
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35130433
downvote count: 1
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/35130314
type: Question

http://stackoverflow.com/q/23025363
tagged with: java-8
has body: It seems like getAnnotatedParameterTypes() returns an array of AnnotatedTypes holding raw, rather than generic, types. For example: public &lt;T&gt; void genericMethod(T t) { } @Test public void testAnnotatedTypes() throws ReflectiveOperationException { Method method = getClass().getMethod("genericMethod", Object.class); Type type = method.getGenericParameterTypes()[0]; assertTrue(type instanceof TypeVariable); AnnotatedType annotatedType = method.getAnnotatedParameterTypes()[0]; // This fails; annotatedType implements only AnnotatedType assertTrue(annotatedType instanceof AnnotatedTypeVariable); // This fails too; type is a TypeVariable while annotatedType.getType() is // Object.class assertEquals(type, annotatedType.getType()); } What's the reason for the disagreement with getGenericParameterTypes()?
has comment: http://stackoverflow.com/comment/35185714
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23066816
has comment: http://stackoverflow.com/comment/35245082
downvote count: 0
tagged with: reflection
tagged with: java
has title: How to get generic type information from getAnnotatedParameterTypes() in Java 8?
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/23066816
has comment: http://stackoverflow.com/comment/35176125
answer count: 1
tagged with: generics
tagged with: type-annotation
favorite count: 0
score: 8

http://stackoverflow.com/comment/35128202
has text: @user3521306: no, I misread your previous comment. Yes, it would mean invoking the Cat Constructor, and ***no*** the interface should ***not*** extend Cat. In no way. That would be a gross misuse of inheritance. If you want to pass a Cat instance into the interface, then do so, but never have the GUI extend the model.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22999301

http://stackoverflow.com/comment/35311415
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23089633
score: 0
has text: sorry I forgot the "m" -Xms4048m -Xmx8048m

http://stackoverflow.com/q/23038024
has comment: http://stackoverflow.com/comment/35198537
has comment: http://stackoverflow.com/comment/35197900
answer count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/35197885
has answer: http://stackoverflow.com/a/23038217
has comment: http://stackoverflow.com/comment/35198442
favorite count: 0
tagged with: arraylist
upvote count: 3
has comment: http://stackoverflow.com/comment/35198008
possible better answer: http://stackoverflow.com/a/23038217
has comment: http://stackoverflow.com/comment/35198515
has comment: http://stackoverflow.com/comment/35197927
score: 2
has comment: http://stackoverflow.com/comment/35198031
has comment: http://stackoverflow.com/comment/35198067
has comment: http://stackoverflow.com/comment/35197934
has comment: http://stackoverflow.com/comment/35197939
has comment: http://stackoverflow.com/comment/35198558
has comment: http://stackoverflow.com/comment/35197787
has comment: http://stackoverflow.com/comment/35197958
tagged with: jradiobutton
has body: I've come to the conclusion that I have 3 questions. How do I use the variables and arrayList of the company class in the Employee class. How should I make the actionListeners so the operate correctly. Would the methods in the Company class work correctly? If not, how should I make them? Check the link given in the paragraph above for the prompt to my question. Here is a link to the prompt my professor has provided https://www.dropbox.com/s/omeg19u6ns2pot2/Work%205.doc so you guys can see what I am trying to reach. I would usually get help from the tutors but they aren't available at this time in particular. Help is really, really highly appreciated. I have to finish this by tonight. I know this is a bit too much for this website but it is the only way you can get a good grasp on what is happening. I have already started a post on this problem and moved a bit further but no one is replyting to my questions on that post anymore so I am doing another one. Here is the GUI aka the driver import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.util.ArrayList; public class GUI extends JFrame { private JPanel employeePanel; private JPanel buttonPanel2; private JPanel positionPanel; private JPanel namePanel2; private JPanel buttonPanel1; private JPanel upperLine; private JPanel lowerLine; private JPanel companyAndPresidentPanel; private JPanel companyPanel; private JRadioButton designButton; private JRadioButton salesButton; private JRadioButton manuButton; private JTextField firstField; private JTextField lastField; private JLabel firstLabel; private JLabel lastLabel; private JLabel cNameLabel; private JLabel presidentLabel; private JLabel logo; private ButtonGroup bGroup; private static final long serialVersionUID = 1L; Company c; Employee e; private JButton addButton; private JButton clearButton; private JButton printButton; private JButton newButton; private JButton exitButton; String companyName; public GUI() { companyName = JOptionPane.showInputD…
type: AnsweredQuestion
has title: Java trouble with ArrayLists when there are multiple classes and help fixing up the code
tagged with: enums
has answer: http://stackoverflow.com/a/23038270
accepted answer: http://stackoverflow.com/a/23038270
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/35198225
has comment: http://stackoverflow.com/comment/35197995
type: Question
has comment: http://stackoverflow.com/comment/35198528

http://stackoverflow.com/comment/35086241
type: QuestionComment
has text: `act` isn't how you put `arpt` in alphabetical order.
comment on: http://stackoverflow.com/q/22976541
type: Comment
score: 1

http://stackoverflow.com/comment/35287291
score: 0
type: AnswerComment
type: Comment
has text: About that composition example: Unluckily I don't have any influence on `class Vehicle` and its descendants... If I had, I wouldn't find a problem at all.
comment on: http://stackoverflow.com/a/23087409

http://stackoverflow.com/comment/35374517
has text: Hey, thank you for your reply. I have not had use for Exception Translation until now, so I am rather unfamiliar with it. However, I have been doing enough reading and am still unable to get the Translator to actually get invoked. I have followed the steps outlined above, any thing that would be missing outside the scope of your response?
comment on: http://stackoverflow.com/a/23106398
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22987243
score: 1
has comment: http://stackoverflow.com/comment/35112422
downvote count: 0
has body: All pom implicitly inherit from super pom which is present in the maven distribution. This pom contains defaults for all maven projects which can be overriden in your maven project. But most of these defaults are not overridden as they typically form the convention part of maven as it is a build tool geared more towards convention. For e.g., the default build directory is target and hence this configuration is present in super pom as ........ ${project.basedir}/target ......... For more information and actual location of this pom please refer here and here
has comment: http://stackoverflow.com/comment/35113348
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35112074
answers question: http://stackoverflow.com/q/22986898

http://stackoverflow.com/comment/35408587
type: Comment
has text: @user3505394 Glad to have helped. Upvote is the accepted way of saying "Thanks" here, but you're welcome ;)
comment on: http://stackoverflow.com/a/23129068
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35225435
type: Comment
has text: Initially I indexed with double. Then I changed tdouble and restarted server. I didn't reindex.
comment on: http://stackoverflow.com/q/23052836
score: 0
type: QuestionComment

http://stackoverflow.com/q/22982635
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/22983163
tagged with: templates
has body: I have used JSF templating in the following manner: TemplateHeader.xhtml <h:head> TODO supply a title </h:head> <h:body> <ui:composition> </ui:composition> </h:body> TemplateMenu.xhtml <h:head> TODO supply a title </h:head> <h:body> <ui:composition> </ui:composition> </h:body> TemplateContent.xhtml <?xml version="1.0" encoding="UTF-8"?> <h:head> TODO supply a title </h:head> <h:body> <ui:composition> </ui:composition> </h:body> TemplateFooter.xhtml <h:head> TODO supply a title </h:head> <h:body> <ui:composition> </ui:composition> </h:body> Then i have included all of this in a complete template file: CompleteTemplate.xhtml // with all the necessary tags as above <h:head> State Transport Department- Work Schedule </h:head> <h:body style="with the reqd styles"> <ui:insert name="header"> <ui:include src="/webpages/templates/TemplateHeader.xhtml"/> </ui:insert> <ui:insert name="menu"> <ui:include src="/webpages/templates/TemplateMenu.xhtml"/> </ui:insert> <ui:insert name="content"> <ui:include src="/webpages/templates/TemplateContent.xhtml"/> </ui:insert> <ui:insert name="footer"> <ui:include src="/webpages/templates/TemplateFooter.xhtml"/> </ui:insert> </h:body> Then i included this page into my main pages for example: Test.xhtml <h:body> <h:form> <ui:composition template="/webpages/templates/CompleteTemplate.xhtml"> <ui:define name="menu"> //override the previos wid menues etc </ui:define> <ui:define name="content"> <h:commandLink id="allocateButton" value="Test Submit" action="#{myTaskBean.viewMyTask}"/> <h:commandButton id="allocateButton" value="Test Submit" action="#{empDutySchedBean.testMethod}"/> </ui:define> </ui:composition> </h:form> </h:body> All the commandLinks and commandButttons were not working. Normal html anchor used for menu worked. For CommandLink I got error as: This link is disabled as it is not nested within a JSF form. for CommandButton: the button's name in the source code doesn't render to the inbuild jsf one like j_something and it doesn't in…
has title: After using Template (jsf) in my xhtml, the commandLink and CommandButton tags are not invoking any action
possible better answer: http://stackoverflow.com/a/22983033
type: AnsweredQuestion
tagged with: jsf
has answer: http://stackoverflow.com/a/22983033
tagged with: java
linked to: http://stackoverflow.com/q/4792862
has answer: http://stackoverflow.com/a/22983163
type: Question
tagged with: jsf-2
answer count: 2
duplicate of: http://stackoverflow.com/q/4792862
linked to: http://stackoverflow.com/q/23008471
score: 0

http://stackoverflow.com/comment/35135044
has text: BinaryResponseWriter is not part of SolrJ library. So I can't use it.
comment on: http://stackoverflow.com/a/22982903
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/22973139
has comment: http://stackoverflow.com/comment/35080213
answers question: http://stackoverflow.com/q/22972938
accepted answer of: http://stackoverflow.com/q/22972938
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35080161
type: Answer
has body: While not a 'non blocking' unit test, you can use Awaitility to create polling intervals, and a maximum wait time within JUnit. Very useful for tests which depend on async results. You can set the polling time to something small, say 10 milis, and a maximum duration. Every 10 miliseconds your method to evaluate some condition will be fired. It will continue to be invoked until the condition returns true, or the maximum time allowable is hit. At that point it will throw an exception, failing the unit test. http://code.google.com/p/awaitility/

http://stackoverflow.com/q/23038682
has comment: http://stackoverflow.com/comment/35199280
tagged with: multithreading
tagged with: android
score: 34
upvote count: 34
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35199226
type: Question
has title: java.lang.RuntimeException: Only one Looper may be created per thread
has answer: http://stackoverflow.com/a/24115631
has answer: http://stackoverflow.com/a/37407674
has comment: http://stackoverflow.com/comment/35199193
has comment: http://stackoverflow.com/comment/35199068
accepted answer: http://stackoverflow.com/a/24115631
possible better answer: http://stackoverflow.com/a/37407674
answer count: 2
downvote count: 0
favorite count: 0
has body: I have a simple thread that goes like this: public class AwesomeRunnable extends Thread { Handler thisHandler = null; Handler uihandler = null; String update = null; long time = 0; public AwesomeRunnable(Handler h, long howLong) { uihandler = h; time = howLong; } public void run() { Looper.prepare(); thisHandler = new Handler(); ... EDIT: ADDED CODE THAT STARTS THE RUNNABLE public class StartCycle implements Runnable { @Override public void run() { pomodoroLeft = numPomodoro; while(pomodoroLeft &gt; 0) { pomodoroLeft--; actualSeconds = 6 * ONE_SECOND; runnable = new AwesomeRunnable(myHandler, actualSeconds); runnable.start(); waitForClock(); It is an inner class of a main activity. This thread, however runs not on the main activity, but inside of another thread that runs on the main activity. Anyway, this example is exactly the same as here, but for some reason it gives me java.lang.RuntimeException: Only one Looper may be created per thread. I did not create any other loopers, at least explicitly anywhere.
has comment: http://stackoverflow.com/comment/35199834

http://stackoverflow.com/q/23044197
has title: XML Parsing Error - Hibernate
score: 0
has body: I am trying to run my first Hibernate Program. I can't figure out the problem, because the matching end-tag is actually there? Thanks for your help in advance! Error parsing XML: /hibernate.cfg.xml(11) The element type "session-factory" must be terminated by the matching end-tag hibernate.cfg.xml: <?xml version='1.0' encoding='UTF-8'?> <hibernate-configuration> com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/westbahn root secretpassword org.hibernate.dialect.MySQLInnoDBDialect 1 org.hibernate.dialect.MySQLInnoDBDialect" true thread org.hibernate.transaction.JDBCTransactionFactory create </hibernate-configuration>
has answer: http://stackoverflow.com/a/23044293
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35208308
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35208291
has answer: http://stackoverflow.com/a/23044298
tagged with: mysql
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35208208

http://stackoverflow.com/q/22968913
has comment: http://stackoverflow.com/comment/35071867
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/35073081
type: Question
has body: While getting a JSON response from my restful service implemented in JAVA, I am observing that the long data type values ending with 01 are rounded off to 00. For example: the long values, 12345123459876501 is returned as 12345123459876500 (last digit rounded to 0) 12345123459876502 is returned as 12345123459876502 12345123451234501 is returned as 12345123451234500 (last digit rounded to 0) 12345123451234502 is returned as 12345123451234502 Could anybody help me understand why only the values ending with 01 are getting rounded to 00?
has comment: http://stackoverflow.com/comment/35081513
has title: java long values rounded off in json response
linked to: http://stackoverflow.com/q/307179
has comment: http://stackoverflow.com/comment/35075010
upvote count: 6
has comment: http://stackoverflow.com/comment/35072487
has answer: http://stackoverflow.com/a/22971265
has comment: http://stackoverflow.com/comment/35072516
answer count: 1
has comment: http://stackoverflow.com/comment/35072222
favorite count: 0
has comment: http://stackoverflow.com/comment/35072136
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/35081483
has comment: http://stackoverflow.com/comment/35072234

http://stackoverflow.com/comment/35229280
comment on: http://stackoverflow.com/q/23055364
has text: In my situation, the Account class can have multiple users and an user can have just one account. I want to indicate this relationship via JPA annotations and I am really confused on how to do this correctly.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35231745
comment on: http://stackoverflow.com/q/23057064
type: Comment
type: QuestionComment
score: 0
has text: And what is your current code?

http://stackoverflow.com/a/23016242
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/35158321
has body: To answer the actual question in your question, yes, increasing those values will temporarily solve the GC Overhead problem. But instead of seeing that mysterious error one a week, you might see it once a month, or once every other month. This type of behaviour is incredibly indicative of having a memory leak in java. "But I thought you couldn't have memory leaks in java?" wrong. It's somewhat difficult to create a c/c++ type-memory leak in java, but it's certainly possibly to duplicate the behaviour, and the same unfortunate effect, in java. see Creating a memory leak with Java for more information on that. I highly recommend re-assessing what's going on in that program that's causing the GC overhead limit, and address it there.
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/35158747
answers question: http://stackoverflow.com/q/23016040

jaxb
tags question: http://stackoverflow.com/q/22996135
tags question: http://stackoverflow.com/q/23057774
tags question: http://stackoverflow.com/q/23006407
tags question: http://stackoverflow.com/q/23029413
tags question: http://stackoverflow.com/q/23110212
tags question: http://stackoverflow.com/q/23060120
tags question: http://stackoverflow.com/q/23034130
tags question: http://stackoverflow.com/q/23082354
tags question: http://stackoverflow.com/q/23057726
tags question: http://stackoverflow.com/q/23005458
tags question: http://stackoverflow.com/q/22998461
tags question: http://stackoverflow.com/q/23086607
tags question: http://stackoverflow.com/q/23090905
tags question: http://stackoverflow.com/q/23016557
type: Tag
tags question: http://stackoverflow.com/q/22990806
tag name: jaxb
tags question: http://stackoverflow.com/q/22982285
tags question: http://stackoverflow.com/q/23072404
tags question: http://stackoverflow.com/q/23071450
tags question: http://stackoverflow.com/q/23023599
tags question: http://stackoverflow.com/q/23085787
tags question: http://stackoverflow.com/q/23077971
tags question: http://stackoverflow.com/q/23003505

http://stackoverflow.com/q/22972979
has answer: http://stackoverflow.com/a/22973661
tagged with: android-annotations
has body: I am trying to setResult on my "Register" Button, but nothing happens: SignInActivity: Start activity for result: Intent intent = RegisterActivity_.intent(this).get(); this.startActivityForResult(intent, REQUEST_CODE_USER_REGISTER); On Activity Result @OnActivityResult(REQUEST_CODE_USER_REGISTER) protected void onResult(int resultCode) { if (resultCode == RESULT_OK) DashboardActivity_.intent(this).start(); else if (resultCode == RESULT_CANCELED) { this.showDialogAlert("Unexpected error", null); } RegisterActivity: this.setResult(RESULT_OK); I am using AndroidAnnotations and I'm not using the this.finish() method because it set the property android:noHistory="true" in all Activities on AndroidManifest.xml. I am also setting the parent of each activity there. Have tried to remove these settings and setResult continued without work. Has anyone experienced this?
possible better answer: http://stackoverflow.com/a/22973661
accepted answer: http://stackoverflow.com/a/22980042
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/22973249
favorite count: 0
tagged with: android
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/22980042
tagged with: java
has title: setResult does not work on @EActivity
upvote count: 1
type: Question

http://stackoverflow.com/comment/35219448
comment on: http://stackoverflow.com/q/23049565
type: Comment
type: QuestionComment
has text: I would question your object model. Do you really need all these drug-class classes? Normally inheritance is only used for imaginary computing objects like connections, not for real-world objects. Apart from teaching examples like Animal/DogCat, you never see this sort of thing in real code. What happens if they come up with another drug class? Is there really anything different about the various drug-class classes? I would just have a single DrugClass class, with a name property and three other properties for whatever you're reading from the file. The n all this reduces to about five lines.
score: 0

http://stackoverflow.com/q/23040387
has answer: http://stackoverflow.com/a/23055522
score: -1
answer count: 1
favorite count: 0
has title: Error 86 This method requires a GET or HEAD using Bearer token on Twitter Rest API 1.1 using Java in AppEngine
type: UnansweredQuestion
tagged with: google-app-engine
has body: I have my bearerToken and userID as per Twitter instructions https://dev.twitter.com/docs/auth/application-only-auth and I want t get a list of followers. I'm getting error 86, which isn't on the list of error codes https://dev.twitter.com/docs/error-codes-responses Any pointers would be appreciated. public String getTwitterFriends(String userID, String bearerToken) { // Use App Bearer token to get public friends String answer = ""; String param = "count=5000&amp;cursor=-1&amp;user_id=" + userID; HttpURLConnection connection = null; try { // String request = // "https://api.twitter.com:443/1.1/friends/ids.json?" + param; String request = "https://api.twitter.com/1.1/friends/ids.json?" + param; URL url = new URL(request); connection = (HttpURLConnection) url.openConnection(); System.setProperty("http.keepAlive", false ? "true" : "false"); connection.setDoOutput(true); connection.setDoInput(true); connection.setRequestMethod("GET"); // connection.setRequestProperty("Host", "api.twitter.com" + // ":443"); connection.setRequestProperty("Host", "api.twitter.com"); connection.setRequestProperty("Accept", "*/*"); connection.setRequestProperty("Authorization", "Bearer " + bearerToken); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); connection.setRequestProperty("User-Agent", "UnhappyChappy"); // connection.setRequestProperty("Accept-Encoding", "gzip"); // connection.setRequestProperty("Content-Length", "" + // Integer.toString(param.getBytes().length)); connection.setUseCaches(false); DataOutputStream wr = new DataOutputStream( connection.getOutputStream()); // wr.writeBytes(param); wr.flush(); wr.close(); BufferedReader reader = new BufferedReader(new InputStreamReader( connection.getInputStream())); String line; StringBuilder str = new StringBuilder(); while ((line = reader.readLine()) != null) { System.out.println(line); str.append(line); } reader.close(); connection.disconnect(); answer = str.toString(); } catch (Malfor…
tagged with: java
tagged with: twitter
downvote count: 1
type: Question
upvote count: 0

http://stackoverflow.com/q/23091528
has answer: http://stackoverflow.com/a/23091713
has comment: http://stackoverflow.com/comment/35294669
type: Question
tagged with: rounding
tagged with: java
tagged with: bigdecimal
has title: Java BigDecimal Rounding
answer count: 2
score: 0
has body: I am learning BigDecimal and i want it to retrieve the exact number i entered, the following code is rouding the number and i dont know why public static BigDecimal parseFromNumberString(String numberString) { if (numberString != null) { String nonSpacedString = numberString.replaceAll("[ \\t\\n\\x0B\\f\\r]", "").replaceAll("%", ""); int indexOfComma = nonSpacedString.indexOf(','); int indexOfDot = nonSpacedString.indexOf('.'); NumberFormat format = null; if (indexOfComma &lt; indexOfDot) { nonSpacedString = nonSpacedString.replaceAll("[,]", ""); format = new DecimalFormat("##.#"); } else if (indexOfComma &gt; indexOfDot) { nonSpacedString = nonSpacedString.replaceAll("[.]", ""); DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(); otherSymbols.setDecimalSeparator(','); format = new DecimalFormat("##,#", otherSymbols); } else { format = new DecimalFormat(); } try { return new BigDecimal(format.parse(nonSpacedString).doubleValue(), new MathContext(12)); } catch (ParseException e) { // unrecognized number format return null; } } return null; } If i do something like public static void main(String[] args){ BigDecimal d = Test.parseFromNumberString("0.39"); System.out.println(d); } The value printed is 0,00 and not 0.39
has answer: http://stackoverflow.com/a/33113963
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35294556

http://stackoverflow.com/q/23085301
type: Question
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/23086018
answer count: 1
accepted answer: http://stackoverflow.com/a/23086018
has comment: http://stackoverflow.com/comment/35283021
has comment: http://stackoverflow.com/comment/35282842
has body: I am working on app where I am loading weather from Yahoo. From their XML I am getting "text", "code", "temp". What I want to do is based on code load image and display it. Code range is from 00-47 and I use those amazing icons. Now I know I can load image using this way: if (code == 0){ ImageView imageDisplay = (ImageView) findViewById(R.id.weatherImg); imageDisplay.setImageResource(R.Drawable.weather_00) } else if (code == 1) { } But this is not a great solution, than I have 100+ lines of code of if else statement. My idea was to do it this way: for(int i = 0;i&lt;48;i++){ if(weatherCode == i){ String imgName = "R.Drawable.weather_" + i; } but I cannot use String with "Drawable" it has to be Drawable... Does anybody know how to dynamically change name of the image based on a code I am using?
tagged with: android
has title: Yahoo weather and Android
type: AnsweredQuestion

http://stackoverflow.com/q/23031984
answer count: 2
possible better answer: http://stackoverflow.com/a/29494054
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/29494054
tagged with: resourcebundle
has answer: http://stackoverflow.com/a/23033691
downvote count: 0
tagged with: jsp
tagged with: javascript
has body: I am working on the Struts2 framework with JSP. In my samplePrj.properties file, in that com.samplePrj.Successmessage = Saved Successful is an attribute. I need to use this value in my JSP page, using Struts2. so how can I get the value of "com.samplePrj.Successmessage" in my JSP page.
tagged with: struts2
type: Question
type: AnsweredQuestion
score: 3
favorite count: 0
accepted answer: http://stackoverflow.com/a/23033691
has title: Using getText() for the getting property in Struts 2

http://stackoverflow.com/a/23073813
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23073791
has body: classA oa=new classA(abs); calls a constructor of classA that takes a String parameter. oa.getMystats(abs); calls getMystats method of classA that takes a String parameter. Learn more about passing parameters to constructors and methods: http://docs.oracle.com/javase/tutorial/java/javaOO/arguments.html

http://stackoverflow.com/a/23039757
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/35200820
has body: I think you missed the method block..May be you would like to wrap below block of code in some method. EntityManager entityManager = Persistence.createEntityManagerFactory("catalogueLibraryPU").createEntityManager(); Query query = entityManager.createNamedQuery("Photos.findAll"); List&lt;Photos&gt; resultList = query.getResultList(); for (Photos c : resultList) { jTextArea1.append(c.getTitle() + " (" + c.getLocation() + ")" + "\n"); }
has comment: http://stackoverflow.com/comment/35200764
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23039714
has comment: http://stackoverflow.com/comment/46346986
accepted answer of: http://stackoverflow.com/q/23039714

boggle
tag name: boggle
type: Tag
tags question: http://stackoverflow.com/q/23075689

http://stackoverflow.com/q/22982360
accepted answer: http://stackoverflow.com/a/22982512
favorite count: 0
has comment: http://stackoverflow.com/comment/35095991
has answer: http://stackoverflow.com/a/22987883
type: AnsweredQuestion
score: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/22987883
tagged with: java
has title: Partial Mocking on HttpSession
tagged with: unit-testing
type: Question
answer count: 2
tagged with: mockito
upvote count: 3
has body: There is a servlet i want to test , servlet have session and puts "loginBean" (which contain logged in user related info) inside session , which i have mocked already and working fine , now IN GUI level , there are 2 tab , DetailSet1 , detailsSet2 , when u enter data of DetailSet1 , it get saved in session and also does some business logic , now it comes to DetailsSet2 , you already have DetailSet1 in session , so it got all it needs , data is saved in DB. Now it's obvious i have to mock HttpSession because i am running unit cases from outside the container , but data which gets stored is also in HttpSession , if i mock those as well , it defeats the purpose of testing. so my Question is , i need HttpSession object to return mocked data for what i have it mocked for and it is suppose to act like any normal HttpSession object for other cases. Like , if code does session.setAttribute("name","Vivek") , then session.getAttribute("name") should return "Vivek" after that , but in case of mocked object it return "NULL" why? because i haven't mocked behaviour for "getAttribute("name"). In simple word Partial mocking for HttpSession or Interfaces.
tagged with: junit
has answer: http://stackoverflow.com/a/22982512

http://stackoverflow.com/comment/35083922
has text: @akhil If you're willing to go to the trouble, you could keep all your config files in a certain directory, list them using java.nio.file.DirectoryStream (or whatever), sort the listing so that config precedence works in some consistent way, and then combine their settings in a simple loop.
comment on: http://stackoverflow.com/a/22974134
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/23003179
type: Question
has answer: http://stackoverflow.com/a/23003420
tagged with: payload
tagged with: jersey
tagged with: http://stackoverflow.com/tag/json
score: 0
has comment: http://stackoverflow.com/comment/35134306
has body: I am doing restful webservice in java using Jersey,Json and mysql . By using POST method of chrome's advanced rest client i am sending json data through payload. Now i want to read that json data in my java file how to do this ? My code :-- public ArrayList&lt;FeedObjects&gt; GetStudent(Connection connection) throws Exception { ArrayList&lt;FeedObjects&gt; feedStudent = new ArrayList&lt;FeedObjects&gt;(); try { //String uname = request.getParameter("uname"); //PreparedStatement ps = connection.prepareStatement("SELECT book_id,bookname,price,author FROM book ORDER BY book_id DESC"); PreparedStatement ps1 = connection.prepareStatement("SELECT * FROM student,CollegeMaster where student.c_id=1 AND CollegeMaster.c_id = 1"); //ps.setString(1,uname); //ResultSet rs = ps.executeQuery(); ResultSet rs1 = ps1.executeQuery(); while(rs1.next()) { FeedObjects feedObject = new FeedObjects(); feedObject.setS_id(rs1.getString("s_id")); feedObject.setS_name(rs1.getString("s_name")); feedObject.setS_address(rs1.getString("s_address")); feedObject.setS_contact(rs1.getString("s_contact")); feedObject.setS_class(rs1.getString("s_class")); feedObject.setC_name(rs1.getString("c_name")); feedObject.setC_address(rs1.getString("c_address")); feedStudent.add(feedObject); } return feedStudent; } catch(Exception e) { throw e; } } i have {"c_id":"1"} from advanced rest client's payload (payload of POST method) which is in json. Now I want to read this c_id from my java program and then, As from above code .. I want to add that c_id=1 into query written below. PreparedStatement ps1 = connection.prepareStatement("SELECT * FROM student,CollegeMaster where student.c_id=1 AND CollegeMaster.c_id = 1");
answer count: 1
has title: how to retrive payload data of restful web service in java using jersey and json
has comment: http://stackoverflow.com/comment/35274915
type: UnansweredQuestion
tagged with: java
tagged with: mysql

http://stackoverflow.com/a/23108565
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23107318
type: Answer
accepted answer of: http://stackoverflow.com/q/23107318
score: 0
has body: You have to access the application context with the @Autowired annotation and not with a custom ApplicationContextProvider which implements ApplicationContextAware. Now I have acccess to all my beans. So it seems that this was a timing problem. private static ApplicationContext context; @Autowired public void setContext(ApplicationContext context) { OrderFactory.context = context; }

http://stackoverflow.com/q/23109145
has comment: http://stackoverflow.com/comment/95885522
answer count: 2
tagged with: intellij-idea
downvote count: 0
score: 10
has title: Run/Debug ElasticSearch in IntelliJ
has body: Is there a way to debug ElasticSearch server in realtime from IntelliJ? I don't have any exp with Maven. My goal is to have it running while I can debug it and inspect variables and the execution flow.
has answer: http://stackoverflow.com/a/23111858
tagged with: elasticsearch
possible better answer: http://stackoverflow.com/a/23110285
has answer: http://stackoverflow.com/a/23110285
favorite count: 0
tagged with: maven
accepted answer: http://stackoverflow.com/a/23111858
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/37922520
upvote count: 10
type: Question

http://stackoverflow.com/comment/35258494
score: 0
comment on: http://stackoverflow.com/q/23071402
type: Comment
type: QuestionComment
has text: J'utilise un traducteur pour cela, donc s'il vous plaît parler couramment. S'il vous plaît nous montrer d'où l'erreur est levée. (Il dit la ligne 76, mais je ne sais pas laquelle est la ligne 76).

http://stackoverflow.com/comment/35274869
comment on: http://stackoverflow.com/q/23080102
score: 1
type: Comment
type: QuestionComment
has text: check whether http://thinkinginsoftware.blogspot.in/2012/01/access-properties-file-from-jspjstl-el.html will help you

http://stackoverflow.com/q/23119851
favorite count: 0
has body: Lets say that I have an java object with multiple String fields. public class Person { private String field1 // keeps going I want to be able to have the ability to sort a list of persons depending on whatever field I choose. I know that I can use the comparator interface and implement multiple compareTo's as described in the topic: How do I make 2 comparable methods in only one class? But while using Collections.sort() But is there some way for me to do this without all this repeating code?
has answer: http://stackoverflow.com/a/23120048
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35344844
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/23120048
type: Question
has comment: http://stackoverflow.com/comment/35344817
has comment: http://stackoverflow.com/comment/35344784
score: 3
linked to: http://stackoverflow.com/q/4432774
has title: Having multiple types of sorts for an object
has answer: http://stackoverflow.com/a/23121951
has answer: http://stackoverflow.com/a/23119904
has answer: http://stackoverflow.com/a/23120284
downvote count: 0
possible better answer: http://stackoverflow.com/a/23119904

http://stackoverflow.com/comment/35324354
type: QuestionComment
comment on: http://stackoverflow.com/q/23108832
score: 0
has text: Check my answer. It is the same as your code but with a `@ResponseBody` annotation (as is used in the tutorial you included)
type: Comment

http://stackoverflow.com/comment/35728611
type: Comment
has text: Holy crap, with this line : "I think the IDE converts the package name to a directory structure as part of the lookup", I think you've struck gold!! AFK right now, but the funny thing about scripts is that they often do not reside in the same exact folder structure as your package name. Obviously this is not actually an option for me, but confirming this would be awesome info. I will introduce the concept of saving the compiled bytes to file... I just have one problem : [how?](http://stackoverflow.com/questions/23332788/how-do-i-re-encode-dynamically-compiled-bytes-to-text)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23325676

http://stackoverflow.com/comment/35218573
type: Comment
comment on: http://stackoverflow.com/a/23049512
score: 0
type: AnswerComment
has text: `String st = ""; for (int i = 0; i < 15; i++) st += name[i][0] + " " + name[i][1] + "\n"; outPut.setText(value);` this worked but it can only hold one entry and has 14 null null's

http://stackoverflow.com/comment/35258189
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23062963
has text: What's your question?
score: 0

http://stackoverflow.com/comment/35250828
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23067194
score: 0
has text: @staticx It's valid, using `col` would require assigning an extra variable ;)

http://stackoverflow.com/q/22995951
has title: what is the equelent of sql query in hibernate
has answer: http://stackoverflow.com/a/23003379
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23015003
has answer: http://stackoverflow.com/a/23015003
score: 0
accepted answer: http://stackoverflow.com/a/23003379
tagged with: sql
has body: In SQL Server i am using this query select * from Unit c ORDER BY CONVERT(INT, LEFT(name, PATINDEX('%[^0-9]%', name + 'z')-1)) desc; I want this query to use in Hibernate. when I use this in Hibernate I got error java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException:unexpected token: LEFT near line 1, column 122 [SELECT c FROM models.entities.UnitEntity c WHERE c.expSetId = :expSetId AND isWaitArea=:isWaitArea ORDER BY CONVERT(INT, LEFT(name, PATINDEX('%[^0-9]%', name + 'z')-1)) asc]
has comment: http://stackoverflow.com/comment/35170124
type: AnsweredQuestion

http://stackoverflow.com/comment/35113873
type: QuestionComment
type: Comment
has text: `parent.add("West", box);` Don't use magic numbers. Better is `parent.add(box, BorderLayout.WEST);` best is `parent.add(box, BorderLayout.LINE_START);`
comment on: http://stackoverflow.com/q/22992128
score: 0

http://stackoverflow.com/comment/35127148
comment on: http://stackoverflow.com/a/22999078
type: AnswerComment
has text: It seems as though #2 was still needed. I ran it through and it now updates with the correct score. Though I think you were correct with #3 in a way as well. Currently my totalscore is not being updated. Though I'm wondering if it would be better for me to put that in the same class, instead of using two.
score: 0
type: Comment

http://stackoverflow.com/comment/35208923
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23044557
has text: You could either use regex or split using "," and then put arrays back together

http://stackoverflow.com/comment/72561381
type: Comment
comment on: http://stackoverflow.com/a/37406961
has text: Downvoted because this disables hostname verification, removing man in the middle protection.
score: 13
type: AnswerComment

http://stackoverflow.com/comment/35595679
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23098478
has text: @A5l-lE5 that is checkbox mine is checkboxlist! Also, I've followed the checkboxlist tutorial of mkyong but could not find an answer for the issue.
type: Comment

kinect
type: Tag
tags question: http://stackoverflow.com/q/23074388
tag name: kinect

http://stackoverflow.com/comment/35216137
type: Comment
has text: You probably don't have Scala setup correctly in IntelliJ then.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23041105

http://stackoverflow.com/comment/35288483
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23088234
has text: @Prog Use the `protected` modifier for that.
type: Comment

http://stackoverflow.com/comment/35279655
type: Comment
has text: What is `nameList`? (What class is it?)
type: QuestionComment
comment on: http://stackoverflow.com/q/23083629
score: 0

http://stackoverflow.com/comment/35121121
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22995106
type: QuestionComment
has text: @natez0r I've seen tutorials where they run Google Maps on an emulator, i would prefer in order to avoid downloading my app onto my device to test the whole time, i'm sure there's settings i have to include or setup on my virtual device wouldn't you agree?

antlr4
tags question: http://stackoverflow.com/q/23084533
tags question: http://stackoverflow.com/q/23022079
tags question: http://stackoverflow.com/q/23092081
type: Tag
tag name: antlr4
tags question: http://stackoverflow.com/q/23098415

http://stackoverflow.com/q/23009248
has answer: http://stackoverflow.com/a/23009674
has body: I am trying to print two dates using SimpleDateFormat but for my custom date the output looks completely different. DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); Date date2 =dateFormat.parse("01/01/2014 10:45:01"); System.out.println(("date2:"+date2)); Date date = new Date(); System.out.println(dateFormat.format(date)); // how it prints this is the desired outcome OUTPUT: date2:Wed Jan 01 10:45:01 GMT 2014 11/04/2014 10:45:50
type: Question
possible better answer: http://stackoverflow.com/a/23009357
has answer: http://stackoverflow.com/a/23009395
has answer: http://stackoverflow.com/a/23009357
has comment: http://stackoverflow.com/comment/35144623
has answer: http://stackoverflow.com/a/23009376
accepted answer: http://stackoverflow.com/a/23009340
upvote count: 1
has comment: http://stackoverflow.com/comment/35144662
has comment: http://stackoverflow.com/comment/35144625
favorite count: 0
linked to: http://stackoverflow.com/q/18480633
has answer: http://stackoverflow.com/a/23009340
has title: Printing date using dateformat is different when setting own date or when calling new Date ()
answer count: 5
tagged with: datetime
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/35353707
comment on: http://stackoverflow.com/a/23124025
type: Comment
has text: I'm starting to understand. I now can determine if it's a negative and show those numbers (per your code) but I also need to figure out how to show the even and odd values. { System.out.println("The even numbers are: "); for (int x = 0; x < even; x++) { if (x % 2 =! 0) { System.out.print(", "); } System.out.print(evenList[x]); } System.out.println(); didnt work
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35136424
type: Comment
comment on: http://stackoverflow.com/a/23004324
has text: Yes you can write the code in that part whatever functionality you want to perform. Why you are not able to copy your logcat error ?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/89829659
type: Comment
comment on: http://stackoverflow.com/a/51429193
score: 1
type: AnswerComment
has text: Perhaps add text to explain what the code does or changes?

http://stackoverflow.com/q/23117581
has answer: http://stackoverflow.com/a/23117873
has title: QuickSort using Linked List
type: Question
tagged with: data-structures
score: 0
answer count: 1
type: UnansweredQuestion
has body: I need help with this code. I need to call the quicksort method without any parameters in the main method. But this program has a parameter. How can I make it work and not have any parameter when calling it in the main method? Please help. Employee Class public class Employee { private String firstname; private int idNumber; private String lastname; Employee(String lname,String fname, int id) { lastname = lname; firstname = fname; idNumber = id; } public void setLastName(String lname) {lastname = lname;} public String getLastName() {return lastname;} public void setFirstName(String fname) {firstname = fname;} public String getFirstName() {return firstname;} public void setidNumber(int id) {idNumber = id;} public int getidNumber() {return idNumber;} public String toString() { String str = "\nName: " + lastname + " " + firstname + "\nID: " + idNumber; return str; } public int compareTo(Employee Employee2) { int diff = lastname.compareToIgnoreCase(Employee2.getLastName()); if(diff != 0) return diff; else return -1; } } Linked List Class public class DoublyLinkedList { public class DoublyLinkedListLink { public Employee info; public DoublyLinkedListLink next; public DoublyLinkedListLink back; //Default Constructor //Postcondition: info = 0; // next = null; back = null; public DoublyLinkedListLink() { info = null; next = null; back = null; } public DoublyLinkedListLink(Employee item) { info = item; next = null; back = null; } public void displayInfo() { System.out.print(info + " "); } } protected int count; protected DoublyLinkedListLink first; protected DoublyLinkedListLink last; public DoublyLinkedList() { first = null; last = null; count = 0; } public void initializeList() { first = null; last = null; count = 0; } public boolean isEmpty() { return (first == null); } public int length() { return count; } public void print() { DoublyLinkedListLink current = first; while (current != null) { current.displayInfo(); current = current.next; }//end while }//end print public v…
tagged with: quicksort
tagged with: linked-list
tagged with: java

http://stackoverflow.com/comment/35174666
score: 0
type: Comment
has text: Sure, I could totally do this, but the issue is that I don't know what the Agent classes will actually be. Refer to my comment on the main post about this--I could potentially have an infinite number of different Agent files, all of which need to be able to by uploaded into my environment dynamically. I won't be the one actually using any of these Agent files, others will use them in the environment...I'm just writing a few to test that stuff works the way it's supposed to.
comment on: http://stackoverflow.com/a/23024851
type: AnswerComment

datetime
tags question: http://stackoverflow.com/q/23103391
tags question: http://stackoverflow.com/q/23015778
tags question: http://stackoverflow.com/q/23074844
tags question: http://stackoverflow.com/q/23045720
tags question: http://stackoverflow.com/q/22987623
tags question: http://stackoverflow.com/q/23116504
tags question: http://stackoverflow.com/q/23129212
tags question: http://stackoverflow.com/q/23031658
tags question: http://stackoverflow.com/q/23059814
tag name: datetime
tags question: http://stackoverflow.com/q/23069370
tags question: http://stackoverflow.com/q/23068676
type: Tag
tags question: http://stackoverflow.com/q/23103666
tags question: http://stackoverflow.com/q/23009248

http://stackoverflow.com/q/23064748
tagged with: jsp
has comment: http://stackoverflow.com/comment/35246159
has answer: http://stackoverflow.com/a/23066503
score: 0
has body: Hi i'm getting an the above error when trying insert data into my database from a jsp application here is the JSP code <%@page contentType="text/html" pageEncoding="UTF-8"%> Books database Add Delete <% String empfirstname = request.getParameter("empfirstname"); String empsurname = request.getParameter("empsurname"); String dpddept = request.getParameter("dpddept"); String extensionno = request.getParameter("extensionno"); String mobileno = request.getParameter("mobileno"); String emailaddress = request.getParameter("emailaddress"); String username = request.getParameter("username"); String password = request.getParameter("password"); if (empsurname != null && empfirstname != null && username != null && password != null) { Users.Worker.Insert(empfirstname,empsurname,dpddept,extensionno, mobileno,emailaddress,username,password); } %> Please Enter your first name. Please Enter your surname. Please Enter your Department. Please Enter your Extension Number. Please Enter your mobile Number. Please Enter your email Address. Please Enter your email username. Please Enter your email password. This is the java source code package Users; import java.sql.*; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; public class Worker { static final String url = "jdbc:mysql://localhost:3306/users"; public static void Insert(String empfirstname,String empsurname, String dpddept,String extensionno,String mobileno, String emailaddress,String username,String password) { try { String insert = "INSERT INTO users(empfirstname,empsurname,dpddept,extensionno," + "mobileno,emailaddress,username,password)" + "VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection(url, "root", "dpd2014"); PreparedStatement ps = con.prepareStatement(insert); ps.setString(1, empfirstname); ps.setString(2, empsurname); ps.setString(3, dpddept); ps.setInt(4, Integer.parseInt(extensionno)); …
has answer: http://stackoverflow.com/a/23064845
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35246039
has comment: http://stackoverflow.com/comment/35245964
tagged with: java
tagged with: mysql
type: Question
answer count: 2
has title: java.lang.NumberFormatException: with JSP App and mySQL
linked to: http://stackoverflow.com/q/5585779
has comment: http://stackoverflow.com/comment/35246041

http://stackoverflow.com/comment/35186254
comment on: http://stackoverflow.com/a/23030354
type: AnswerComment
score: 0
type: Comment
has text: You shouldn't post code that's broken and not explain how it works.

http://stackoverflow.com/q/23075615
tagged with: utf-8
tagged with: unicode
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23075749
possible better answer: http://stackoverflow.com/a/23075941
has answer: http://stackoverflow.com/a/23075941
score: 0
tagged with: java
tagged with: eclipse
has title: Printing Unicode characters using Java in eclipse works, but not when I export to a jar
has comment: http://stackoverflow.com/comment/35266006
has comment: http://stackoverflow.com/comment/35304525
has answer: http://stackoverflow.com/a/23075749
type: AnsweredQuestion
has body: I have code that creates a PrintWriter and prints Unicode symbols out = new PrintWriter(new FileWriter("test.txt")); out.print("\u2588"); out.close(); It works perfectly while saved with UTF-8 encoding inside eclipse, but when I export it to a jar it just prints off question marks. How would I tell it to use UTF-8 when printing off strings?

http://stackoverflow.com/a/22983474
has comment: http://stackoverflow.com/comment/35098402
has body: You have a trivial error in your code. The fact that every class extends Object makes the error more difficult to find. Since every class (including arrays) extends Object, conversion from A[] to Object is possible. You wrote int i = new int[] but that's a mistake, you should have written int[] i. Probably. Object a = new Object[] is not what you wanted to do.
accepted answer of: http://stackoverflow.com/q/22983408
score: 5
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22983408
upvote count: 5
type: Answer
downvote count: 0

http://stackoverflow.com/comment/67593157
type: Comment
has text: @Kilokahn's suggestion is also made in [this related post](http://stackoverflow.com/a/5405791/3780389). The post also considers using `assertEquals(obj1.toString(), obj2.toString())` as a work-around which I have found useful when debugging a failing assertion: to get the diff view, temporarily add the `toString()` version before the failing assertion. It would be nicer if eclipse just made the `toString()` diff view available for arbitrary `assertEquals`.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23100288

http://stackoverflow.com/a/23023408
type: Answer
answers question: http://stackoverflow.com/q/23021860
has body: If you don't actually need to read the original properties, you could do this in one step: &lt;replaceregexp file="foo.properties" flags="g" match="value(\d)" replace="\1" /&gt;
score: 0

http://stackoverflow.com/comment/35131682
type: AnswerComment
has text: I tried adding fields to schema.xml following online tutorials. Unfortunately, after restarting Tomcat, I still get the same error in solr. Darn it.
type: Comment
comment on: http://stackoverflow.com/a/22987033
score: 0

http://stackoverflow.com/a/22978139
upvote count: 1
score: 1
downvote count: 0
has body: Set your sourcepath with: -sourcepath sourcepathlist http://www.manpagez.com/man/1/javadoc/
type: Answer
answers question: http://stackoverflow.com/q/22978093

http://stackoverflow.com/comment/35197711
score: 1
type: Comment
type: QuestionComment
has text: In Eclipse: Window -> Show View -> LogCat. It will show up in the bottom part of the screen. When your app crashes you'll see a bunch of error (in red). So post those errors.
comment on: http://stackoverflow.com/q/23037925

http://stackoverflow.com/q/23072619
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6357579
has comment: http://stackoverflow.com/comment/35260669
tagged with: spring
tagged with: spring-mvc
upvote count: 5
tagged with: java
type: Question
has title: Implementation of Roles and Permissions in Spring Security - update: error related to hasPermission method
has body: I am developing a application for test the resources of the Spring Security, and in the current state of it, I need one solution to implement Roles AND Permissions for my methods. I already using this annotation: @Secured("ROLE_ADMIN") to define which role should be able to access each method. In my database, I have this structure: which means for each Role I can have a list of permissions. Anyone can point me a solution for define both restrictions for each one of my methods? I am configuring the Spring Security via Java code, this way: https://github.com/klebermo/webapp2/tree/master/src/com/spring/webapp/lojavirtual/config/security UPDATE Following the presented sugestions, I change my AuthenticationService (which extends UserDetailsService) to this: @Service public class AuthenticationService implements UserDetailsService { @Autowired private UsuarioHome accountDao; @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { Usuario account = accountDao.findByField("login", username); if(account==null) { System.out.println("No such user: " + username); throw new UsernameNotFoundException("No such user: " + username); } else if (account.getAutorizacao().isEmpty()) { System.out.println("User " + username + " has no authorities"); throw new UsernameNotFoundException("User " + username + " has no authorities"); } List&lt;Permission&gt; lista = new ArrayList&lt;Permission&gt;(); for(int i=0; i&lt;account.getAutorizacao().size(); i++) { for(int j=0; j&lt;account.getAutorizacao().get(i).getPermissao().size(); j++) { lista.add(account.getAutorizacao().get(i).getPermissao().get(j)); } } boolean accountIsEnabled = true; boolean accountNonExpired = true; boolean credentialsNonExpired = true; boolean accountNonLocked = true; return new User(account.getLogin(), account.getSenha(), accountIsEnabled, accountNonExpired, credentialsNonExpired, accountNonLocked, getAuthoriti…
score: 5
has comment: http://stackoverflow.com/comment/35260805
has comment: http://stackoverflow.com/comment/35260794
downvote count: 0
has comment: http://stackoverflow.com/comment/35265276
tagged with: spring-security
linked to: http://stackoverflow.com/q/23154239
has comment: http://stackoverflow.com/comment/35274952
favorite count: 0

http://stackoverflow.com/q/22985298
type: AnsweredQuestion
has body: I am trying to store the spinner data into SQLite database but in SQLite database cell android.widget.Spinner@411cf168 vale come i.e value not fetch from spinner list. Please anyone help me i think my problem is in this line ad1.insertquery(DatabaseDetail.getPAYMENT(), new String[]{ed_name.getText().toString(),ed_amount.getText().toString(),spin1.toString(),card_number.getText().toString(),ex_date.getText().toString()}); public class Payment_confirmation extends Activity implements OnItemSelectedListener { EditText ed_name,ed_amount,card_number,ex_date; Button payment; Spinner spin; String[] accounttype = { "SBI MASTER CARD","SBI MAESTRO CARD","HDFC DEBIT/CREDIT CARD","BOB CREDIT CARD","INDIAN BANK CREDIT CARD"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.payment_confirmation); ed_name=(EditText)findViewById(R.id.name); ed_amount=(EditText)findViewById(R.id.amount); card_number=(EditText)findViewById(R.id.crdnumber); ex_date=(EditText)findViewById(R.id.date); payment=(Button)findViewById(R.id.button2); back = (Button)findViewById(R.id.button1); spin=(Spinner)findViewById(R.id.spinner1); spin.setOnItemSelectedListener(this); ArrayAdapter aa= new ArrayAdapter(this,android.R.layout.simple_spinner_item, accounttype); aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spin.setAdapter(aa); payment.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String name=ed_name.getText().toString(); String amount=ed_amount.getText().toString(); String card=card_number.getText().toString(); String date=ex_date.getText().toString(); String spin1= spin.toString(); AdapterClass ad1 = new AdapterClass(getApplicationContext(), DatabaseDetail.PAYMENT); ad1.Open(); ad1.insertquery(DatabaseDetail.getPAYMENT(), new String[]{ed_name.getText().toString(),ed_amount.getText().toString(),spin1.toString(),card_number.getText().toString(),ex_date.getText().toSt…
has answer: http://stackoverflow.com/a/22985409
tagged with: java
has answer: http://stackoverflow.com/a/22985475
answer count: 3
score: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/22985366
has answer: http://stackoverflow.com/a/22985366
favorite count: 0
accepted answer: http://stackoverflow.com/a/22985409
tagged with: android
has title: I am trying to store the spinner data into SQLite database
upvote count: 2
type: Question

http://stackoverflow.com/a/23006722
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23006063
answers question: http://stackoverflow.com/q/23006063
type: Answer
has body: Whenever you want to execute a command which contains spaces in command prompt, you have to wrap it in double quotes. Like this: String commandStr = "cmd /c \"C:\\Program Files\\Common Files\\Microsoft Shared\\ink\\mip.exe\""; rt.exec( commandStr ); And In addition to that, if you want to know your errors, you can get error stream from object of class Process which is returned by runtimeObject.exec(). String commandStr = "cmd /c C:\\Programs Files\\Common Files\\Microsoft Shared\\ink\\TabTip.exe"; // Like you did InputStream is = rt.exec( commandStr ).getErrorStream(); int b; while((b=(is.read()))!=-1) System.out.print((char)b); }
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35143021

http://stackoverflow.com/q/22994808
has body: I have implemented an AST visitor, which visits every Method Invocation node. The method node.getName() gives me the name of the method, but I want to know the full name, Package.Class.Method. I'm sure there is an easy way to get this that I am missing, but I have not been able to find anything. Here is what I have so far: public boolean visit(MethodInvocation node) { assert callmap.containsKey(curMethod); String m = node.getName().toString(); callmap.get(curMethod).add(m); return false; // do not continue to avoid usage info } How can I get the full name of this method?
score: 0
tagged with: abstract-syntax-tree
answer count: 1
has answer: http://stackoverflow.com/a/22995110
has title: How to get the full name of an ASTVisitor node
accepted answer: http://stackoverflow.com/a/22995110
type: AnsweredQuestion
type: Question
linked to: http://stackoverflow.com/q/18939857
tagged with: java

http://stackoverflow.com/a/23071939
has body: From what i can see statement causing problem is this if((vrstica==x) &amp;&amp; (kolona==y)&amp;&amp;(test[y][x]!=0)&amp;&amp;(kvadrat!=1)){ razlicnost=true; Since razlicnost is intitially set to be false this statement is obviously never true and that causes while(!razlicnostT(j,i,test) running infinite. It is definitely error in application logic. Unfortunately I am not able to help you with this since your code Is poorly formated Uses different language Uses awfull(or none) naming conventions (names like y,yy,xxx are nightmare of anyone reviewing your code in the future) My advice is to rewrite this code to be more readable because fixing it may take even longer time
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23071689
upvote count: 1
type: Answer

http://stackoverflow.com/comment/35130716
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23001314
has text: No polymorphism involved here.
type: Comment

http://stackoverflow.com/comment/35437078
comment on: http://stackoverflow.com/a/23044606
has text: Please have a look at [No source code is available for YouTubeEmbeddedPlayer](https://code.google.com/p/gwt-youtube-api/issues/detail?id=4)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23124599
answers question: http://stackoverflow.com/q/23124576
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23124576
type: Answer
score: 1
upvote count: 1
has body: If you want to print the list of objects directly, you need to override the toString() method in the Network class and specify how to print the values when an object of this class is printed directly. The default toString() method is as shown in Object class docs. Have a look at this post about toString()

http://stackoverflow.com/a/23107322
answers question: http://stackoverflow.com/q/23106699
has body: You can use StringBuffer insead String. In class StringBuffer exists method setCharAt. Breifly, you will have variable String word - for guessing word, and StringBuilder guess for asterisks and guesed letters. When letter is guessed you will update guess with setCharAt.
score: 0
type: Answer

http://stackoverflow.com/comment/35300135
has text: What is a nested `for` loop?
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23094533

http://stackoverflow.com/a/23025125
score: 0
type: Answer
has body: To add jar file to you project classpath follow the steps here Go to Project-&gt; Libraries and add the folder that has the jars. all in this folder will be added to classpath. These jar files will be working as api.
has comment: http://stackoverflow.com/comment/35175383
answers question: http://stackoverflow.com/q/23025087
has comment: http://stackoverflow.com/comment/35174998

http://stackoverflow.com/q/23048655
has answer: http://stackoverflow.com/a/23048744
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23048842
has body: if (first == true) { x = input.read(); // input is a Reader nextCharacter = input.read(); first = false; } else { x = nextCharacter; nextCharacter = input.read(); charPosition++; } while (x == ' ' || x == '\n') { if (x == ' ') { x = nextCharacter; } else { x = nextCharacter; } } I am reading an input text file that has three blank lines. x reads character by character. x is equal to a new line so it suppose to go into the while loop but it does not. I debugged the code and printed out to check if x is holding a new line. It prints out x= 13, x = 10, x = 10. In all three of these cases, it skips the while loop. Another method I tried: while(x == '\n') { System.out.println("entered"); x = nextCharacter; } When I write it in its own while loop it will enter the loop the second time (x = 10) but come back out the third time when x = 10. Which isn't suppose to happen it should stay in the loop until it hits the end of file (x = -1). I also tried Character.toString((char) nextChar) == "\r\n" but that has the same result as the first one. What am I doing wrong?
tagged with: java
has comment: http://stackoverflow.com/comment/35216724
tagged with: loops
has comment: http://stackoverflow.com/comment/35217191
type: Question
tagged with: newline
has title: Java can't read that the character is a new line
has comment: http://stackoverflow.com/comment/35216728
score: 0
tagged with: char
tagged with: while-loop
has answer: http://stackoverflow.com/a/23048728
answer count: 3
has comment: http://stackoverflow.com/comment/35217190
has comment: http://stackoverflow.com/comment/35217170
has comment: http://stackoverflow.com/comment/35217311
has comment: http://stackoverflow.com/comment/35216827
has comment: http://stackoverflow.com/comment/35217138

http://stackoverflow.com/comment/35233870
score: 2
has text: Check out http://stackoverflow.com/questions/5683728/convert-java-util-date-to-string
comment on: http://stackoverflow.com/q/23058239
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23025798
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: You've got the logic correct, but your implementation is a bit odd. You basically want to do the same thing for every value, so why not check the value as soon as it's entered instead of at the end, like this: class SAT { private static final Scanner sc = new Scanner(System.in); private static int getInt(final String subject) { System.out.println("SAT " + subject + ": "); final int value = sc.nextInt(); if(value &lt; 200 || value &gt; 800) { System.out.println("Did not enter a value in range! (200-800)"); System.exit(-1); } return value; } public static void main(String[] args) { int maths = getInt("Math"); int reading = getInt("Reading"); int writing = getInt("Writing"); } }
has comment: http://stackoverflow.com/comment/35176444
has comment: http://stackoverflow.com/comment/35176029
answers question: http://stackoverflow.com/q/23025735
has comment: http://stackoverflow.com/comment/35176387

http://stackoverflow.com/q/22971712
tagged with: java
has answer: http://stackoverflow.com/a/22971807
type: Question
has comment: http://stackoverflow.com/comment/35077235
tagged with: null
has title: Cant find where [Exception in thread "main" java.lang.NullPointerException] Applies
score: -2
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/22971841
has body: I'm in an intro CS class and I'm writing a program that plays a game. I have the framework classes down but this error occurs when I try to run. It says there is a null point at line 51 in the game method but I can't find where the null point is occurring. Here's the code for the four classes. public class Pog //THIS IS DONE { public static void main (String [] Agrs) { PogPlayer human = new PogPlayer( "Human" ); PogPlayer computer = new PogPlayer( "Computer" ); PogGame game = new PogGame ( human, computer ); game.play(); } // method main } // class Pog public class PogDice { private int die1; // Stores the value (1-6) of die1. private int die2; // Stores the value (1-6) of die2. private Random rand; public PogDice() { rand = new Random(); } // default constructor public int roll() { int total = 0; int turnTotal = 0; String choice; Scanner scan; scan = new Scanner(System.in); do { die1 = rand.nextInt( 5 )+1; die2 = rand.nextInt( 5 )+1; total = die1+die2; System.out.println("Current score is: " + total + "\nRoll again?"); choice = scan.nextLine(); } while (choice == "yes" &amp;&amp; hasDoubleOne() == false); turnTotal = turnTotal + total; return turnTotal; } // method rollDice public boolean hasDoubleOne() { boolean doubleOne = false; if(die1 == 1 &amp;&amp; die2 == 1) doubleOne = true; else doubleOne = false; return doubleOne; } // method hasDoubleOne public String toString() { return (die1 + ", " + die2); } // method toString } // class PogDice public class PogGame { private PogPlayer human; private PogPlayer computer; /** * PogGame (constructor) * * @param PogPlayer (human) * @param PogPlayer (computer) */ public PogGame ( PogPlayer humanArg, PogPlayer computerArg ) { PogPlayer human = humanArg; PogPlayer comptuer = computerArg; } // method PogGame (constructor) public void play() { System.out.println("Hello, Welcome to Pog.\n\n This game takes the user "+ "and puts them agaisnt the computer\n in a dice-based "+ "game. Each player takes turns rolling two dice,\n "+…
has comment: http://stackoverflow.com/comment/35077260
has comment: http://stackoverflow.com/comment/35077319
has comment: http://stackoverflow.com/comment/35077329
has comment: http://stackoverflow.com/comment/35077291
favorite count: 0
type: UnansweredQuestion
upvote count: 0

autowired
tags question: http://stackoverflow.com/q/23114050
tags question: http://stackoverflow.com/q/23107318
type: Tag
tags question: http://stackoverflow.com/q/23014717
tags question: http://stackoverflow.com/q/23080668
tag name: autowired

http://stackoverflow.com/a/22983803
answers question: http://stackoverflow.com/q/22983737
type: Answer
has comment: http://stackoverflow.com/comment/35098874
score: 0
has body: create a button on main layout. Implement onclicklistener for the button and call populateListView() inside the onlick method. Creat a new list. When you click a button add an item to a new list. call notifydatasetchanged(). When you click a button check whether the item is already added in the new list or not. Use newly created list in your adapter so that every time new item will be added.

http://stackoverflow.com/a/23048152
score: 0
has comment: http://stackoverflow.com/comment/35215918
has comment: http://stackoverflow.com/comment/35215880
answers question: http://stackoverflow.com/q/23048080
type: Answer
has body: You can make the Item in your 2nd Activity invisible like this: @Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem item = menu.findItem(R.id.action_search); item.setVisible(false); return super.onCreateOptionsMenu(menu); } Another approach would be to load a second menu.xml with no item in it.
has comment: http://stackoverflow.com/comment/35215941

http://stackoverflow.com/a/23111800
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23111745
score: 8
type: Answer
downvote count: 0
upvote count: 8
has body: So how to explain this static nested class has access to private constructor of its enclosing class? Because the scope and accessibility of any private member (field, constructor or method) is the complete body of its declaring class, including any nested classes. From the Java Language Specification section 6.6.1: if the member or constructor is declared private, then access is permitted if and only if it occurs within the body of the top level class (§7.6) that encloses the declaration of the member or constructor.
accepted answer of: http://stackoverflow.com/q/23111745

http://stackoverflow.com/q/23017347
answer count: 1
tagged with: jms
has answer: http://stackoverflow.com/a/23017920
has comment: http://stackoverflow.com/comment/35160473
type: AnsweredQuestion
tagged with: activemq-classic
tagged with: java
has title: How producer can access the acknowledgement sent by message broker?
type: Question
accepted answer: http://stackoverflow.com/a/23017920
has comment: http://stackoverflow.com/comment/35159876
has body: I have below code in main method. I am not getting how i can check the acknowledgment sent from message broker . Basically i want to get the value of acknowledgment sent from message broker at line 1 try { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url); // Create a Connection Connection connection = connectionFactory.createConnection(); connection.start(); // Create a Session Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); // Create the destination (Topic or Queue) Destination destination = session.createQueue(subject); // Create a MessageProducer from the Session to the Topic or Queue MessageProducer producer = session.createProducer(destination); producer.setDeliveryMode(DeliveryMode.PERSISTENT); // Create a messages String text = "Hello world! From Jon"; TextMessage message = session.createTextMessage(text); producer.send(message); // how to check acknowledgement here? // line1 session.commit(); // Clean up session.close(); connection.close(); } catch (Exception e) { System.out.println("Caught: " + e); e.printStackTrace(); } As i created Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); message broker will send the acknowledgement once it receives the message, but how producer will get it?
score: 0

http://stackoverflow.com/comment/35357849
type: AnswerComment
score: 0
type: Comment
has text: Thanks for your help guys. Sorry for not being so clear. The solution for the forloop works great but I have JButtons first, last, previous and next which I have working fine but I have a JButton findById which I can't figure out. When I find my person I can't set currentItem to point to that person and display it
comment on: http://stackoverflow.com/a/23122037

rest
tags question: http://stackoverflow.com/q/23035030
tags question: http://stackoverflow.com/q/23118114
tags question: http://stackoverflow.com/q/23048212
tags question: http://stackoverflow.com/q/22998139
tags question: http://stackoverflow.com/q/23067022
tags question: http://stackoverflow.com/q/22980276
tags question: http://stackoverflow.com/q/23028899
tags question: http://stackoverflow.com/q/23057566
tags question: http://stackoverflow.com/q/23057064
tags question: http://stackoverflow.com/q/22968539
tags question: http://stackoverflow.com/q/23104788
tags question: http://stackoverflow.com/q/23052479
tags question: http://stackoverflow.com/q/23104288
tags question: http://stackoverflow.com/q/23062569
tags question: http://stackoverflow.com/q/23104933
tags question: http://stackoverflow.com/q/23117879
tags question: http://stackoverflow.com/q/23023100
tags question: http://stackoverflow.com/q/23056091
tags question: http://stackoverflow.com/q/22970827
tags question: http://stackoverflow.com/q/22989500
tags question: http://stackoverflow.com/q/23098794
tags question: http://stackoverflow.com/q/23021791
tags question: http://stackoverflow.com/q/23087123
type: Tag
tags question: http://stackoverflow.com/q/23028621
tags question: http://stackoverflow.com/q/23124047
tags question: http://stackoverflow.com/q/23107652
tags question: http://stackoverflow.com/q/23056564
tags question: http://stackoverflow.com/q/23127529
tag name: rest
tags question: http://stackoverflow.com/q/22970087
tags question: http://stackoverflow.com/q/23120545
tags question: http://stackoverflow.com/q/23070572
tags question: http://stackoverflow.com/q/23062963
tags question: http://stackoverflow.com/q/23025552
tags question: http://stackoverflow.com/q/23083583
tags question: http://stackoverflow.com/q/22970677
tags question: http://stackoverflow.com/q/22988935
tags question: http://stackoverflow.com/q/23075673
tags question: http://stackoverflow.com/q/23067383
tags question: http://stackoverflow.com/q/23073439
tags question: http://stackoverflow.com/q/23098308

http://stackoverflow.com/comment/35095515
has text: Hmm... it looks like Android OS Bug... Maybe this post can help you http://stackoverflow.com/a/17955940/1145140
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22981522

http://stackoverflow.com/comment/35254726
score: 0
has text: I'm not sure that I understand. I don't see where the third "public class GUI..." is.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23069264

http://stackoverflow.com/q/23129011
tagged with: sockets
tagged with: android
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23129432
has answer: http://stackoverflow.com/a/23132091
type: Question
linked to: http://stackoverflow.com/q/14576710
tagged with: network-programming
has answer: http://stackoverflow.com/a/23129658
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/35361178
has title: Android Java Server Socket does not connect
has body: I am writing an app which needs to receive a string from a server. The following code works if the IP Adress connected to is "127.0.0.1" (The Client and the server are on the same phone, just for testing purpose), but not if it is the "real" IP Adress of the phone. Server: ServerSocket echoServer = null; String line; DataInputStream is; PrintStream os; Socket clientSocket = null; // Try to open a server socket on port 9999 try { echoServer = new ServerSocket(1109); } catch (IOException e) { System.out.println(e); } // Create a socket object from the ServerSocket to listen and // accept // connections. // Open input and output streams try { clientSocket = echoServer.accept(); is = new DataInputStream(clientSocket.getInputStream()); os = new PrintStream(clientSocket.getOutputStream()); // As long as we receive data, echo that data back to the // client. os.println("Das ist ein Test immernoch"); publish("Fertig"); } catch (IOException e) { publish("Fertig"); } catch (Exception e) { publish("Fertig"); } Client: Socket smtpSocket = null; DataOutputStream os = null; DataInputStream is = null; try { smtpSocket = new Socket(); smtpSocket.connect(new InetSocketAddress("46.114.153.58", 1109), 10000); //That is the critcal line, if the IP is "127.0.0.1" everything works perfectly fine os = new DataOutputStream(smtpSocket.getOutputStream()); is = new DataInputStream(smtpSocket.getInputStream()); } catch (UnknownHostException e) { return "Fehler"; } catch (IOException e) { return "Fehler"; } if (smtpSocket != null &amp;&amp; os != null &amp;&amp; is != null) { try { os.writeBytes("HELO\n"); String s = is.readLine(); os.close(); is.close(); smtpSocket.close(); return s; } catch (UnknownHostException e) { //System.err.println("Trying to connect to unknown host: " + e); } catch (IOException e) { //System.err.println("IOException: " + e); } } return "Fehler"; } EDIT: Hence this is an app for a mobile device, there is no router I can configure.
answer count: 3

http://stackoverflow.com/a/23101349
answers question: http://stackoverflow.com/q/23100389
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/35311959
has body: Add single Quotation marks around the date value being passed into that SELECT statement.

http://stackoverflow.com/q/23018752
has title: BeanPropertyRowMapper vs RowMapper
has comment: http://stackoverflow.com/comment/35236985
downvote count: 0
favorite count: 0
score: 8
has body: I have a table with more than 100 columns. We are using spring jdbc in our application. As there were so many columns in the table, I decided to use BeanPropertyRowMapper for fetching the records from DB. This was to avoid writing the hardcoded column and property names in the code which become difficult to manage. However, when the application went to performance test, I found that there is significant performance hit due to using BeanPropertyRowMapper. I decide to re-write the code with RowMapper with mapping columns names manually from resultSet to the data object properties. This improved the performance. My question is, if BeanPropertyRowMapper cannot be used with high number of columns, then how is it helping writing cleaner manageable code. Is there any other way using JDBC I can achieve performance as well as manageable code?
type: UnansweredQuestion
tagged with: spring-jdbc
answer count: 0
tagged with: java
upvote count: 8
type: Question
tagged with: performance

http://stackoverflow.com/a/22973424
has comment: http://stackoverflow.com/comment/35080944
accepted answer of: http://stackoverflow.com/q/22973393
score: 0
answers question: http://stackoverflow.com/q/22973393
type: AcceptedAnswer
has body: You could put the WebView in a Fragment and have it fill the entire Fragment's layout file; Then add that Fragment to your Activity's layout file contain a Fragment View with your specified dimensions. This should resize your UI within the Fragment
type: Answer

http://stackoverflow.com/comment/74072865
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23114127
type: Comment
has text: Time goes by and what we think consists of a good answer changes over 3 years.

http://stackoverflow.com/q/23082693
has title: Delete item in the list view using Context Menu
type: Question
tagged with: listview
has body: I want to use the context menu to delete an entry from the list view. This is my code: @Override public boolean onContextItemSelected(MenuItem item) { // Log.d("", "logger enter onContextItemSelected"); AdapterContextMenuInfo info = (AdapterContextMenuInfo) item .getMenuInfo(); switch (item.getItemId()) { case 1: int i = (int) info.id; String list_record = separated.get(info.position); Utils.removeLabels(this, list_record); Log.d("", "labels&gt;&gt;&gt; position: " + info.position); separated.remove(info.position); Log.d("", "labels&gt;&gt;&gt; separated=" + separated); clAdapter.notifyDataSetChanged(); return true; default: return super.onContextItemSelected(item); } } Here, info.position extracts the correct list_record but when I use the same thing in info.position, the item just below the selected item gets deleted. How do I go about this?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23082885
type: UnansweredQuestion
tagged with: android
tagged with: contextmenu
tagged with: java

http://stackoverflow.com/comment/35225343
score: 0
has text: Hi Sotirios, Thank you for response. But could you please suggest how to store that value, because am calling a chart here which is calculated in servlet1(calculation)--> jsp(image,textarea)-->servlet2. Here jsp is showing that chart which is calculated in servlet1, remaining flow i have specified in code
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23053426

http://stackoverflow.com/comment/35128646
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22999136
has text: I do not know what is wrong because it seems like my textfields have nothing in them that can be converted to an integer from my end. Are you able to perform computations by getting the values inputed into these textfields??

http://stackoverflow.com/comment/35360163
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23128522
has text: what about: jsp:param tag's value? is it should be casted?

http://stackoverflow.com/comment/35175228
score: 1
has text: Your recursive call adds a character so the length can *never* be <= 1
type: QuestionComment
comment on: http://stackoverflow.com/q/23025347
type: Comment

http://stackoverflow.com/q/23007984
has comment: http://stackoverflow.com/comment/35170745
favorite count: 0
has comment: http://stackoverflow.com/comment/35229634
tagged with: redis
accepted answer: http://stackoverflow.com/a/23568986
type: AnsweredQuestion
score: 3
has body: Problem I'm trying to normalize columns in very large raw, de-normalized CSV tables. Column values are short strings (10-100 bytes). I'm trying to find a faster solution than my current approach(es). Example input.csv john,london jean,paris bill,london Is converted to the following files: input.normalized.csv 1,1 2,2 3,1 input.col1.csv 1,john 2,jean 3,bill input.col2.csv 1,london 2,paris I've currently got two approaches to normalizing these datasets. Current Approaches Single pass in-memory A single pass approach, storing column values -> normalized_id values in an associative array (a Java HashMap in my case). This will run out of memory at some point, but it's fast when it can store everything in memory. A simple way of lowering memory usage, would be to do a single pass per column. Multipass sorting A multipass approach based on sorting. Column values gets their line number attached, and are then sorted (in a memory-efficient merge-sort manner). For examples, column values london,paris,london have line numbers attached and are then sorted: london;1,london;3,paris;2 . I can now have a single "unique value counter", and simply compare each value with the previous value (e.g. London == London, so do not increment unique value counter). At the end, I have pairs of unique_id,linenum pairs that I can sort by line number to reconstruct the normalized column. Columns can then be merged in a single pass. This approach can be done in very limited memory, depending on the memory usage of the sorting algorithm applied. The good news is that this approach is easy to implement in something like hadoop, utilising its distributed sorting step. MY QUESTION The multipass approach is painfully slow compared to a single-pass approach (or a single-pass-per-column approach). So I'm wondering what the best way to optimize that approach would be, or if someone could suggest alternative approaches? I reckon I'm looking for a (distributed) key-value store of some kind, that has as low me…
upvote count: 3
tagged with: java
type: Question
tagged with: hadoop
has title: Memory-efficient distributed approach to determining unique values?
has comment: http://stackoverflow.com/comment/35233806
has comment: http://stackoverflow.com/comment/35234727
answer count: 1
downvote count: 0
tagged with: sorting
has answer: http://stackoverflow.com/a/23568986
tagged with: key-value

http://stackoverflow.com/comment/35282954
has text: The array you're going to have to do manually. But adding the `onClickListener` is just that for loop
type: Comment
comment on: http://stackoverflow.com/a/23051659
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35533821
comment on: http://stackoverflow.com/q/23114492
type: QuestionComment
has text: Well no not really. I would like to use opencv functions. Thanks anyway
score: 0
type: Comment

http://stackoverflow.com/comment/35394964
score: 0
type: AnswerComment
type: Comment
has text: @Lokesh I mean the field which is being initialized by non-constant values...i.e. method calls. Edited the answer to be more clear.
comment on: http://stackoverflow.com/a/23101310

http://stackoverflow.com/q/23076151
tagged with: bouncycastle
type: UnansweredQuestion
has title: Reading a PFX file PrivateKey and Certificate Chain in java - Getting a Null
tagged with: java
upvote count: 1
type: Question
has body: Here's my code as below: public static void main(String[] args) throws IOException, GeneralSecurityException, DocumentException { String path = "&lt;pfx file&gt;"; char[] pass = "&lt;password&gt;".toCharArray(); BouncyCastleProvider provider = new BouncyCastleProvider(); Security.addProvider(provider); KeyStore ks = KeyStore.getInstance("pkcs12", provider.getName()); ks.load(new FileInputStream(path), pass); String alias = (String) ks.aliases().nextElement(); /* alias='CCA India 2011\u0000'*/ PrivateKey pk = (PrivateKey) ks.getKey(alias, pass);/* returns null */ Certificate[] chain = ks.getCertificateChain(alias);/* returns null */ X509Certificate last = (X509Certificate) chain[chain.length - 1]; System.out.println(last.getNotBefore()); System.out.println(last.getNotAfter()); } The alias that is returned back has a \u0000 at the end of it. I am not sure what to make of it. Is that the reason why pk and chain is null? I tried to trim the alias to no avail. I am able to import this certificate into the microsoft keystore. Meaning I am able to see it in the Internet Explorer .. Certificates. I am able to use it to sign documents on Adobe Reader. So there is no issue the pfx file. Just not able to work with it in java. I have JCE installed as well.
downvote count: 0
answer count: 1
tagged with: pfx
has answer: http://stackoverflow.com/a/23088847
score: 1
favorite count: 0

http://stackoverflow.com/comment/35078401
type: AnswerComment
type: Comment
score: 0
has text: @user3495562 To clarify: You should not be using `char` to read/write text from a file unless you *really* understand what that's doing. Character set encoding is important in modern software.
comment on: http://stackoverflow.com/a/22972095

http://stackoverflow.com/q/23103952
has body: I'm having trouble understanding why a action method on my ConversationScope'd bean doesnt fire. The bean is: package org.work; import java.io.Serializable; import javax.enterprise.context.ConversationScoped; import javax.faces.event.ComponentSystemEvent; import javax.inject.Named; @Named @ConversationScoped public class NewClass implements Serializable { private static final long serialVersionUID = 6470665657635110586L; private boolean b1; public boolean isB1() { return b1; } public void setB1(boolean b1) { this.b1 = b1; } public void preRenderView(ComponentSystemEvent evt) { } public String peformAction() { return null; } } and my XHTML is: &lt;?xml version='1.0' encoding='UTF-8' ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"&gt; &lt;f:view&gt; &lt;h:head&gt; &lt;/h:head&gt; &lt;f:metadata&gt; &lt;f:viewParam name="b1" value="#{newClass.b1}" /&gt; &lt;f:event type="preRenderView" listener="#{newClass.preRenderView}"/&gt; &lt;/f:metadata&gt; &lt;h:body&gt; &lt;h:form&gt; &lt;h:commandLink action="#{newClass.setB1(!newClass.b1)}" style="background-color: #{newClass.b1 ? 'darkorchid' : 'aquamarine'};" value="btn3"/&gt; &lt;h:panelGrid rendered="#{newClass.b1}" columns="1"&gt; &lt;h:commandLink value="edit" action="#{newClass.peformAction()}" /&gt; &lt;/h:panelGrid&gt; &lt;/h:form&gt; &lt;/h:body&gt; &lt;/f:view&gt; &lt;/html&gt; The performAction() method is not fired after I press the commandLink that should invert the boolean making the other commandLink rendered. When debugging I can see that the boolean is set to true, but it seems to me the "rendered" attribute is evaluated before the viewparams is set. Is this true? The example works fine with @ManagedBean and @javax.faces.bean.ViewScoped.
type: Question
has answer: http://stackoverflow.com/a/23105606
tagged with: scope
score: 0
tagged with: rendered-attribute
answer count: 1
has title: ConversationScoped bean action not fired using a rendered commandlink
type: UnansweredQuestion
tagged with: jsf
tagged with: java

vertex-array-object
type: Tag
tag name: vertex-array-object
tags question: http://stackoverflow.com/q/23031933

http://stackoverflow.com/q/22990904
tagged with: android
has title: Change navigation drawer name items by strings
has answer: http://stackoverflow.com/a/22991048
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has body: I need a way to use strings instead of "PERFORMANCE", "MALI"...I tried to sostitute them by "@string/resource_name" but it doesn t work, when I open the menu it shows instead of the linked name "@string/resource_name". MainActivity: //Show the items into the menu. @Override protected NavDrawerActivityConfiguration getNavDrawerConfiguration() { NavDrawerItem[] menu = new NavDrawerItem[] { //This sets the name, mine is a multilanguage app so I wanna find a way to use @string/resource instead //of "PERFORMANCE", ecc. NavMenuItem.create(1,"PERFORMANCE", "", false, this), NavMenuItem.create(2, "MALI", "", false, this), NavMenuItem.create(3, "BATTERY", "", false, this), NavMenuItem.create(4, "CPU", "", false, this), NavMenuItem.create(5, "MISC", "", false, this), NavMenuItem.create(6, "NET", "", false, this), NavMenuItem.create(7, "HELP", "", false, this), NavMenuItem.create(8, "GUIDE", "", false, this)}; NavDrawerActivityConfiguration navDrawerActivityConfiguration = new NavDrawerActivityConfiguration(); navDrawerActivityConfiguration.setMainLayout(R.layout.main); navDrawerActivityConfiguration.setDrawerLayoutId(R.id.drawer_layout); navDrawerActivityConfiguration.setLeftDrawerId(R.id.left_drawer); navDrawerActivityConfiguration.setNavItems(menu); navDrawerActivityConfiguration.setDrawerShadow(R.drawable.drawer_shadow); navDrawerActivityConfiguration.setDrawerOpenDesc(R.string.drawer_open); navDrawerActivityConfiguration.setDrawerCloseDesc(R.string.drawer_close); navDrawerActivityConfiguration.setBaseAdapter( new NavDrawerAdapter(this, R.layout.navdrawer_item, menu )); return navDrawerActivityConfiguration; } NavmenuItem: public class NavMenuItem implements NavDrawerItem { public static final int ITEM_TYPE = 1 ; private int id ; private String label ; private boolean updateActionBarTitle ; private NavMenuItem() { } public static NavMenuItem create( int id, String label, String icon, boolean updateActionBarTitle, Context context ) { NavMenuItem item = new NavMenuItem(); it…
tagged with: navigation-drawer
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22991027
accepted answer: http://stackoverflow.com/a/22991048
score: 0
possible better answer: http://stackoverflow.com/a/22991027

http://stackoverflow.com/comment/35114024
has text: Check whether you're using `tcnative` (see Installation/Windows section in the link I gave you earlier).
comment on: http://stackoverflow.com/a/22991711
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/59832844
type: Comment
comment on: http://stackoverflow.com/q/23070298
score: 0
has text: I'm curious why you wouldn't just format your POJO class to handle those status results.
type: QuestionComment

http://stackoverflow.com/q/22985708
has comment: http://stackoverflow.com/comment/35103073
has comment: http://stackoverflow.com/comment/35160561
tagged with: android
has title: including *.so lib in android app using Eclipse?
answer count: 0
type: UnansweredQuestion
has body: I want to use *.so file in my android app so I copied file to "libs\armeabi\libctrl_gpio.so" as suggested at some websites. When I run and create apk file, Eclipse creates this folder(inside apk)! "lib\armeabi\libctrl_gpio.so" It changes "libs" to "lib" and at runtime when app wants to load library using this code : System.loadLibrary("ctrl_gpio"); I got error : Trying to load lib /data/data/shopping.shop/lib/libctrl_gpio.so Added shared lib /data/data/shopping.shop/lib/libctrl_gpio.so JNI_OnLoad failed to open /dev/ctrl_gpio -- No such file or directory. JNI_OnLoad returned bad version (-1) in /data/data/shopping.shop/lib/libctrl_gpio.so WARNING: Could not load library! You see at line one that the path is "lib/libctrl_gpio.so" not "lib\armeabi\libctrl_gpio.so" as inside the apk file! Also at line 4 the path is "/dev/ctrl_gpio" !!!!!!!!!! I don't understand why it happens and is this my problem that prevents loading of library? I searched and saw lots of websites and questions but none of them solved my problem. Any help will highly appreciated. I'm newbie to android so provide me with details. thanks.
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/102212405
tagged with: java
tagged with: android-native-library
has comment: http://stackoverflow.com/comment/35102241
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/35203610
has text: In the `imaging` function, `panel` is a String, but you are calling `setBackground()` on it, which is not a String method. If you really want to use a String to identify your panel, you'll need a `Map<String, JPanel>` to keep track of the links between String names and actual panel objects. But a bigger question is why are you passing these strings around, rather than panel references to begin with?
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23041628

http://stackoverflow.com/q/23122665
answer count: 1
tagged with: string
score: 0
has body: first of all i would like to profusely than this community for helping someone who is just learning programming and i ask that you bear with me. here is the file i am working with : DNA sequencing program Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String ind ex out of range: 14 at java.lang.String.charAt(String.java:658) at DNA.gap_score(run_dna.java:64) at DNA.dna_ini(run_dna.java:37) at DNA.&lt;init&gt;(run_dna.java:17) at run_dna.main(run_dna.java:243) what i have gleaned is that somewhere in my code i have tried to reference something outside the length of a String. i was wondering how t o use the error code to backtrack through the program to find where i went wrong. Because it was requested here is the full code here : class DNA //implements Score_card { private int row = 10;// initialize number of rows for the matrix private int column = 10;//initialize number of columns for the matrix private int opt_number = 0;//the placeholder for the number of matches in the optimal alignment private String DNA1 = DNA_gen(row);// initialize a String that is the length() of row private String DNA2 = DNA_gen(column);//initialize a String of length() column private int[][] dnamat = dna_ini();//initialize the DNA matrix private char[][] mat_hold = new char[row][column]; private String DNA_seq1 = null;//create and empty String to be used in the matrix building/sequencing program private String DNA_seq2 = null;// ditto private String DNA_align = null;//create a String to hold the vertical alignment lines public int[][] dna_ini() { //initializes the array, taking into account the possibility of and advanced gap scoring algorithm String a = DNA1; String b = DNA2; int[][] ini = new int[a.length()+1][b.length()+1];//initialize the size of the array to be the length()s of the String plus one for(int j = 0;j &lt; (a.length()+1); j++) /*for loop to run through value of j limited by size of the array*/ { ini[j][0] = gap_score(j,0,a,b);//utilize the gap score …
has title: Getting an Out of Bounds exception and I don't know how to trace back to find where the exception is
has comment: http://stackoverflow.com/comment/35349872
has answer: http://stackoverflow.com/a/23122905
accepted answer: http://stackoverflow.com/a/23122905
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35349628
tagged with: dna-sequence
type: Question

http://stackoverflow.com/a/22972754
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22972674
downvote count: 0
has body: Try something like &lt;fail if="testFail" message="At least one unit test failed"/&gt; in your unit test target.
type: Answer

http://stackoverflow.com/q/23054880
linked to: http://stackoverflow.com/q/7192595
has body: I have a small java project which do several activities including a database update and i have a separate python(.py) application which update the same database after a data mining process. In my Java application i need to open(execute) my python application which update the same database. i tried several ways but the code is not working. below i paste the initial code without calling the .py file. if (getDB("BP") != 0.0 &amp;&amp; getDB("BT") != 0.0 &amp;&amp; getDB("SO2") != 0.0 &amp;&amp; getDB("HR") != 0.0) { if(analyzeData(inputLine)) { setDB(inputLine); //&lt;python(.py) file should execute independently in this section, after setDB(inputLine)&gt; } } else { setNormalBio(inputLine); }
tagged with: python
has title: Execute a python separate application in a java application
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23055984
type: Question
tagged with: native
upvote count: 0
has comment: http://stackoverflow.com/comment/35228303
tagged with: postgresql
accepted answer: http://stackoverflow.com/a/23055984
answer count: 1
score: -1
favorite count: 0

jetty
tags question: http://stackoverflow.com/q/23058273
tags question: http://stackoverflow.com/q/22992039
tags question: http://stackoverflow.com/q/23033611
tag name: jetty
tags question: http://stackoverflow.com/q/22981885
tags question: http://stackoverflow.com/q/23027432
tags question: http://stackoverflow.com/q/23033608
type: Tag
tags question: http://stackoverflow.com/q/23114871

http://stackoverflow.com/comment/61324535
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23097086
has text: @TilakMadichetti I believe the syntax is `stage.initStyle(...)` without the word `set` in the method name per https://docs.oracle.com/javase/8/javafx/api/javafx/stage/Stage.html#initStyle-javafx.stage.StageStyle-

http://stackoverflow.com/comment/38733075
comment on: http://stackoverflow.com/q/23000685
score: 0
type: QuestionComment
has text: Check your imports. Is the R file import correct? It should be `com.abc.newapp.R` instead of `com.abc.oldapp.R`.
type: Comment

http://stackoverflow.com/comment/35135694
comment on: http://stackoverflow.com/a/23004097
score: 0
type: Comment
type: AnswerComment
has text: remove this line from all of them android:onClick="item3Click"

http://stackoverflow.com/comment/62777180
comment on: http://stackoverflow.com/a/23096221
score: 0
has text: Answer seems vague. I had to invoke method with null list arg. this worked: Deencapsulation.invoke(theObject, "methodName", List.class);
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23114609
has comment: http://stackoverflow.com/comment/35335039
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/23114321
type: Answer
has body: Indeed all of them (just perhaps Pascal is not a good choice), just take a look at these books : Network Programming in C C++ Network Programming, Volume I: Mastering Complexity with ACE and Patterns Java Network Programming, Third Edition A question with resources available on SO: Sockets in pascal
upvote count: 5

http://stackoverflow.com/comment/35342184
has text: Dave, thank you, that is better than nothing, but I hope there are some other ways also (+1)
comment on: http://stackoverflow.com/a/23118522
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38214747
score: 0
type: AnswerComment
has text: Sorry, it took me allot of time to finally start using it
type: Comment
comment on: http://stackoverflow.com/a/23119402

http://stackoverflow.com/q/23060464
downvote count: 0
answer count: 6
favorite count: 0
linked to: http://stackoverflow.com/q/8671397
has answer: http://stackoverflow.com/a/23060566
has answer: http://stackoverflow.com/a/23060508
duplicate of: http://stackoverflow.com/q/8671397
has answer: http://stackoverflow.com/a/23060532
score: 2
tagged with: equals
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23060505
has body: Integer a = new Integer(1); Integer b = new Integer(1); Long c = new Long(1); System.out.println(a.equals(b)); System.out.println(a.equals(c)); Question is why does a.equals(c) gives a false?
has answer: http://stackoverflow.com/a/23060535
tagged with: java
has title: Just need some enlightenment about .equals
type: Question
has comment: http://stackoverflow.com/comment/35238561
has answer: http://stackoverflow.com/a/23060546
has comment: http://stackoverflow.com/comment/35238163

http://stackoverflow.com/comment/77766194
score: 0
type: AnswerComment
has text: "The problem is the '\n' character that follows your integer." ->But what happen when continues nextInt twice
type: Comment
comment on: http://stackoverflow.com/a/23036112

http://stackoverflow.com/q/23095051
has answer: http://stackoverflow.com/a/23317449
has answer: http://stackoverflow.com/a/23291594
has comment: http://stackoverflow.com/comment/35387481
answer count: 3
tagged with: cryptography
has body: There are three types of default security levels of NTRU, implemented in bouncy-castle: 1. NTRUSigningKeyGenerationParameters.TEST157 2. NTRUSigningKeyGenerationParameters.APR2011_439 3. NTRUSigningKeyGenerationParameters.APR2011_743 First two are generated normally, but when I try to generate the tird one, I get the next Exception: SEVERE: Servlet.service() for servlet [mvc-dispatcher] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: Signing failed: too many retries (max=100)] with root cause java.lang.IllegalStateException: Signing failed: too many retries (max=100) Here is piece of my code: NTRUSigningPrivateKeyParameters ntruSigningPrivateKeyParameters1 = null; NTRUSigner ntruSigner = new NTRUSigner(ntruSigningKeyGenerationParameters.getSigningParameters()); try { ntruSigningPrivateKeyParameters1 = new NTRUSigningPrivateKeyParameters(ntruSigningPrivateKeyParameters.getEncoded(), ntruSigningKeyGenerationParameters); } catch (IOException e) { e.printStackTrace(); } ntruSigner.init(true, ntruSigningPrivateKeyParameters); byte [] res = ntruSigner.generateSignature(); Calling ntruSigner.generateSignature() with the third set of parameters leads to a such Exception. Does anyone knows how to solve it?
favorite count: 0
tagged with: digital-signature
tagged with: bouncycastle
downvote count: 0
has title: bouncycastle fails NTRU generation
has comment: http://stackoverflow.com/comment/35386186
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/23181499
accepted answer: http://stackoverflow.com/a/23181499
possible better answer: http://stackoverflow.com/a/23291594
tagged with: java
tagged with: ntrusign
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/35368645

http://stackoverflow.com/comment/35110840
type: Comment
comment on: http://stackoverflow.com/q/22990348
type: QuestionComment
has text: Hi matt, i am not very aware of Java, I know PHP, for me to try it would take a lot of time, i would love to try myslef, but if i could be sure it works, it would be great.
score: 0

http://stackoverflow.com/comment/35300697
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23094470
type: Comment
has text: @SavannahC123 If it works for you remember to chose it as the answer.

http://stackoverflow.com/q/22990029
favorite count: 0
has title: better to use one 3d array or two 2d?
tagged with: multidimensional-array
answer count: 3
has comment: http://stackoverflow.com/comment/35110361
has answer: http://stackoverflow.com/a/22990555
accepted answer: http://stackoverflow.com/a/22990510
has comment: http://stackoverflow.com/comment/35109868
upvote count: 1
has comment: http://stackoverflow.com/comment/35110637
possible better answer: http://stackoverflow.com/a/22990326
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35109896
tagged with: performance
has answer: http://stackoverflow.com/a/22990326
has comment: http://stackoverflow.com/comment/35110217
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35110187
has comment: http://stackoverflow.com/comment/35110300
type: Question
has answer: http://stackoverflow.com/a/22990510
has body: if i want to store two values in a 2d array, is it better (memory and speed-wise) to use one 3d array to store the values? or two 2d arrays? eg: int[][][] array = new int[rows][cols][data]; for(int i = 0; i &lt; rows; i++) for(int j = 0; j &lt; cols; j++) { array[i][j][0] = value1; array[i][j][1] = value2; } or int[][] array1 = new int[rows][cols]; int[][] array2 = new int[rows][cols]; for(int i = 0; i &lt; rows; i++) for(int j = 0; j &lt; cols; j++) { array1[i][j] = value1; array2[i][j] = value2; } or wouldnt it really matter in terms of performance? they arent massive arrays that i am using, only a hundred by a hundred at the most probably.. but if it was to scale up, which would be the best to use? or, if performance wont be affected at all, which would be considered the best coding practice? EDIT: this is related specifically to a java project, but more just interested in general; if there are different languages that would make a difference depending on the method used, that information could be useful as well for future reference..
downvote count: 0

http://stackoverflow.com/comment/35148440
type: Comment
type: QuestionComment
has text: How do i split up application into modules.can you elaborate having separate jar files containing the modules. I export the project as a war file.
score: 0
comment on: http://stackoverflow.com/q/23010385

http://stackoverflow.com/q/23106193
has answer: http://stackoverflow.com/a/23107286
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: jdbc
has body: i got promt.java and gui.java files. once i click on OK button on promt it will disappear and run db query. i wanted to get the query result on JTextField on gui.java tried SetText and append from the promt.java but didn't work. its getting the query result to a variable inside the promt but not getting it in gui. Promt Actionlistener for OK Button try{ Class.forName(jdbc_driver); con=DriverManager.getConnection(db_url, "root", ""); ps=con.prepareStatement(sql); rs=ps.executeQuery(); if(rs.next());{ i = 1; id=rs.getString("id")+""; ovog=rs.getString("ovog")+""; ner=rs.getString("ner")+""; cardnum1=rs.getString("card_number")+""; val=rs.getString("dvn")+""; GUI guu=new GUI(); guu.screen3.setText("id: "+id +" "+"ovog"+ovog+" "+"ner"+ner+" "+"card number"+cardnum1+" "+"dun"+val); }} catch(Exception e){ System.out.println("Not Found!"); e.printStackTrace(); } GUI Actionlistener public void actionPerformed(ActionEvent e) { if(e.getSource()==card){ Cardpromt cp=new Cardpromt(); cp.prompt(); }
tagged with: java
tagged with: swing
tagged with: jbutton
type: Question
has title: ActionListener between classes?
tagged with: actionlistener

http://stackoverflow.com/q/23014112
answer count: 1
has comment: http://stackoverflow.com/comment/35154351
score: 0
tagged with: android
has body: What I want to do: It should be something like a radar. I send my geocoords to an API and get "people" back, and also their distance to me. I have a round image as background, my radar screen, and I want to place a marker(another Image) on that image for every person I got back from the API. In the center is my position and depending on the distance and direction, that marker should be placed. While the radar is a circle I can´t work with normal coordinates(they would be a rectangle). So my first question is, can you give me a pest practice or any advice how to do this? Placing Bitmaps over Bitmaps? But How to place them inside that circle? On top of that, i want that markers to be clicked/touchable. If two or more markers are really near togehter, so that you cant touch/click them seperatly, I need a way to find out, which markers are clicked/touched. Or maybe in other words, which markers are placed inside the touched/clicked area. How should I implement this? Maybe android offers something I don´t think of (hopefully). Thanks in advance!!!
has answer: http://stackoverflow.com/a/23014420
has title: How to place Images(markers) inside a circle and make them clickable/touchable?
tagged with: bitmap
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23014420
tagged with: image
type: Question

http://stackoverflow.com/q/23002479
favorite count: 0
score: 0
tagged with: http://stackoverflow.com/tag/html
has title: Reading generated HTML file from link
upvote count: 1
downvote count: 1
has body: So my problem is that I can't seem to figure out how get the generated HTML page from a link, using Java. Here is the code I'm using: public class URLReader { public static void main(String[] args) throws Exception { URL oracle = new URL("http://www.whalesonggames.com/oldforums/printthread.php?t=7495&pp=20&page=1"); BufferedReader in = new BufferedReader(new InputStreamReader(oracle.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } } What I wanted to be printed out is: <!--[if IE]> <![endif]--> transfers transfers Printable View 04-10-2014, 06:59 AM CaNc3r transfers just wondering if we get our garrisons transfered also now? thank you. 04-10-2014, 08:03 AM replicatorz More at login says you can claim your grey corp with transfer. I am wondering what will happen now that I sold both sald corps in blue after claiming them on grey. I suppose for now I will leave them undeployed/empty. 04-10-2014, 08:07 AM scoutsniper I'd like some clarification as well. When grey server opened GNG sent a lead at to grey to hold our spot. Since then we have tformed our red server garrison a full level. Does the mean our garrison on grey is 11 or 12? 04-10-2014, 08:09 AM CaNc3r anyone having login issues after reset? 04-10-2014, 08:25 AM replicatorz Never mind. I reread login screen. Question answered. 04-10-2014, 08:50 AM Ozymandias If the original Feb 10th duplicate was PURGED (entirely deleted), or if it never exited (post Feb 10th), it was re-duplicated today. If it is being used on the new server, there was no re-duplication. It has always existed there. You can type :TRANSFER to see what corporation you would transfer into. 04-10-2014, 09:10 AM Kolpo What if I tried to transfer a corp after feb 10th and it's dissapeared is there a way for me to get that back? 04-10-2014, 09:11 AM Ozymandias http://www.whalesonggames.com/forums...copied-to-Grey 04-10-2014, 09:12 AM Ozymandias Quote: Originally Posted by Kolpo W…
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23003090
accepted answer: http://stackoverflow.com/a/23003090
type: Question
answer count: 1

http://stackoverflow.com/comment/35184255
comment on: http://stackoverflow.com/a/23030354
type: AnswerComment
has text: @esprittn Okay, what is the duration of your audio file?
score: 0
type: Comment

http://stackoverflow.com/q/23105066
duplicate of: http://stackoverflow.com/q/2059431
answer count: 1
has title: Javadoc for StringUtils
tagged with: maven
linked to: http://stackoverflow.com/q/2059431
has comment: http://stackoverflow.com/comment/35317928
type: AnsweredQuestion
tagged with: java
tagged with: javadoc
has answer: http://stackoverflow.com/a/23105499
accepted answer: http://stackoverflow.com/a/23105499
type: Question
tagged with: eclipse
has body: I've added a maven dependency for StringUtils (org.apache.commons.lang) commons-lang 2.6 I want to see javadoc of that jar , otherwise the javadoc for each functions in (org.apache.commons.lang) when I point the cursor in this function, is there some dependency for it?
tagged with: string-utils
score: 0

http://stackoverflow.com/comment/35186687
comment on: http://stackoverflow.com/q/23031339
type: Comment
type: QuestionComment
score: 0
has text: is there any standard method to find it?

http://stackoverflow.com/q/23041497
upvote count: 5
score: 5
tagged with: layout
has body: I have tried to add a rating bar to my activity but I cannot add or remove stars on user's touch. what should i add? <TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/feedback" /> <View android:layout_width="wrap_content" android:layout_height="30dp" /> <RatingBar android:id="@+id/serviceRatingBar" style="?android:attr/ratingBarStyleIndicator" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" /> <TextView android:id="@+id/price" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:text="@string/service" />
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23042606
tagged with: android
has title: why is my rating bar not changing on user touch?
tagged with: java
accepted answer: http://stackoverflow.com/a/23042606
type: Question
type: AnsweredQuestion
tagged with: android-layout

http://stackoverflow.com/a/23055184
score: 0
type: Answer
has body: If you have added the user's email (Google email Id) as a test user under the Settings -> License Testing section in developer console, then the purchases made by that account will be test purchases. Remove the email and the user can make real purchases even if he has opted in as alpha-beta tester.
answers question: http://stackoverflow.com/q/22976481

http://stackoverflow.com/q/23015554
has comment: http://stackoverflow.com/comment/35156679
upvote count: 2
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/23054953
score: 2
has title: JPA 2.1, Hibernate 4.3, Spring 4.0 data not saving to database
tagged with: java
tagged with: hibernate
has body: I have an app that uses spring 4.0,JPA 2.1, Hibernate 4.3.5, Glassfish 4.0 and JTA transaction manager. After I updated JPA from 2.0 to 2.1 and from Hibernate 4.2.x to 4.3 the data is not saved into database anymore although the logs seems ok. So these are may config files : entityManager false false false org.hibernate.dialect.PostgreSQLDialect org.hibernate.transaction.SunONETransactionManagerLookup org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory true true ehcache.xml org.hibernate.cache.ehcache.EhCacheProvider false my transaction manager: <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes > <tx:method name="get*" rollback-for="java.lang.Exception" propagation="REQUIRED" read-only="true"/> <tx:method name="is*" rollback-for="java.lang.Exception" propagation="REQUIRED" read-only="true"/> <tx:method name="*" rollback-for="java.lang.Exception" propagation="REQUIRED" read-only="false"/> </tx:attributes> </tx:advice> <aop:aspectj-autoproxy/> <aop:config> <aop:pointcut id="cs" expression="execution(* com.videanuadrian.contactcenter.services..*.*(..))"/> <aop:advisor advice-ref="txAdvice" pointcut-ref="cs" /> </aop:config> <aop:config> <aop:pointcut id="pcCore" expression="execution(* com.videanuadrian.core.impl.services..*.*(..))"/> <aop:advisor advice-ref="txAdvice" pointcut-ref="pcCore"/> </aop:config> <jee:jndi-lookup id="CCDS" jndi-name="jdbc/contactCenter"/> All my DAO classes inheit this class: public abstract class GenericDAOImpl<T> implements GenericDAO<T> { @PersistenceContext(type = PersistenceContextType.TRANSACTION,synchronization=SynchronizationType.SYNCHRONIZED) protected EntityManager em; private Class<T> type; protected static final Logger logger = Logger.getLogger(GenericDAOImpl.class); public GenericDAOImpl() { Type t = getClass().getGenericSuperclass(); ParameterizedType pt = (ParameterizedType) t; type = (Class) pt.getActualTypeArguments()[0]; } public EntityManager getEm() { return em; } public void setEm(En…
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35158226
has comment: http://stackoverflow.com/comment/35158491
has comment: http://stackoverflow.com/comment/35156504
tagged with: jpa
downvote count: 0
tagged with: jta
has comment: http://stackoverflow.com/comment/35158085
favorite count: 0
has comment: http://stackoverflow.com/comment/35158350
has answer: http://stackoverflow.com/a/28281262

http://stackoverflow.com/comment/35200208
comment on: http://stackoverflow.com/a/23039278
type: Comment
has text: What are you going to do when Java decides to change their RGB format? This is highly unlike, I agree, but there must be some reason that Java does _not_ provide methods for converting an integer RGB value to the red/green/blue components (and I still don't get why they don't).
score: 0
type: AnswerComment

http://stackoverflow.com/a/76669722
answers question: http://stackoverflow.com/q/22999265
score: 0
has body: @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) try this
type: Answer

http://stackoverflow.com/comment/35220928
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23051018
has text: And how is it useful with the problem? Just asking.
type: AnswerComment

http://stackoverflow.com/a/22988884
has body: Your adapter should implement ListAdapter which uses the observer pattern. Then create a list of DataSetObservers and use that, e.g.: public class MainArrayAdapter extends ArrayAdapter&lt;String&gt; implements ListAdapter { private List&lt;DataSetObserver&gt; observers = new LinkedList&lt;DataSetObserver&gt;(); //... public void setArray(ArrayList&lt;String&gt; data_array) { this.data_array = data_array; for (DataSetObserver observer : observers) { observer.onChanged(); } } @Override public void registerDataSetObserver(DataSetObserver dataSetObserver) { ((LinkedList) observers).addFirst(dataSetObserver); } @Override public void unregisterDataSetObserver(DataSetObserver dataSetObserver) { observers.remove(dataSetObserver); } } Update: To include this into your application, you will have to change both the MainActivity and the SettingsActivity as follows: public class MainActivity extends ListActivity implements OnPreparedListener, MediaController.MediaPlayerControl { // ... private static MainArrayAdapter adapter; private static ArrayList&lt;String&gt; array_list_music = new ArrayList&lt;String&gt;(); // ... static void addSong(String song) { MainActivity.array_list_music.add(song); adapter.setArray(array_list_music); } } and public class SettingsActivity extends Activity { // ... private void addSong(String artist, String songName, String directLink) { MainActivity.addSong(songName + " ### " + artist + " ### " + directLink); } } To explain: You can't create a new instance of MainActivity every time you want to update the list; it will be a new list every time. Making array_list_music static will ensure you don't have to do this. Accessing array_list_music directly will force you to implement the same code over and over again. The MainActivity#addSong method capsulates this behavior and, as it is static, doesn't depend on an instance of MainActivity. In addSong we use the method implemented in MainArrayAdapter that will notify all listeners of an update; that way the…
has comment: http://stackoverflow.com/comment/35131398
has comment: http://stackoverflow.com/comment/35139596
type: Answer
answers question: http://stackoverflow.com/q/22988653
has comment: http://stackoverflow.com/comment/35189171
has comment: http://stackoverflow.com/comment/35130001
has comment: http://stackoverflow.com/comment/35120985
score: 0

http://stackoverflow.com/comment/35196963
type: Comment
comment on: http://stackoverflow.com/a/23034610
type: AnswerComment
has text: Thanks for the suggestion , I removed the ajax call and created a form and worked like a charm
score: 0

http://stackoverflow.com/q/23042062
answer count: 2
has answer: http://stackoverflow.com/a/23042151
has comment: http://stackoverflow.com/comment/35204281
has answer: http://stackoverflow.com/a/23042121
accepted answer: http://stackoverflow.com/a/23042121
possible better answer: http://stackoverflow.com/a/23042151
type: AnsweredQuestion
has body: In the following Code I am trying to use the annotation I created in another file. I don't understand why I have to write Class c=test.getClass(); As I already created a object of TEST class then why this is needed? I tried without using this Class c=test.getClass(); But it showed error public static void showAnnotations() // Function to show annotation information { TEST test=new TEST(); // Instantiating Test class try { Class c=test.getClass(); // Getting Class reference java.lang.reflect.Method m=c.getMethod("testMethod"); // Getting Method reference // Getting Class annotation MyAnnotation annotation1= (MyAnnotation)c.getAnnotation(MyAnnotation.class); // Getting Method annotation MyAnnotation annotation2=m.getAnnotation(MyAnnotation.class); // Displaying annotation information System.out.println("Author of the class: "+annotation1.author()); // Displaying annotation information System.out.println("Date of Writing the class: "+annotation1.date()); // Displaying annotation information System.out.println("Author of the method: "+annotation2.author()); // Displaying annotation information System.out.println("Date of Writing the method: "+annotation2.date()); } catch(NoSuchMethodException ex) { System.out.println("Invalid Method..."+ex.getMessage()); } }
type: Question
tagged with: jakarta-ee
tagged with: java
has title: Annotation in Java Why Class type reference is created?
score: 0

http://stackoverflow.com/comment/35222032
score: 1
has text: Please do include the text version so that i can try that out
type: AnswerComment
comment on: http://stackoverflow.com/a/23044675
type: Comment

http://stackoverflow.com/a/23003224
score: 0
answers question: http://stackoverflow.com/q/23003172
has body: add layout_weight parameter to each part( i added 90% scrollview 10% button) <?xml version="1.0" encoding="utf-8"?>
type: Answer

http://stackoverflow.com/comment/35348916
type: Comment
type: QuestionComment
has text: This question is really vague. Can you back this up with evidence?
score: 1
comment on: http://stackoverflow.com/q/23122321

http://stackoverflow.com/comment/35149359
comment on: http://stackoverflow.com/q/23010810
score: 1
type: Comment
has text: What can be gained by returning defensive copies? It can only make matters *worse* as far as memory occupation is concerned.
type: QuestionComment

http://stackoverflow.com/comment/35318742
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23104274
has text: yes. I created table manually with auto generate selected
score: 0

http://stackoverflow.com/a/23067677
has comment: http://stackoverflow.com/comment/35354419
has body: Changed your code like this. To quickly skip it on its failure. // Doing some JDBC Connections here Map&lt;String,Connection&gt; connections = new HashMap&lt;&gt;(); try { while(DeviceRS.next()){ try{ final String ip_address = DeviceRS.getString("Connection_vch"); connections.put(ip_address,DriverManager.getConnection("jdbc:mysql://" + ip_address + ":3306/test",RemoteUser,RemotePass)); } catch(SQLException ex){ ex.printStackTrace(); } } catch(Exception ex){ ex.printStackTrace(); System.out.println("in catch block"); //System.exit(0); // dont use this -in real time projects }finally{ System.out.println("in finally block"); } for(final String ip : connections.keySet()) { // Selecting and inserting into database here ... }// ENd of for loop }// ENd of try block
has comment: http://stackoverflow.com/comment/35293075
score: 1
has comment: http://stackoverflow.com/comment/35292571
has comment: http://stackoverflow.com/comment/35292274
upvote count: 1
has comment: http://stackoverflow.com/comment/35291901
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23067518
answers question: http://stackoverflow.com/q/23067518
has comment: http://stackoverflow.com/comment/35380300
type: Answer
has comment: http://stackoverflow.com/comment/35394419
downvote count: 0
has comment: http://stackoverflow.com/comment/35371353
has comment: http://stackoverflow.com/comment/35367139

http://stackoverflow.com/a/22997804
has comment: http://stackoverflow.com/comment/35124881
type: Answer
score: 3
answers question: http://stackoverflow.com/q/22997733
has comment: http://stackoverflow.com/comment/35124479
upvote count: 3
has comment: http://stackoverflow.com/comment/35128886
has comment: http://stackoverflow.com/comment/35124928
accepted answer of: http://stackoverflow.com/q/22997733
has comment: http://stackoverflow.com/comment/35128948
has comment: http://stackoverflow.com/comment/35124594
has body: The solution is simple: Either use a JFormattedTextField (as you already know) or use a DocumentFilter. For example: DocumentFilter Example 1 DocumentFilter Example 2 For tutorial: DocumentFilter Tutorial Edit Your problem is in your validate method: it will allow "3" since that's in the list, but won't allow "33" since that's not in the list.
has comment: http://stackoverflow.com/comment/35124441
has comment: http://stackoverflow.com/comment/35129012
has comment: http://stackoverflow.com/comment/35129168
has comment: http://stackoverflow.com/comment/35129056
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35128769
has comment: http://stackoverflow.com/comment/35125037
has comment: http://stackoverflow.com/comment/35124741

http://stackoverflow.com/q/23018606
has body: I'm trying to make a java program which blocks the facebook page in web browsers. I'm trying to overwrite somehow the hosts file, but the file is disabled to overwriting. I tried to copy him to my desktop, then append a line which blocks the page, and then copy to the etc folder and click to copy (or overwrite) the file. But i can't do it in java, all what i did was create another file in the same folder and append lines to it. But then i can't copy the new file to old, i dont know how to do it, here's my code, i'm waiting for a solutions :) public class Sandbox { private final static File zdroj = new File("C:\\Windows\\System32\\drivers\\etc\\hosts"); private final static File ciel = new File("C:\\Windows\\System32\\drivers\\etc\\hostsTemp"); public static void main(String[] args) { try { Files.copy(zdroj.toPath(), ciel.toPath()); PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(ciel, true))); writer.append("\n\n127.0.0.1 facebook.com www.facebook.com http://www.facebook.com/ http://facebook.com"); writer.close(); Files.delete(zdroj.toPath()); Files.copy(ciel.toPath(), zdroj.toPath()); } catch (IOException ex) { Logger.getLogger(Sandbox.class.getName()).log(Level.SEVERE, null, ex); } } }
has comment: http://stackoverflow.com/comment/35162467
favorite count: 0
has comment: http://stackoverflow.com/comment/35162418
has title: AccessDeniedException: C:\Windows\System32\drivers\etc\hosts
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/35162654
tagged with: java
downvote count: 3
tagged with: file
type: Question
has answer: http://stackoverflow.com/a/23018682
upvote count: 0
has comment: http://stackoverflow.com/comment/35162282
has comment: http://stackoverflow.com/comment/35162334
answer count: 1

http://stackoverflow.com/comment/35301520
has text: @CodeCamper I'd like to point out that I neither flagged the question nor said anything negative about it. I provided some code, some pseudocode, some explanation, and some communication guidance for the OP, and was called "rude" in response. Someone else wrote the entire answer for her, and got a "Thank you for your help." Your comment about "backlash" and her comment about my rudeness really make me sorry that I took the time to write anything at all. Is it really rude to ask for a better question than "I am confused." after having already demonstrated a willingness to help?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23093278

http://stackoverflow.com/comment/35347514
has text: Boolean flag doesn't work. The painting just doesn't show up.
score: 0
comment on: http://stackoverflow.com/q/23121339
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23016145
answers question: http://stackoverflow.com/q/23015780
score: 0
has body: Depending how you're using the MaxSizeHandler class it may make sense to make this class itself generic. For example, if you need to iterate over the collection: public class MaxSizeHandler&lt;T&gt; extends AbstractValueHandler&lt;Collection&lt;? extends T&gt;&gt; { public void handle(Collection&lt;? extends T&gt; coll) { for(T item : coll) { // ... } } } or if you need to add new items to the collection: public class MaxSizeHandler&lt;T&gt; extends AbstractValueHandler&lt;Collection&lt;? super T&gt;&gt; { public void handle(Collection&lt;? super T&gt; coll) { T item = createAnItem(); coll.add(item); } } (These are just toy examples, as you haven't said what kind of methods AbstractValueHandler declares)
type: Answer

http://stackoverflow.com/q/23127529
tagged with: web-services
has body: How to get image from android image view and how to store that value into database?
accepted answer: http://stackoverflow.com/a/23127609
type: AnsweredQuestion
tagged with: performance
tagged with: java
has answer: http://stackoverflow.com/a/23127609
downvote count: 1
type: Question
upvote count: 0
score: -1
answer count: 1
has title: how to get image from Android imageview and storing into db
favorite count: 0
tagged with: rest
tagged with: android

http://stackoverflow.com/comment/35220764
type: QuestionComment
comment on: http://stackoverflow.com/q/23050921
has text: Ignore the fact I'm using implements Runnable, this is only because my main method is separated from the exemples and each example implements Runnable (In scala I just use sbt and the tool figures out each main class in the directory)
score: 0
type: Comment

http://stackoverflow.com/a/22972990
downvote count: 0
has body: Generating the client side code from the WSDL indeed also generates the HelloWorld interface. In practice, when you create a web service client, all you have is the WSDL. You don't have the server side source code, as usually the server is run by some third party. That is why this interface is generated when you generate client side code, but also when you generate server side code. But if you happen to own both the server side code and the client side code then you can consider putting the common source files in one shared module and eliminate duplicates.
accepted answer of: http://stackoverflow.com/q/22972170
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22972170

http://stackoverflow.com/q/22978403
has answer: http://stackoverflow.com/a/22978465
has title: java.lang.NullPointerException error?
duplicate of: http://stackoverflow.com/q/218384
accepted answer: http://stackoverflow.com/a/22978459
has comment: http://stackoverflow.com/comment/35089547
has body: I am using collision to detect the red rectangle when the bullet from the oval hits it. But when I try to run it gives me these errors. The bullet only comes out when I press SPACE. I wanted to test it so that I can use it when I create a simple game. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class JavaGame2 extends JPanel implements KeyListener,Runnable{ //variables JFrame frame; int x, y, xDir, yDir,bx,by; Rectangle bullet; boolean readyTofire, shot = false; //constructor for game public JavaGame2(){ frame = new JFrame("Java Game"); int x=150; int y=150; } //drawings public void paintComponent(Graphics g){ super.paintComponent(g); this.setBackground(Color.WHITE); Rectangle rec = new Rectangle(50, 20, 50, 50); g.setColor(Color.BLUE); g.fillOval(x, y, 55, 55); g.fillRect(x+23, y-15, 10, 20); g.setColor(Color.RED); g.fillRect(rec.x, rec.y, rec.width, rec.height); if(shot){ g.setColor(Color.BLACK); g.fillRect(bullet.x, bullet.y, bullet.width, bullet.height); } //this collision part is giving me an error******************** if(bullet.intersects(rec)); g.drawString("collision!", 50, 20); repaint(); } public void setxDir(int xdir){ xDir = xdir; } public void setyDir(int ydir){ yDir = ydir; } //key event listener keypressed public void keyPressed(KeyEvent e) { int code = e.getKeyCode(); if(code == KeyEvent.VK_UP){ setyDir(-1); } if(code == KeyEvent.VK_DOWN){ setyDir(+1); } if(code == KeyEvent.VK_LEFT){ setxDir(-1); } if(code == KeyEvent.VK_RIGHT){ setxDir(+1); } if(code == KeyEvent.VK_SPACE){ if(bullet == null ){ readyTofire = true; if(readyTofire){ bx = x+26; by = y-15; bullet = new Rectangle(bx, by, 5, 3); shot = true; } } } } //key event listener for key released public void keyReleased(KeyEvent e) { int code = e.getKeyCode(); if(code == KeyEvent.VK_UP){ setyDir(0); } if(code == KeyEvent.VK_DOWN){ setyDir(0); } if(code == KeyEvent.VK_LEFT){ setxDir(0); } if(code == KeyEvent.VK_RIGHT){ setxDir(0); } if(code == KeyEvent.VK_SPACE){ readyTofi…
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22978465
has comment: http://stackoverflow.com/comment/35089350
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22978459
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/35089376

http://stackoverflow.com/a/23017019
has body: The compiler is pointing it out because there is a possibility that the for/while blocks do not execute, which would mean that lineOld is not initialized. It's looking for you to initialize it outside of a block.
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23016960

http://stackoverflow.com/a/23137478
type: AcceptedAnswer
downvote count: 0
score: 8
upvote count: 8
accepted answer of: http://stackoverflow.com/q/23064525
type: Answer
answers question: http://stackoverflow.com/q/23064525
has body: I resolved it, it was related to onCreateAnimation() that i used to know when the animation was finished view.setLayerType(LAYER_TYPE_NONE, null); this line was doing the crash. It seems to be related to hardware acceleration and most likely only on android 4.3 see this link : Disable hardware acceleration, backward compatibility

http://stackoverflow.com/comment/35345193
has text: `addEntity(new Enemy((Math.Random() > 0.5 ? 200 : 450), -10, tex, this, game));` perhaps?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23120039

http://stackoverflow.com/comment/35335282
type: Comment
has text: Well I now made my program class toss the shaders after the linking and now it works! I still dont't really know what exactly the problem was but now it's gone. Thanks!
type: AnswerComment
comment on: http://stackoverflow.com/a/23079234
score: 0

http://stackoverflow.com/a/23114195
downvote count: 0
upvote count: 2
has body: If the elements are primitives, then the fastest structure will most probably be a specialized primitive collection (e.g., trove). Following references for boxed primitives is a nearly sure cache miss and this probably dominates the costs. I wouldn't suggest a LinkedList for the same reason: It's dead slow due to cache misses. If the order is unimportant, than an ArrayList is perfect. Instead of removing an element, replace it by the last one and remove the last array element. This is an O(1) operation and doesn't suffer from the bad spatial locality. If the order is important, you can build your own ArrayList-like structure. Instead of removing an element, you mark it for removal e.g. in a BitSet or in a boolean[]. Finally you perform the removal in one sweep by moving all elements to their right position and adjusting the length. The optimized loop will most probably look similar to CharMatcher.removeFrom loop. A simpler solution would be to use an ArrayList and copy all surviving elements to another one. I'd bet it'd beat the LinkedList hands down. As a minor GC-friedly optimization you can work with two lists.
type: Answer
answers question: http://stackoverflow.com/q/23108120
score: 2

http://stackoverflow.com/comment/35223170
has text: A `Map<String,Integer>` could be used to maintain a count of the occurrences of each scoring rule. Then divide counts by total.
comment on: http://stackoverflow.com/q/23052259
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22994258
type: Answer
has body: First of all, I didn't look your code to be honest (sry about that), but what you are asking is something very simple. Have you noticed that all emoticons have a sequence of characters? Skype Example: :* :) (y) ... and so on When compiling the message, a simple replaceAll takes place. String message = "Of course :)"; // in this place here you will make a loop for all your emoticons or just // match it by regex. message = message.replaceAll(":)", imageToAdd); sendMessage(message); That is basically what happens in the chat when you add an emoticon. You can use a HashMap to, where the id would be the char sequence and the value would be the path or image component of that emoticon. (It is much faster if you have several)
score: 1
answers question: http://stackoverflow.com/q/22993918
has comment: http://stackoverflow.com/comment/35117864
has comment: http://stackoverflow.com/comment/35201544
has comment: http://stackoverflow.com/comment/35119416
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/43333962
score: 2
has text: I followed your instructions and now I can't open netbeans 8
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25270507

http://stackoverflow.com/a/24606000
accepted answer of: http://stackoverflow.com/q/23037462
type: Answer
upvote count: 4
downvote count: 0
score: 4
has body: To disable ACRA's logging, you might want to use this implementation of the ACRALog interface: public class NoAcraLog implements ACRALog { @Override public int v(String tag, String msg) { return 0; } @Override public int v(String tag, String msg, Throwable tr) { return 0; } @Override public int d(String tag, String msg) { return 0; } @Override public int d(String tag, String msg, Throwable tr) { return 0; } @Override public int i(String tag, String msg) { return 0; } @Override public int i(String tag, String msg, Throwable tr) { return 0; } @Override public int w(String tag, String msg) { return 0; } @Override public int w(String tag, String msg, Throwable tr) { return 0; } @Override public int w(String tag, Throwable tr) { return 0; } @Override public int e(String tag, String msg) { return 0; } @Override public int e(String tag, String msg, Throwable tr) { return 0; } @Override public String getStackTraceString(Throwable tr) { return null; } } Provide an instance of this class to ACRA: ACRA.setLog(new NoAcraLog()); This should disable all logging of ACRA since the abovementioned implementation would do nothing. (FYI: normally ACRA uses AndroidLogDelegate which redirects log messages to the Log class.)
answers question: http://stackoverflow.com/q/23037462
type: AcceptedAnswer

http://stackoverflow.com/q/23034837
score: 14
type: AnsweredQuestion
tagged with: playframework-2.0
downvote count: 0
tagged with: java
tagged with: post
type: Question
has body: I'm using play framework in Java. I want to retrieve the entire request body sent in a POST request to the play server. How can I retrieve it?
has answer: http://stackoverflow.com/a/29971210
has answer: http://stackoverflow.com/a/28144581
has title: Retrieve the request body string sent in POST request in play framework java
has answer: http://stackoverflow.com/a/50660107
upvote count: 14
possible better answer: http://stackoverflow.com/a/29971210
tagged with: playframework
favorite count: 0
has answer: http://stackoverflow.com/a/23035201
accepted answer: http://stackoverflow.com/a/23035201
has answer: http://stackoverflow.com/a/75623987
answer count: 5

http://stackoverflow.com/comment/35208768
has text: thank you very much for your answer and going through my question.Could you please tell me what does 'DTO' classs means here and how to configure it.Is it a new class that we have to create ?
type: Comment
comment on: http://stackoverflow.com/a/23042626
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35175383
has text: it will be working fine , if your jar file is correctly created. follow the link for ,"how to create jar" : http://www.mkyong.com/java/how-to-make-an-executable-jar-file/
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23025125
type: Comment

http://stackoverflow.com/q/23008711
type: UnansweredQuestion
tagged with: java
upvote count: 1
tagged with: logging
type: Question
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has title: Where can I find my Log file?
has answer: http://stackoverflow.com/a/23008849
has body: I have following statements imported in my project: import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; and following being written in my class: private static Log logger = LogFactory.getLog(ClassName.class); logger.info("BEGIN query"); logger.severe("data is required"); I am running my project in Eclipse, without using server. Could anyone help me to find out the location where these logs will be written while running the program ?

http://stackoverflow.com/q/23089238
tagged with: interface
tagged with: android
accepted answer: http://stackoverflow.com/a/23089455
favorite count: 0
has comment: http://stackoverflow.com/comment/35289979
has answer: http://stackoverflow.com/a/23089537
score: 0
answer count: 2
upvote count: 1
downvote count: 1
possible better answer: http://stackoverflow.com/a/23089537
tagged with: command-pattern
has comment: http://stackoverflow.com/comment/35290248
tagged with: java
has answer: http://stackoverflow.com/a/23089455
has title: Method code depending on value of Instance?
tagged with: class
type: AnsweredQuestion
has body: I have a question for Android (Java). Lets say i have a list of commands (each one with command name, and execute method). The execute method has different code depending on the command name (i.e. Command "GET GPS LOCATION" -> execute Method returns Location value). So, I could use a single Command class with a switch-case in the execute method checking the name of the command and executing the code. Or make a class for every command (which is not the best way i guess, because i have 80+ commands). Or should i use an interface? Or is there a better way at all? Thanks for your help!
type: Question

http://stackoverflow.com/comment/35359541
comment on: http://stackoverflow.com/a/23127466
type: AnswerComment
has text: You want them in simulations, which is a large part of why you're using PRNGs there (storing just a seed for reproducible results instead of all random numbers needed :-))
type: Comment
score: 1

grouplayout
type: Tag
tag name: grouplayout
tags question: http://stackoverflow.com/q/23038274

http://stackoverflow.com/comment/35215535
type: AnswerComment
type: Comment
has text: @user3503794 Anymore errors? This code will loop just as you asked.
comment on: http://stackoverflow.com/a/23047945
score: 0

http://stackoverflow.com/comment/35402666
has text: @Michael I once did something similar and indeed the `foreach` loop seems to be a bit slower than regular `for` loops. Not by much, but if that loop is run thousands or millions of times, it might matter. Still, I agree that it should not be necessary to replace _all_ those loops.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23110422

osmdroid
type: Tag
tag name: osmdroid
tags question: http://stackoverflow.com/q/22992499
tags question: http://stackoverflow.com/q/23117111
tags question: http://stackoverflow.com/q/23041975
tags question: http://stackoverflow.com/q/23108709

http://stackoverflow.com/comment/35125310
comment on: http://stackoverflow.com/q/22983576
score: 0
type: Comment
type: QuestionComment
has text: From the documentation: Messages that are externally expunged by another source are marked "expunged" and return true for the isExpunged() method, but they are not removed from the Folder until an explicit expunge() is done on the Folder. Could that be the case for you?

http://stackoverflow.com/a/23048846
accepted answer of: http://stackoverflow.com/q/23048763
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23048763
has comment: http://stackoverflow.com/comment/35217186
has body: You are dismissing your dialog as soon as it runs with ringProgressDialog.dismiss();. That line should be removed and you should do something like send out a broadcast when you are finished to close the progress dialog. It looks like you might also just want a background thread rather than a second Activity because no user interaction is required. Looking at AsyncTask would be the easiest way for you to start with background threads and it's 'onPostExecute` method will allow you to dismiss your dialog. Edit The basic structure you want is to add the following new AsyncTask&lt;Void, Void, Void&gt;() { @Override protected void onPreExecute() { super.onPreExecute(); //TODO: show your dialog from here } @Override protected Void doInBackground(Void... params) { //TODO: call Calculations(128); from here //Calculations(128); should live within this async task instead of a new activity return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); //TODO: call dismiss on your dialog from here } }.execute(); instead of the new Thread(new Runnable() { block you currently have
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35217223
has comment: http://stackoverflow.com/comment/35217081

http://stackoverflow.com/a/23022742
answers question: http://stackoverflow.com/q/23008297
type: AcceptedAnswer
has body: You need to use the @JoinColumns annotation (note the 's'): class Trip { @ManyToOne @JoinColumns(foreignKey = @ForeignKey(name = "FK_USER") private User user; }
has comment: http://stackoverflow.com/comment/35230322
has comment: http://stackoverflow.com/comment/35229712
type: Answer
upvote count: 6
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23008297
score: 5

http://stackoverflow.com/comment/35087583
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22972643
type: AnswerComment
has text: Looks like that did it. Edited the post to reflect the change. Added another function to my BoardState class that notified if 2 (n - 1) pieces were in position.

http://stackoverflow.com/comment/35217578
type: Comment
type: QuestionComment
has text: Usually not enough code, _this time_ too much code. What is your condition that you want the loop to stop running? Royal Flush is very unlikely.
comment on: http://stackoverflow.com/q/23049088
score: 0

http://stackoverflow.com/comment/35210544
type: QuestionComment
has text: This is supposed to be the expected behavior I suppose: https://groups.google.com/forum/#!topic/adt-dev/0ZAP8AVUZVw ! I think i must download the picasso jar and then gradle will include it automatically, otherwise it doesnt. Will give it a try and post an answer
score: 0
comment on: http://stackoverflow.com/q/23042803
type: Comment

http://stackoverflow.com/q/23004545
has answer: http://stackoverflow.com/a/23004629
has comment: http://stackoverflow.com/comment/35142605
type: Question
favorite count: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/23004629
score: 1
has body: As i went through apache poi documentation, they say you can get information of freeze or split pane using PanelInformation object in util package. And for that i need object of HSSFSheet class. I am able to get HSSFSHeet object but when I am trying to get PanelInformation from it using getPanelInformation method. It returns me null. HSSFWorkbook workbook = new HSSFWorkbook(file); HSSFSheet sheet = workbook.getSheetAt(sheetNumber); workbook.setActiveSheet(sheetNumber); System.out.println(sheet.getPaneInformation());
tagged with: apache-poi
upvote count: 3
downvote count: 2
tagged with: excel
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23018243
tagged with: java
has answer: http://stackoverflow.com/a/23018243
has answer: http://stackoverflow.com/a/33416057
has title: How to get information of freeze or split columns in excel while reading using apache poi?

http://stackoverflow.com/comment/35081039
type: QuestionComment
has text: use logging such as log4j and use debug/log in place of System.out.
score: 2
comment on: http://stackoverflow.com/q/22973572
type: Comment

http://stackoverflow.com/q/22976560
has answer: http://stackoverflow.com/a/22977055
accepted answer: http://stackoverflow.com/a/22977055
score: 2
linked to: http://stackoverflow.com/q/15728619
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
upvote count: 2
has title: Creating a custom Bound Property
tagged with: javabeans
has comment: http://stackoverflow.com/comment/35086199
has comment: http://stackoverflow.com/comment/35086183
answer count: 1
has comment: http://stackoverflow.com/comment/35086497
has comment: http://stackoverflow.com/comment/35086263
favorite count: 0
linked to: http://stackoverflow.com/q/9346912
has body: Explanation I've created an example of my current project, but in SSCCE form. CODE WAS UPDATED: import java.awt.EventQueue; import java.awt.GridLayout; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.WindowConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class Test2 extends JFrame{ private Panels panel1, panel2; public Test2(){ init(); } private void init(){ setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setLayout(new GridLayout(0,1)); panel1 = new Panels("Test1"); panel2 = new Panels("Test2"); add(panel1.getPanel()); add(panel2.getPanel()); pack(); setVisible(true); } public class Panels { private JSlider slider; private JPanel panel; private JLabel label; private ChangeListener changeListener; private PropertyChangeSupport changeSup; public Panels(String text){ slider = new JSlider(); slider.setMajorTickSpacing(50); slider.setMaximum(255); slider.setMinorTickSpacing(10); slider.setPaintLabels(true); slider.setPaintTicks(true); setSliderValue(0); label = new JLabel(); label.setText("0"); changeListener = new ChangeListener(){ @Override public void stateChanged(ChangeEvent e) { setLabelText(String.valueOf(getSliderValue())); } }; slider.addChangeListener(changeListener); panel = new JPanel(); panel.add(label); panel.add(slider); } public final int getSliderValue() { return slider.getValue(); } public final void setSliderValue(int value) { slider.setValue(0); } public final String getLabelText() { return label.getText(); } public final void setLabelText(String text) { String oldLabelText = getLabelText(); label.setText(text); changeSup.firePropertyChange("value", oldLabelText, getLabelText()); } public voi…
has comment: http://stackoverflow.com/comment/35086215
tagged with: propertychangelistener
tagged with: swing

http://stackoverflow.com/comment/35365541
comment on: http://stackoverflow.com/a/23119000
has text: Was the first step successful?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23026410
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23026392
has body: Something like this: StringBuilder sb = new StringBuilder(); sb.append(charArr); Double d = Double.parseDouble(sb.toString());
upvote count: 2
type: Answer

http://stackoverflow.com/comment/35104091
type: Comment
comment on: http://stackoverflow.com/a/22986876
has text: what values are you passing into the method updateDescription( String desc, String title, int urlid ) ?? if you are passing correct values in correct format it should definitely work. kindly check the values you are providing to the method. you can always use a System.out.println(); to check the values.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35204524
type: AnswerComment
has text: So what if exceptions are generated ? We can handle exceptions also.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23042261

http://stackoverflow.com/comment/35097625
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22983172
has text: It does not matter. As long as the primary key can be ordered you may use this strategy. The one from @Varun Achar should work as well.

http://stackoverflow.com/q/23012400
has answer: http://stackoverflow.com/a/23059575
tagged with: deployment
score: 0
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/23026348
type: UnansweredQuestion
tagged with: struts2
tagged with: security
has comment: http://stackoverflow.com/comment/35162186
type: Question
has title: From struts 2.0.14 to 2.3.16.1. Class not found for RuleSet
has body: for security reason I have to update the reference of struts2-tiles-plugin from 2.0.X to 2.3.16.1. I update my web.xml with: struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* but when I deploy the application an error appear: 12:20:57,851 ERROR /pectWeb StandardWrapper.Throwable java.lang.NoClassDefFoundError: org/apache/commons/digester/RuleSet at org.quartz.plugins.xml.JobInitializationPlugin.processFile(JobInitializationPlugin.java:397) at org.quartz.plugins.xml.JobInitializationPlugin.start(JobInitializationPlugin.java:375) at org.quartz.core.QuartzScheduler.startPlugins(QuartzScheduler.java:1919) at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:397) at org.quartz.impl.StdScheduler.start(StdScheduler.java:147) at org.quartz.ee.servlet.QuartzInitializerServlet.init(QuartzInitializerServlet.java:158) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:950) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4122) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4417) at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:321) at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:145) at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461) at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118) at org.jboss.web.deployers.WebModule.start(WebModule.java:97) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157) at org.jboss.m…
tagged with: digest

http://stackoverflow.com/q/23110577
type: Question
has comment: http://stackoverflow.com/comment/35396808
has comment: http://stackoverflow.com/comment/35327140
answer count: 1
favorite count: 0
tagged with: face-detection
has title: is it possible to apply car detection on IMAGE using haar cascade method in OpenCV?
has comment: http://stackoverflow.com/comment/35327471
tagged with: android
downvote count: 1
upvote count: 0
has comment: http://stackoverflow.com/comment/35396835
tagged with: computer-vision
tagged with: opencv
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23160377
accepted answer: http://stackoverflow.com/a/23160377
tagged with: java
has body: If it is possible than it will detect car once or blinking multiple time on single car i have done car detection on live feed but it is detecting car and just continue blinking so i need to use it on image. I have already Haar .xml file. Thanx in advance
score: -1

http://stackoverflow.com/q/23081124
answer count: 1
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35288041
tagged with: java
has title: Parcelable Object causing error
has body: I had created a class like below, that implements Parcelable package com.fyrweel.cityinfo; import android.os.Parcel; import android.os.Parcelable; public class JSONParser implements Parcelable { public String fcodeName; public String toponymName; public String countrycode; public String fcl; public String fclName; public String name; public String wikipedia; public Double lng; public Double lat; public String fcode; public Long geonameId; public Long population; public int describeContents() { return 0; } // write your object's data to the passed-in Parcel public void writeToParcel(Parcel out, int flags) { out.writeString(fcodeName); out.writeString(toponymName); out.writeString(countrycode); out.writeString(fcl); out.writeString(fclName); out.writeString(name); out.writeString(wikipedia); out.writeString(fcode); out.writeLong(geonameId); out.writeLong(population); out.writeDouble(lng); out.writeDouble(lat); } public static final Parcelable.Creator&lt;JSONParser&gt; CREATOR = new Parcelable.Creator&lt;JSONParser&gt;() { public JSONParser createFromParcel(Parcel in) { return new JSONParser(in); } public JSONParser[] newArray(int size) { return new JSONParser[size]; } }; JSONParser(Parcel in) { fcodeName = in.readString(); toponymName = in.readString(); countrycode = in.readString(); fcl = in.readString(); fclName = in.readString(); name = in.readString(); wikipedia = in.readString(); fcode = in.readString(); geonameId = in.readLong(); population = in.readLong(); lng = in.readDouble(); lat = in.readDouble(); } } Then I tried to pass an object of this class from one activity to another using intents. In the first activity i used the following code: Intent detailsActivityLauncher = new Intent(MainActivity.this, DetailsActivity.class); detailsActivityLauncher.putExtra("SelectedCityDetails", (Parcelable)aCity); startActivityForResult(detailsActivityLauncher, 0); And in the second activity the following code to receive it: Intent recievedIntent = getIntent(); JSONParser th…
tagged with: android-intent
type: Question
has answer: http://stackoverflow.com/a/23081447
tagged with: parcelable
score: 0

http://stackoverflow.com/comment/35177205
type: Comment
type: QuestionComment
has text: @Dhaval I know I am at fault for not reading these docs but the problem is, when opening these links they don't display. It loads and eventually says connection lost, so I don't see how I can view these properly.
score: 0
comment on: http://stackoverflow.com/q/23026050

http://stackoverflow.com/q/23110834
type: Question
has answer: http://stackoverflow.com/a/23111115
tagged with: date
has body: I get the date values from MySQL through JSONArray. Then it is displayed in a textview and when on click the set alarm button it will set the notification on that date and time. All worked fine. But i need to set the alarm before the selected date and before 5mins. How can i set it in JAVA Android.
score: 0
answer count: 1
has title: How to set an notification for a day before the selected date on android
accepted answer: http://stackoverflow.com/a/23111115
tagged with: android
tagged with: alarm
type: AnsweredQuestion
tagged with: java
tagged with: calendar

paintcomponent
tags question: http://stackoverflow.com/q/23121339
tags question: http://stackoverflow.com/q/22972306
tag name: paintcomponent
tags question: http://stackoverflow.com/q/23073818
tags question: http://stackoverflow.com/q/22984052
tags question: http://stackoverflow.com/q/23073543
tags question: http://stackoverflow.com/q/23095631
tags question: http://stackoverflow.com/q/23035467
tags question: http://stackoverflow.com/q/23110444
tags question: http://stackoverflow.com/q/23028605
tags question: http://stackoverflow.com/q/23097030
type: Tag

file
type: Tag
tags question: http://stackoverflow.com/q/23086639
tags question: http://stackoverflow.com/q/23043670
tags question: http://stackoverflow.com/q/23111468
tags question: http://stackoverflow.com/q/22993407
tags question: http://stackoverflow.com/q/23116017
tags question: http://stackoverflow.com/q/23064160
tags question: http://stackoverflow.com/q/23034798
tags question: http://stackoverflow.com/q/23111717
tags question: http://stackoverflow.com/q/23045704
tag name: file
tags question: http://stackoverflow.com/q/23063867
tags question: http://stackoverflow.com/q/23082075
tags question: http://stackoverflow.com/q/23126566
tags question: http://stackoverflow.com/q/23119569
tags question: http://stackoverflow.com/q/22994140
tags question: http://stackoverflow.com/q/23024139
tags question: http://stackoverflow.com/q/23090201
tags question: http://stackoverflow.com/q/23108195
tags question: http://stackoverflow.com/q/23050018
tags question: http://stackoverflow.com/q/23046686
tags question: http://stackoverflow.com/q/23016274
tags question: http://stackoverflow.com/q/23018606
tags question: http://stackoverflow.com/q/23053832
tags question: http://stackoverflow.com/q/23001856
tags question: http://stackoverflow.com/q/23072055
tags question: http://stackoverflow.com/q/22988210
tags question: http://stackoverflow.com/q/23029833
tags question: http://stackoverflow.com/q/23056806
tags question: http://stackoverflow.com/q/23027051
tags question: http://stackoverflow.com/q/23094846
tags question: http://stackoverflow.com/q/23027382
tags question: http://stackoverflow.com/q/23077204
tags question: http://stackoverflow.com/q/22972023
tags question: http://stackoverflow.com/q/23044436
tags question: http://stackoverflow.com/q/23045433
tags question: http://stackoverflow.com/q/23124360
tags question: http://stackoverflow.com/q/23107083
tags question: http://stackoverflow.com/q/23002372
tags question: http://stackoverflow.com/q/23042889
tags question: http://stackoverflow.com/q/23018461
tags question: http://stackoverflow.com/q/23121982
tags question: http://stackoverflow.com/q/23116232
tags question: http://stackoverflow.com/q/23094564
tags question: http://stackoverflow.com/q/23029289
tags question: http://stackoverflow.com/q/23010727

http://stackoverflow.com/a/31157627
answers question: http://stackoverflow.com/q/23093897
downvote count: 0
score: 4
has body: I have got the same problem in this day at work, when we must inject a CDATA section over a field text of a data structure defined into a WSDL exposed from a Bank web service. The requirement was to introduce a CDATA section to escape the Unicode character "+" into a number telephone field. The WSDL is not possible to change for various motivation. We have the same environment: org.springframework.oxm.jaxb.Jaxb2Marshaller webServiceTemplate.marshalSendAndReceive(payloadRequest, SoapActionCallback) and the same fail result &amp;lt;![CDATA[&amp;lt;tag&amp;gt;+&amp;lt;\tag&amp;gt; instead of &lt;[[CDATA[+]]&gt; After many and many test and after have consulting many fonts on Stackoverflow and other site, we have understand that the solution is not natively supported from JAXB engine and it's necessary to manipulate the SOAP message into a puntual step of processing the request. Other solution indicated to use third part plugin and library, ad example MOXy, to accomplished a strong support of CDATA section also JAXB. But this solution is not possible to integrate in fast time over an huge enterprise application in form ASAP. This solution that I publish in this reply permit to inject a CDATASection using the canonical method of a classic DOMSource object casting the message SOAP from messagecontext. In your answer you expose a part of solution, and this is the callback of marshalSendAndReceive. If you define an ad hoc callback supported by marshalSendAndReceive method and in this callback manipulate the DOMSource injecting the CDATASection you can resolve the problem. This is the code: WebServiceMessageCallback callbackCDATANumTelefono = new WebServiceMessageCallback() { public void doWithMessage(WebServiceMessage message) { //Recover the DOMSource dal message soap DOMSource domSource = (DOMSource)message.getPayloadSource(); //recover set of child nodes of domsource NodeList nodeList = domSource.getNode().getChildNodes(); //definisco il nome del tag da cercare String na…
type: Answer
upvote count: 4

http://stackoverflow.com/a/23027494
answers question: http://stackoverflow.com/q/23027356
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: According to the MemoryConfiguration javadoc (Which is one of the parent classes for the YamlConfiguration you're using), getStringList() returns a List&lt;String&gt;, however I'm willing to bet it actually returns an ArrayList&lt;String&gt;, and calling ArrayList#add() will return a boolean indicating whether the item was successfully added to the list. Therefore this line: MinecraftGTA.config.set("gangs", MinecraftGTA.config.getStringList("gangs").add(args[0])); Needs to become: final List&lt;String&gt; gangs = MinecraftGTA.config.getStringList("gangs"); gangs.add(args[0]); MinecraftGTA.config.set("gangs", gangs); And the same again for the second configuration.
accepted answer of: http://stackoverflow.com/q/23027356
type: Answer

http://stackoverflow.com/q/23063931
has comment: http://stackoverflow.com/comment/35247711
has comment: http://stackoverflow.com/comment/35244458
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35245420
has body: So I am working on the Sieve of Atkins for Problem 10. Question: "The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million." I believe I am following the steps correctly but it's failing to give the right answer. import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; public class Level_10 { public static void main(String[] args) { //Sieve of atkins int limit = 2000000; long sum = 0; int ins = 2; int limitsq = ((int)Math.round(Math.sqrt(limit))); ArrayList&lt;Long&gt; results = new ArrayList&lt;Long&gt;(); //2, 3. and 5 are primes results.add(2L); results.add(3L); results.add(5L); Map&lt;Long, Boolean&gt; sieves = new HashMap&lt;Long, Boolean&gt;(); //composite list //adding sieves for (int i = 5; i &lt;= limit; i++) sieves.put((long) i,false); long n; for (int x = 1; x &lt; limitsq; x++) { for (int y = 1; y &lt; limitsq; y++) { //4x^2 + y^2 n = ((4*(x*x)) + (y*y)); if (n &lt;= limit &amp;&amp; (n % 12 == 1 || n % 12 == 5)) sieves.put(n*n, true); //3x^2 + y^2 n = ((3*(x*x)) + (y*y)); if (n &lt;= limit &amp;&amp; (n % 12 == 7)) sieves.put(n*n, true); //3x^2 − y^2 n = ((3*(x*x)) - (y*y)); if (x &gt; y &amp;&amp; n &lt;= limit &amp;&amp; (n % 12 == 11)) sieves.put(n*n, true); } } //Multiple of squares are not prime for (int num = 1; num &lt; limitsq; num++) { if (sieves.get(num) != null) for (int m = num * num; m &lt;= limit; m += num * num) sieves.put((long) m, false); } //Add into results for (Entry&lt;Long, Boolean&gt; nextSieve : sieves.entrySet()) { if (nextSieve.getValue() &amp;&amp; ins % 2 == 0) { results.add(nextSieve.getKey()); ins++; } } //Generate the sum for (Long resultNum : results) sum += resultNum; System.out.println("The sum of all primes below " + limit + " is " + sum); } } If anything here is inefficient, please notify me.
has comment: http://stackoverflow.com/comment/36090238
tagged with: java
has title: Sieve of Atkins, unexpected results
has comment: http://stackoverflow.com/comment/35282981
type: Question

http://stackoverflow.com/q/23085234
type: AnsweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35282873
has comment: http://stackoverflow.com/comment/35282615
type: Question
tagged with: clone
possible better answer: http://stackoverflow.com/a/23085665
has comment: http://stackoverflow.com/comment/35283220
has answer: http://stackoverflow.com/a/23085665
tagged with: copy
answer count: 2
downvote count: 3
accepted answer: http://stackoverflow.com/a/23085797
has body: So I need to copy an instance for a method and must return an instance. My issue is that this object consists of an array and need to copy everything in this array as well. The class constructor only specifies the width and height of the 2d array and this class constructor cannot be altered. How can I create a copy? The following I assume won't work because it only copies the size of array right? public Grid copyGrid (Grid grid) { return new Grid(height, width); }
has title: Copy Constructor: Special Case
favorite count: 0
tagged with: constructor
has answer: http://stackoverflow.com/a/23085797
has comment: http://stackoverflow.com/comment/35282526
score: -3

web-crawler
tags question: http://stackoverflow.com/q/23098360
tag name: web-crawler
type: Tag
tags question: http://stackoverflow.com/q/23003271
tags question: http://stackoverflow.com/q/23000388

http://stackoverflow.com/comment/35107820
type: Comment
comment on: http://stackoverflow.com/a/22987431
has text: @Sanjay: The code which you posted looks to me *very suspected* because one can set label **only after the grid is created**. You should place the code on other place. Try to move it directly after creating the grid.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35298839
type: AnswerComment
score: 4
type: Comment
comment on: http://stackoverflow.com/a/23093851
has text: This regex means exactly the same as `"\\d{5}"` so this is not the solution.

http://stackoverflow.com/comment/35109633
has text: Thanks Sarvesh for the answer, but the thing which you have told me is the one which LogBack is also doing internally, the only difference it use the polling mechanism to check for the changes after every scan interval, but this is not happening right now. Do you thin if i would have to load it programmatically then this program needs a trigger point. Not sure how you will do that.
comment on: http://stackoverflow.com/a/22986717
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22974969
tagged with: xsd
tagged with: java
has body: I'm in a bind-ing.. get it? yeah it's been four days so even I ain't laughing at that. I'm using inheritance in an xsd the definitions of the types are displayed below. I have a webservice that has a complex type like so definied in the types section of the wsdl. &lt;xsd:import namespace="http://xmlns.mycomp.com/base" schemaLocation="base-data-types.xsd"/&gt; &lt;xsd:element name="enterStateElement"&gt; &lt;xsd:complexType&gt; &lt;xsd:complexContent&gt; &lt;xsd:extension base="base:BaseContextRequestType"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="instatecode" nillable="true" type="string"/&gt; &lt;/xsd:sequence&gt; &lt;/xsd:extension&gt; &lt;/xsd:complexContent&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; The base:BaseContextRequestType is defined in the base-data-types.xsd as follows &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://xmlns.mycomp.com/base" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1" targetNamespace="http://xmlns.mycomp.com/base" elementFormDefault="qualified"&gt; &lt;xsd:complexType name="BaseContextRequestType"&gt; &lt;xsd:annotation&gt; &lt;xsd:appinfo&gt; &lt;jaxb:class implClass="com.mycomp.xmlns.BaseContextRequestType" ref="com.mycomp.xmlns.BaseContextRequestType" &gt; &lt;/jaxb:class&gt; &lt;/xsd:appinfo&gt; &lt;/xsd:annotation&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="processInstanceId" type="xsd:string" minOccurs="1"/&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; The BaseContextRequestType java class looks like @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "BaseContextRequestType", namespace="http://xmlns.mycomp.com/base", propOrder = { "processInstanceId" }) public class BaseContextRequestType { @XmlElement(required = true, nillable=true, namespace="http://xmlns.mycomp.com/base") public String processInstanceId; @XmlElement(required = true, nillable=true, namespace="http://xmlns.mycomp.com/base") public String getProcessInsta…
type: Question
tagged with: weblogic
score: 0
has title: Weblogic web service not unmarshalling a base element
answer count: 1
tagged with: wsdl
has answer: http://stackoverflow.com/a/22998383
type: UnansweredQuestion
tagged with: web-services

http://stackoverflow.com/q/23048873
has comment: http://stackoverflow.com/comment/35217230
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35217246
type: Question
accepted answer: http://stackoverflow.com/a/23048886
has body: I am writing an abstract class and a class extends it. public abstract class stream&lt;T&gt;{ public abstract T data(); } Above is the abstract class. public class IntegerStream&lt;Integer&gt; extends stream{ private Integer InitialV; public IntegerStream(Integer InitialV){ this.InitialV = InitialV; } public Integer next(){ InitialV = InitialV + 1; } @Override public Integer data() { return InitialV; } } the result should be like when create stream = new IntegerStream(10); &gt; stream.next() 10 &gt; stream.next() 11 &gt; stream.next() 12 but here is the error when I tried to compile it: operator + cannot be applied to Integer,int Anyone can help me..
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23048886
has title: operator cannot be applied to Integer

http://stackoverflow.com/comment/35225285
type: QuestionComment
score: 1
has text: Try to use 'VACUUM <tablename>' it could fix the error
comment on: http://stackoverflow.com/q/23053462
type: Comment

http://stackoverflow.com/comment/35123969
comment on: http://stackoverflow.com/a/22995579
type: AnswerComment
score: 0
type: Comment
has text: Don't use new GridLayout(5, 1). Instead use `new GridLayout(0, 1)`, which means 1 column and any number of rows. When you specify both values, one value takes precedence. Of course, it would not be an issue if you have exactly 5 components, but if you ever change the code to have more/less it could become an issue.

http://stackoverflow.com/q/22975045
tagged with: android
has comment: http://stackoverflow.com/comment/35083792
has title: Why does my app keep crashing on startup - Android
has body: Just followed a youtube guide on how to make a button and an activity. I followed his code down to the font size and it keeps on crashing when i start it. Anyone know why? public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); addButtonClickListner(); } public void addButtonClickListner() { Button btnNavigator = (Button) findViewById(R.id.button1); btnNavigator.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("www.premierleague.com")); startActivity(intent); } }); } @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; } }
has comment: http://stackoverflow.com/comment/35083648
has comment: http://stackoverflow.com/comment/35083717
tagged with: java
downvote count: 2
type: Question
tagged with: crash
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/35085024
has comment: http://stackoverflow.com/comment/35084046
has answer: http://stackoverflow.com/a/22975123
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/23113841
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23104254
answers question: http://stackoverflow.com/q/23104254
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: This is the default behavior when you implement Validator for view validation. If you have overridden validate method in your Validator implementation and if validation is turned on in view-state (say eg., displayNameView), then first validateDisplayNameView method will be called followed by validate method. I will override this default validate method only if some common validation is to be performed for all views in a flow. If not i will not override or keep it empty as: public void validate(Object obj, Errors err){}; You can spring web flow documentation mentioning the same here. In your scenario, if you want to check the statements in validate method for displayNameView, move them to validateDisplayNameView method.

taglib
tags question: http://stackoverflow.com/q/23118772
tag name: taglib
type: Tag

http://stackoverflow.com/comment/35388103
type: Comment
comment on: http://stackoverflow.com/a/23123424
has text: Thank you for the suggestion, its kind of challenging to word it without people thinking you want to develop for IOS using Java.
type: AnswerComment
score: 0

http://stackoverflow.com/a/23065619
type: Answer
has comment: http://stackoverflow.com/comment/35269815
has body: You won't get more general advice than listed in the official wiki. However, to answer your point about costly index searcher - the searcher itself is cheap, it is the IndexReader which is expensive. You could potentially cache the 12 readers (for each index), and create multi searchers (if using Lucene 3.6.0) or look at SlowCompositeReaderWrapper for Lucene 4.0+.
answers question: http://stackoverflow.com/q/23065464
accepted answer of: http://stackoverflow.com/q/23065464
has comment: http://stackoverflow.com/comment/35248237
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/23036686
answer count: 3
upvote count: 0
has body: I have an ArrayList like [A-,90,91,92 | B-, 80, 81| C,75 ] How would I extract A-, B- and C from the ArrayList. | indicates the next element in the ArrayList Would it be possible to split up the Grades into one ArrayList and the Numbers into another ArrayList?
accepted answer: http://stackoverflow.com/a/23036746
favorite count: 0
has comment: http://stackoverflow.com/comment/35195073
has comment: http://stackoverflow.com/comment/35195197
score: -2
has title: Extracting the first element from an String ArrayList delimited with commas
type: AnsweredQuestion
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/23036816
has comment: http://stackoverflow.com/comment/35195113
possible better answer: http://stackoverflow.com/a/23036748
has answer: http://stackoverflow.com/a/23036746
type: Question
has answer: http://stackoverflow.com/a/23036748
has comment: http://stackoverflow.com/comment/35195058
tagged with: arraylist

http://stackoverflow.com/comment/35174264
has text: It's because you use another `xml` at this line: `getMenuInflater().inflate(R.menu.**main_activity_actions**, menu);`, you don't use *main.xml* but *main_activity_actions.xml*. Whatever the file, with `ActionBarActivity` you must to use **a prefix** inside all your menu layout. As the solution in the link you added and as you did before in *main.xml*.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23024795
score: 0

http://stackoverflow.com/comment/35106821
comment on: http://stackoverflow.com/a/22988236
has text: See, I need multi part to upload files along whith that I want to pass some data
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23105809
has comment: http://stackoverflow.com/comment/35318680
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23105724
has body: Change your condition to: if(Float.parseFloat(s) &lt; 3700.7777f) { ↑ See Primitive Data Types - float for further information. Also you might want to know What Every Computer Scientist Should Know About Floating-Point Arithmetic.
downvote count: 0

http://stackoverflow.com/q/23027229
has title: Extra things while executing the jps command
tagged with: hadoop
upvote count: 1
answer count: 1
favorite count: 0
has body: I was running a word count program on 100GB text file.I use 3 systems in a multi node cluster mater, slave1 and slave 2. other than master 2 slaves run data node and task tracker respectively. Now when I run the jps commend on slave machines it will slow the following output: hduser@slave2:/usr/local/hadoop/bin$ jps 2970 DataNode 6456 Child 14534 RunJar 6529 Jps 3215 TaskTracker 5787 Child 6463 Child Now what is here child??? What do you mean by RunJar?
accepted answer: http://stackoverflow.com/a/23034812
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23034812
has comment: http://stackoverflow.com/comment/35200177
type: Question

http://stackoverflow.com/comment/35140221
has text: At least a simple XML should be available. What XML do you try to parse?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23006407
type: Comment

http://stackoverflow.com/a/41198902
has body: Just in case someone out there is still falling on this thread looking for help: The following line can be used to change to look of your scrollbar. The fields surrounded by "_" characters can be changed (key and COLOR). UIManager.put("ScrollBar._key_", new ColorUIResource(_COLOR_)); The most relevant keys for changing the color of your bar are: thumb (General color of thumb) thumbDarkShadow (Remaining shadowed part of thumb) thumbShadow (Essentially a border for the thumb which is split in half with highlight) thumbHighlight (Second half of said border kind of) track (background) So an example would be: UIManager.put("ScrollBar.thumb", new ColorUIResource(Color.black)); This would make the main part of the thumb black. If you are going for a full single color thumb then use all keys except track and set them to the same color. If you are going for an outline set the first two as color1 and the second two as color2. I fell on this while trying to ameliorate my own GUI and after some minor tweaking thought I'd share my findings. For more keys click me!
answers question: http://stackoverflow.com/q/23037433
downvote count: 0
score: 3
type: Answer
upvote count: 3

http://stackoverflow.com/a/23000295
has body: This regexp should do it: [a-zA-Z] It matches as long as there's a single letter anywhere in the string, it doesn't care about any of the other characters. [a-zA-Z]+ should have worked as well, I don't know why it didn't for you.
has comment: http://stackoverflow.com/comment/35129011
has comment: http://stackoverflow.com/comment/35129003
answers question: http://stackoverflow.com/q/23000258
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/35129157
has comment: http://stackoverflow.com/comment/35129034
score: 2
has comment: http://stackoverflow.com/comment/35128998
has comment: http://stackoverflow.com/comment/35164432
downvote count: 1
has comment: http://stackoverflow.com/comment/35129327

http://stackoverflow.com/comment/35353327
score: 0
comment on: http://stackoverflow.com/q/23124576
has text: I'm not sure the way i get the array number is correct or not, i just want to get result like [1,2,3,4]. The List<Network> should be change to String or something?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35124741
has text: @Eric: see edit. Your validate method is erroneous. Still I recommend a DocumentFilter or JFormattedTextField for this.
type: Comment
comment on: http://stackoverflow.com/a/22997804
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35397608
score: 0
has text: Your assumption is wrong: the toolbar / print button isn't added by iText. I see that you are using pdf.js, a PDF viewer embedded in Firefox. That toolbar is added by pdf.js, **NOT** by iText. There's a similar question (and answer) here: http://stackoverflow.com/questions/23081728/disable-adobe-reader-toolbar-from-my-activex/
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23105469

http://stackoverflow.com/comment/35239037
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23060774
has text: those are exactly the only operations i do with the arraylist, aside from some filenames.get() and filenames.size()
score: 0

http://stackoverflow.com/comment/35206679
comment on: http://stackoverflow.com/q/23043441
has text: I didn't know aspect programming could work on Android. Any tutorial to start from ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23093565
has body: A set by definition doesn't contain any duplicates. A set determines if two items are alike, by using either the objects equals()/compareTo(..) method or by using a Comparator. If you only want unique items in your set, implementing the Comparable interface and overriding equals() is what you want to do. BUT in your case, you're only interested in objects in unique groups, so it's then better to create a custom Comparator for the occasion, which you then supply to the Set, telling it to use it, instead of "natural ordering". Set&lt;MyThing&gt; myThings = new TreeSet&lt;&gt;(new Comparator&lt;MyThing&gt;() { @Override public int compare(MyThing o1, MyThing o2) { return o1.getGroupId() - o2.getGroupId(); } }); myThings.addAll(Arrays.asList(myArray)); After creating the set, you add your entire array into it, using the convinience method addAll(..). (How the comparator sorts your objects is completely up to you to decide.)
has comment: http://stackoverflow.com/comment/35300088
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23093070
downvote count: 0
has comment: http://stackoverflow.com/comment/35299630
has comment: http://stackoverflow.com/comment/35299530
answers question: http://stackoverflow.com/q/23093070
type: Answer
has comment: http://stackoverflow.com/comment/35298713
score: 1

http://stackoverflow.com/q/22994726
has answer: http://stackoverflow.com/a/39384851
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
type: Question
has title: Print cross pattern in Java
upvote count: 3
tagged with: printing
answer count: 3
has body: I've got this homework exercise that I'm stuck on. Basically we have to print a cross pattern with 'X' character, but the middle bit has to be empty. So, the program has to read an integer from the command line and after executing it it should output a cross pattern. Something like this: x x x x x x x x x x x x Hopefully you can see it formatted properly above, basically I don't how to add that empty bit in the middle. This is what I have so far: public class Cross { public static void main(String[] args) { int num = 0; for (int i = 0; i &lt; args.length; i++) { num = Integer.parseInt(args[i]); drawCross(num); } } public static void drawCross(int num){ for(int i = 0; i &lt; num; i++) { for(int j = 0; j &lt; num; j++) { if((i == num / 2) || (j == num / 2)) System.out.print("X "); else System.out.print(" "); System.out.print(" "); } System.out.println(); } } } Now, this above works, but it prints a normal cross, without the gap in the middle. (Also, I'm guessing that there's a smarter way of doing this instead of using sysout) The only other requirements that they gave us are that the 'x' should be printed 4n times and that the program must handle invalid inputs. I would appreciate if you guys can give me a hand! Cheers
possible better answer: http://stackoverflow.com/a/22994792
has answer: http://stackoverflow.com/a/22994792
favorite count: 0
has answer: http://stackoverflow.com/a/22995018
accepted answer: http://stackoverflow.com/a/22995018

http://stackoverflow.com/comment/35162565
comment on: http://stackoverflow.com/q/23017419
type: QuestionComment
type: Comment
score: 1
has text: Try use QueryDSL. For example in this case you can send any predicate for you repository or service. http://www.querydsl.com/

http://stackoverflow.com/comment/35318462
comment on: http://stackoverflow.com/q/23105604
score: 0
has text: Start at a random number and search from there. However, this will make prime numbers that follow a large gap more likely than others.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35272950
type: Comment
comment on: http://stackoverflow.com/a/23078601
has text: You should get 'user (affiliate) id' from session, and compare it to 'affiliate id' in 'client DTO'.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35125487
has text: @j.con "one or more whitespace characters". It's the safer way to split a sentence on space as it doesn't care the number of spaces between words.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22998335
type: AnswerComment

http://stackoverflow.com/comment/35116798
has text: Just tried it, it did not work
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22993727

http://stackoverflow.com/comment/40705953
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23082832
score: 0
has text: I just have the same problem. Were you able to solve this?

http://stackoverflow.com/comment/35281618
comment on: http://stackoverflow.com/q/23083654
score: 0
type: Comment
type: QuestionComment
has text: Ok well when you use startActivityForResult, your activity calls onPause() and then the achievements activity starts. When the user exits out of the achievements activity, your original activity that you called it from will call onResume(). I think that can be used as a "callback". As far as I know there is no in built callback in the google play apis

nullpointerexception
tags question: http://stackoverflow.com/q/23030213
tags question: http://stackoverflow.com/q/23051569
tags question: http://stackoverflow.com/q/23067368
tags question: http://stackoverflow.com/q/23050026
tags question: http://stackoverflow.com/q/23007715
tags question: http://stackoverflow.com/q/23061482
tags question: http://stackoverflow.com/q/23058234
tags question: http://stackoverflow.com/q/23047023
tags question: http://stackoverflow.com/q/23053292
tags question: http://stackoverflow.com/q/23102407
tags question: http://stackoverflow.com/q/23085526
tags question: http://stackoverflow.com/q/23123902
tags question: http://stackoverflow.com/q/23014760
tags question: http://stackoverflow.com/q/23044335
tags question: http://stackoverflow.com/q/23030593
tags question: http://stackoverflow.com/q/23048196
tags question: http://stackoverflow.com/q/22976399
tags question: http://stackoverflow.com/q/23042655
tags question: http://stackoverflow.com/q/22979622
type: Tag
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/23039643
tags question: http://stackoverflow.com/q/23068932
tags question: http://stackoverflow.com/q/22984871
tags question: http://stackoverflow.com/q/22980510
tags question: http://stackoverflow.com/q/23080931
tags question: http://stackoverflow.com/q/22973918
tags question: http://stackoverflow.com/q/22996999
tags question: http://stackoverflow.com/q/23063408
tags question: http://stackoverflow.com/q/22992492
tags question: http://stackoverflow.com/q/23048816
tags question: http://stackoverflow.com/q/23121718
tags question: http://stackoverflow.com/q/22984364
tags question: http://stackoverflow.com/q/23069397
tags question: http://stackoverflow.com/q/23094846
tags question: http://stackoverflow.com/q/23073788
tags question: http://stackoverflow.com/q/23113855
tags question: http://stackoverflow.com/q/23092325
tags question: http://stackoverflow.com/q/23120743
tags question: http://stackoverflow.com/q/23074940
tags question: http://stackoverflow.com/q/23103974
tags question: http://stackoverflow.com/q/23124848
tags question: http://stackoverflow.com/q/23084936
tags question: http://stackoverflow.com/q/23019691
tags question: http://stackoverflow.com/q/23074527
tags question: http://stackoverflow.com/q/22996029
tags question: http://stackoverflow.com/q/23005071
tags question: http://stackoverflow.com/q/23062454
tags question: http://stackoverflow.com/q/23035747
tags question: http://stackoverflow.com/q/23059509
tags question: http://stackoverflow.com/q/23113650

http://stackoverflow.com/comment/35398912
score: 0
type: AnswerComment
has text: ImageController class is in sessionscope and during invocation of handleFileUpload() method I am setting the image attribute with newly uploaded value.So,it should persist.
type: Comment
comment on: http://stackoverflow.com/a/23135104

http://stackoverflow.com/comment/35361995
score: 0
type: Comment
has text: I set "java -cp D:\mysql-connector-java-5.1.23-bin.jar TCfinder -jar D\:TCfinder.jar " and I still get Error: Could not find or load main class TCfinder
type: AnswerComment
comment on: http://stackoverflow.com/a/23129147

code-duplication
tag name: code-duplication
tags question: http://stackoverflow.com/q/22987050
type: Tag

http://stackoverflow.com/comment/35074759
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22970337
has text: possible duplicate of [Popup for JFrame close button](http://stackoverflow.com/questions/15198549/popup-for-jframe-close-button)

http://stackoverflow.com/a/23047214
has comment: http://stackoverflow.com/comment/35216935
has comment: http://stackoverflow.com/comment/35215312
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/35214098
has body: You can do try { IntSortedArray r3 = new IntSortedArray(0); r3.get(0); fail(); } catch(ArrayIndexOutOfBoundsException expected) { }
has comment: http://stackoverflow.com/comment/35213986
has comment: http://stackoverflow.com/comment/35214048
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23047163

http://stackoverflow.com/comment/35150169
comment on: http://stackoverflow.com/a/23012263
score: 0
type: Comment
has text: yes sounds interesting. will be helpful if you post code too.
type: AnswerComment

http://stackoverflow.com/q/23060863
has answer: http://stackoverflow.com/a/23060970
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/23079075
has body: I have a maven 2 ear modules. For example, its artifact ID is MyApp. Maven creates ear archives whith name MyApp-1.0-SNAPSHOT.ear I want to change default name. I have this in the parent pom.xml: org.apache.maven.plugins maven-compiler-plugin 2.3.2 ${java.version} ${java.version} ${java.version} org.apache.maven.plugins maven-war-plugin 2.2 ${basedir}/src/main/webapp/WEB-INF WEB-INF **/*.xml true org.apache.maven.plugins maven-ear-plugin 2.7 true src/main/resources true **/* And this in the ear pom.xml: org.apache.maven.plugins maven-ear-plugin
answer count: 3
tagged with: ear
downvote count: 0
has title: Maven: Rename the application EAR
favorite count: 0
has answer: http://stackoverflow.com/a/23060934
has comment: http://stackoverflow.com/comment/35288417
has comment: http://stackoverflow.com/comment/35271845
tagged with: maven
has answer: http://stackoverflow.com/a/23079075
tagged with: war
possible better answer: http://stackoverflow.com/a/23060934
type: AnsweredQuestion
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35288230

http://stackoverflow.com/comment/35086135
type: QuestionComment
comment on: http://stackoverflow.com/q/22976394
type: Comment
has text: My code as a starting point is only the method header.
score: 0

http://stackoverflow.com/comment/35074080
comment on: http://stackoverflow.com/a/22969061
has text: The only thing you're missing is the cast, which I omitted to conserve comment space: long myRandomLong = (long)(random.nextDouble()*1000000L ); Or put another way, long myrandomLong = (long)(0 + random.nextDouble()*(1000000L-0+1)); would make it inclusive (0 is your lower bound, 1000000 is your upper bound inclusive), and is exactly the formula in my answer.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23031587
downvote count: 0
has comment: http://stackoverflow.com/comment/35185833
linked to: http://stackoverflow.com/q/2808535
type: Question
has body: double x = 0; double P = 0.327; //P is a actually function that return double and change all the time double w1 = 1/4; //prints 0 (w1 and w2 are same as P) double w2= 10/4; //prints 2 x=x+P*w1+(1-P)*w2; System.out.println(x); // prints 1.346 and the real result is 1.76425 i dont know how to overcome the problem of double that is rounding down, i tried the BigDecimal, maybe i just dont do it right.. i dont need very precise result but i do need the result 1.764. Thanks in advance.
tagged with: rounding
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23031612
upvote count: 1
has answer: http://stackoverflow.com/a/23031607
has title: double being rounded and not precise
favorite count: 0
tagged with: precision
has answer: http://stackoverflow.com/a/23031612
possible better answer: http://stackoverflow.com/a/23031607
answer count: 3
tagged with: double
has answer: http://stackoverflow.com/a/23031623
type: AnsweredQuestion

http://stackoverflow.com/q/23047711
type: Question
has comment: http://stackoverflow.com/comment/35215539
tagged with: network-programming
has comment: http://stackoverflow.com/comment/35215195
tagged with: java-io
has comment: http://stackoverflow.com/comment/35219882
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35215872
type: UnansweredQuestion
tagged with: sockets
has title: Client gets disconnected from the server after sending data
answer count: 0
has body: I am creating a client-server remote screenshot capture application. I can successfully exchange screenshots between the server and the client. But the client gets disconnected from the server as soon as it captures and sends the screenshot to the server. I want the client to stay connected after capturing a screenshot. I am quite a newbie to java input/outout and also network programming. Can anyone help me by pointing out mistake? Here is the complete code for client. If the code for the server is also required to solve this problem I will upload my server code also. CLIENT public class ScreenClient { public static void main(String[] args) throws Exception { Robot robot = new Robot(); BufferedImage screen; Socket server = new Socket("localhost", 5494); BufferedReader bf = new BufferedReader(new InputStreamReader(server.getInputStream())); String s; s = bf.readLine(); System.out.println(s); if (s.contains("execute")) { Rectangle size = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); screen = robot.createScreenCapture(size); int[] rgbData = new int[(int) (size.getWidth() * size.getHeight())]; screen.getRGB(0, 0, (int) size.getWidth(), (int) size.getHeight(), rgbData, 0, (int) size.getWidth()); OutputStream baseOut = server.getOutputStream(); ObjectOutputStream out = new ObjectOutputStream(baseOut); out.writeObject(size); for (int x = 0; x &lt; rgbData.length; x++) { out.writeInt(rgbData[x]); } out.flush(); } } } SERVER public class ScreenServer extends JFrame implements ActionListener { String uname; BufferedReader br; static JTextArea taMessages, taUserList; JTextField tfInput; static Socket client;// JButton btnCapture, btnExit, btnGetUsers; static ArrayList&lt;String&gt; users = new ArrayList(); PrintWriter os; public static void main(String[] args) throws Exception { Robot robot = new Robot(); BufferedImage screen; ScreenServer screenServer = new ScreenServer(); screenServer.buildInterface(); ServerSocket server = new ServerSocket(5494); while (true)…
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35215018

http://stackoverflow.com/a/23111628
score: 7
answers question: http://stackoverflow.com/q/23109360
has comment: http://stackoverflow.com/comment/35334353
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35335116
has comment: http://stackoverflow.com/comment/35334896
has comment: http://stackoverflow.com/comment/35333527
has body: Currently, your class is tightly coupled with the Collections.shuffle function. Static functions are notorious for making things more difficult to test. (On top of that, there's no point in you testing Collections.shuffle; presumably, it works correctly.) In order to address this, you can introduce a seam in your class for this shuffling functionality. This is done by extracting the shuffle function into a role (represented by an interface). For example: public interface ICardShuffler { void shuffle(List&lt;Card&gt; cards); } Then, your Deck class can be configured to keep a reference to an instance of some implementation of this interface, and invoke it when necessary: public class Deck { private final Queue&lt;Card&gt; queue = new LinkedList&lt;&gt;(); private ICardShuffler cardShuffler; public Deck(ICardShuffler cardShuffler) { this.cardShuffler = cardShuffler; } ... public void shuffle() { cardShuffler.shuffle((List&lt;Card&gt;)queue); } ... This allows your unit test to use a test double, like a mock object, to verify that the expected behavior occurs (i.e., that shuffle invokes shuffle on the provided ICardShuffler). Finally, you can move the current functionality into an implementation of this interface: public class CollectionsCardShuffler implements ICardShuffler { public void shuffle(List&lt;Card&gt; cards) { Collections.shuffle(cards); } } Note: In addition to facilitating testing, this seam also allows you to implement new methods of shuffling without having to modify any of the code in Deck.
has comment: http://stackoverflow.com/comment/35333421
type: Answer
has comment: http://stackoverflow.com/comment/35332601
has comment: http://stackoverflow.com/comment/35333668
has comment: http://stackoverflow.com/comment/35333984
upvote count: 7
accepted answer of: http://stackoverflow.com/q/23109360

http://stackoverflow.com/q/23121381
has title: Not able to figure out Logical Error
type: Question
tagged with: debugging
tagged with: java
has body: import java.util.Scanner; public class TestScoreApp { public static void main(String[] args) { // initialize variables and create a Scanner object int scoreTotal = 0; int scoreCount = 0; int testScore = 0; String choice = "y"; Scanner sc = new Scanner(System.in); // get a series of test scores from the user while(choice.equalsIgnoreCase("y")) { System.out.println("How many testscores would you like to enter?"); int numberOfTestScores = sc.nextInt(); // display operational messages System.out.println("Please enter test scores that range from 0 to 100."); System.out.println(); // print a blank line for(int i = 0; i == numberOfTestScores; i++) { // get the input from the user System.out.print("Enter score " + numberOfTestScores + ": "); testScore = sc.nextInt(); // accumulate score count and score total if (testScore &lt;= 100) { scoreCount = scoreCount + 1; scoreTotal = scoreTotal + testScore; } else if (testScore &gt; 100) System.out.println("Invalid entry, not counted"); { // display the score count, score total, and average score double averageScore = scoreTotal / scoreCount; String message = "\n" + "Score count: " + scoreCount + "\n" + "Score total: " + scoreTotal + "\n" + "Average score: " + averageScore + "\n"; System.out.println(message); } System.out.println("Would you like to enter another set of scores? y/n"); sc.next(choice); System.out.println(); } } } } The code above is to let a user enter test scores. They first chose how many they would like to enter. A for loop is used to make sure they enter the right amount. After that the number of scores, score total, and average score are outputted. I am current getting the output: How many testscores would you like to enter? 34 Please enter test scores that range from 0 to 100. How many testscores would you like to enter? 43 Please enter test scores that range from 0 to 100. How many testscores would you like to enter? 3 Please enter test scores that range from 0 to 100. How many testscores would you like to ent…
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23121396

http://stackoverflow.com/comment/35147491
type: Comment
type: QuestionComment
has text: Have you considered just making Ajax calls?
score: 2
comment on: http://stackoverflow.com/q/23010838

http://stackoverflow.com/q/23008352
accepted answer: http://stackoverflow.com/a/23012266
upvote count: 5
has title: Inserting data to JavaFX TableView without intermediate class
tagged with: resultset
has body: I'm newbie Java programmer. I would like to insert ResultSet data to JavaFX TableView, but i wouldn't use intermediate class. Can i insert ResultSet rows to TableView rows as objects? Here is my code with using intermediate class Unit public static ObservableList&lt;Unit&gt; getUnits() { final ObservableList&lt;Unit&gt; data = FXCollections.observableArrayList(); if (openConnection()) { try { rs = st.executeQuery("SELECT * FROM units"); while (rs.next()) { data.add(new Unit(rs.getString("id_unit"), rs.getString("short_name"), rs.getString("name"))); } } catch (Exception ex) { Logger.getLogger(SQLConnect.class.getName()).log(Level.SEVERE, null, ex); } } closeConnection(); return data; } Controller idUnit.setCellValueFactory(new PropertyValueFactory&lt;Unit, String&gt;("idUnit")); shortNameUnit.setCellValueFactory(new PropertyValueFactory&lt;Unit, String&gt;("shortName")); nameUnit.setCellValueFactory(new PropertyValueFactory&lt;Unit, String&gt;("name")); unitsTableView.setItems(SQLConnect.getUnits());
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23012266
downvote count: 0
tagged with: java
tagged with: javafx
type: Question
has answer: http://stackoverflow.com/a/23009295
score: 5
possible better answer: http://stackoverflow.com/a/23009295
answer count: 2
tagged with: tableview
favorite count: 0

http://stackoverflow.com/a/23082796
type: Answer
has body: Probably a good place to start looking would be the msdn library docs specifically the System.Convert class can be used to convert value types to raw bytes and back again. It looks like this question may help you as well: Is .NET BinaryReader always little-endian, even on big-endian systems?
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23082539
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23082539

http://stackoverflow.com/q/23031502
type: Question
has title: regular expression for web crawler
upvote count: 0
score: -2
answer count: 1
has answer: http://stackoverflow.com/a/23031535
linked to: http://stackoverflow.com/q/161738
favorite count: 0
has body: I was going thorough code snippet for web crawler written in java.It has used String url = "http://www.wikipedia.org/" to start the crawling and regular expression "http://(\w+\.)*(\w+)".can anybody exaplain meaning of it?
tagged with: regex
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/35190701
linked to: http://stackoverflow.com/q/22937618
tagged with: java

http://stackoverflow.com/comment/35089224
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22978127
type: AnswerComment
has text: I could be relating the wrong piece of code to the wrong problem. The method is [unpackHeader](https://github.com/mpatric/mp3agic/blob/master/src/main/java/com/mpatric/mp3agic/AbstractID3v2Tag.java). Your explanation was very helpful - it will help me understand the code better. Thanks, Radioef.

http://stackoverflow.com/comment/35173509
type: AnswerComment
comment on: http://stackoverflow.com/a/23019788
type: Comment
has text: Thanks so much. I will try ALL of your suggestions and let you know what comes of it!
score: 0

http://stackoverflow.com/q/23050559
has answer: http://stackoverflow.com/a/23053874
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35222648
favorite count: 0
has comment: http://stackoverflow.com/comment/35225390
tagged with: spring
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
has answer: http://stackoverflow.com/a/23050878
downvote count: 1
type: Question
tagged with: mongodb
has title: Not able to retrive list of document in mongodb
has body: { "question":"what is your color?", "choices":[{"option":"yello"},{"option":"blue"}], "creation-date":"2014-04-13", "expiry date":"2014-04-14" } In order to retrive list of polls public List&lt;Poll&gt; getPolls() { try { mongoClient=new MongoClient("NavDeep",27017); db=mongoClient.getDB("sms-voting"); collection=db.getCollection("pollsCollection"); } catch(Exception e){ e.printStackTrace(); } List&lt;Poll&gt; polls = new ArrayList&lt;Poll&gt;(); DBCursor cursor=collection.find(); while(cursor.hasNext()) { DBObject object = cursor.next(); what should i write in order to retrieve List&lt;Poll&gt;???? } } mongoClient.close(); return polls; } but i am getting null pointer exception near BasicDBList pollList=(BasicDBList)object.get("pollsCollection"); Can any body please Help me out.What should i actually write inside get()?? Thnks, deepthi

http://stackoverflow.com/q/23113016
tagged with: java
has comment: http://stackoverflow.com/comment/35333241
type: Question
has comment: http://stackoverflow.com/comment/35331756
answer count: 2
has answer: http://stackoverflow.com/a/23113114
tagged with: arrays
has comment: http://stackoverflow.com/comment/35333321
has comment: http://stackoverflow.com/comment/35333357
score: 0
tagged with: android
has title: Print an array outside the for loop java
tagged with: wifi
has body: I have a simple for loop for WIFI information, i want to use the wifis[i] outside the loop, pleeeease help me how can i do that since it is an array! I am able to get the first value in the array only. // Setup WiFi wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); // Register Broadcast Receiver if (receiver == null) receiver = new WiFiScanReceiver(this); registerReceiver(receiver, new IntentFilter( WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); Log.d(TAG, "onCreate()"); ArrayList&lt;ScanResult&gt; wifiScanList = new ArrayList&lt;ScanResult&gt;(wifi.getScanResults()); wifis = new String[wifiScanList.size()]; for( int i = 0; i &lt; wifiScanList.size(); i++){ wifis[i] = ((wifiScanList.get(i).BSSID).toString()+" , " + String.valueOf(wifiScanList.get(i).level) +" , " + String.valueOf(wifiScanList.get(i).frequency)); Log.e("WIFI list", " : " + wifis[i]); }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35333846
has comment: http://stackoverflow.com/comment/35333258
has answer: http://stackoverflow.com/a/23113275

http://stackoverflow.com/comment/35331430
type: Comment
has text: I haven't looked at all your code, because there's just too much of it. I suspect that you haven't totally grasped all things should be laid out and organized, so I can only give you an advice. Have a look at [my blog](http://blog.ltgt.net/) too, I posted some articles about places and activities that might help you understand all this.
type: AnswerComment
comment on: http://stackoverflow.com/a/23112526
score: 0

http://stackoverflow.com/q/23013617
has comment: http://stackoverflow.com/comment/35153087
has comment: http://stackoverflow.com/comment/35152928
has comment: http://stackoverflow.com/comment/35152854
type: Question
has comment: http://stackoverflow.com/comment/35153270
has comment: http://stackoverflow.com/comment/35153040
tagged with: java
has answer: http://stackoverflow.com/a/23014187
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/35153002
answer count: 1
has body: I have a text file with only +'s and blank spaces. i have to find a target within this file that looks like a spaceship. but the spaceship does not have to be perfect. thanks in advance this is the text file with the targets, a smaller version. there is at least 1 target in this. + ++ + + + + + + + +++ + + ++ + + ++ + + ++ ++ + + + + + + ++ + + ++++ ++ + + ++++ + ++ + ++ + + + + + ++ + ++ + + + + + + ++ + + + + + + ++ + + +++ ++ +++ + + + + ++ + ++ ++ + ++ + + + + + ++ + + + + ++ + + + ++ + + ++ ++ +++ + + ++ + ++ + + + + ++ ++ + + + ++ ++ + + + + + + + + + + ++ + + this is the target + + +++ +++++++ ++ ++ ++ + ++ ++ +++ ++ ++ + ++ ++ ++ +++++++ +++ I have tried Regex pattern reading but the file is too big so i decided to go against that. I do not know any other way to solve this.
has comment: http://stackoverflow.com/comment/35153400
favorite count: 0
has comment: http://stackoverflow.com/comment/35153691
has comment: http://stackoverflow.com/comment/35152826
has comment: http://stackoverflow.com/comment/35152894
score: 0
has comment: http://stackoverflow.com/comment/35152965
has comment: http://stackoverflow.com/comment/35156298
has comment: http://stackoverflow.com/comment/35153404
tagged with: regex
has title: find a target pattern in a text file java
has comment: http://stackoverflow.com/comment/35157333
tagged with: text-files
tagged with: pattern-matching
type: UnansweredQuestion

http://stackoverflow.com/a/23085805
accepted answer of: http://stackoverflow.com/q/23085711
answers question: http://stackoverflow.com/q/23085711
has comment: http://stackoverflow.com/comment/35334994
has comment: http://stackoverflow.com/comment/35334976
has body: getActivity() is returning null because you are using it before fragment get attached to Activity. You need to initialize this at onCreateView @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { eArray = getActivity().getResources().getStringArray(R.array.English); }
score: 12
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35395094
upvote count: 12
type: Answer

http://stackoverflow.com/comment/35132154
type: AnswerComment
has text: I get `'Neo4jTemplate()' has protected access to 'org.springframework.neo4j.support.Neo4jTemplate'` on the `Neo4jTemplate()` function.
type: Comment
comment on: http://stackoverflow.com/a/23002023
score: 0

http://stackoverflow.com/q/23075933
has comment: http://stackoverflow.com/comment/35266544
tagged with: java
has comment: http://stackoverflow.com/comment/35266667
tagged with: servlets
has comment: http://stackoverflow.com/comment/35266669
answer count: 1
tagged with: jsp
has body: When I set content type as response.setContentType( "text/html" ); Japanese characters were displayed properly, but Japanese characters were missing when I set content type as "application/pdf". I have also tried "application/pdf; charset=Shift_JIS", but didn't work.
has comment: http://stackoverflow.com/comment/35266604
has answer: http://stackoverflow.com/a/23077825
has comment: http://stackoverflow.com/comment/35266578
has comment: http://stackoverflow.com/comment/35266530
has comment: http://stackoverflow.com/comment/35266714
has comment: http://stackoverflow.com/comment/35266586
score: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/17561929
has comment: http://stackoverflow.com/comment/35266500
has comment: http://stackoverflow.com/comment/35266602
has comment: http://stackoverflow.com/comment/35267649
type: Question
has comment: http://stackoverflow.com/comment/35266511
has title: HTTPResponse fail to display Japanese characters

http://stackoverflow.com/comment/35136665
type: Comment
comment on: http://stackoverflow.com/a/23003846
has text: @MockerTim I probably do it [too often](http://stackoverflow.com/tags/applet/topusers). ;)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35243901
score: 0
type: Comment
type: QuestionComment
has text: Okay, p can apparrently be figured out by: p(n)−1= 2−1/n−1 = 1−1/n = 1−p(1/n)
comment on: http://stackoverflow.com/q/23063423

http://stackoverflow.com/comment/35333507
has text: Please define `problem`. I don't understand what you mean by "generating a random math problem". Do you mean a mathematical *expression*? With numbers and operators and parentheses?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23113696

http://stackoverflow.com/comment/35073796
has text: Thats ok maan..Happy that you got it before the review..:)
type: Comment
comment on: http://stackoverflow.com/a/22969396
score: 0
type: AnswerComment

http://stackoverflow.com/q/22975007
tagged with: namespaces
has comment: http://stackoverflow.com/comment/35084347
score: 0
tagged with: java
has body: this is a question of good practices and organization. In JavaScript, I'm used to organizing even small parts of code into objects like this: var init{ menu: function(){...}, navBar: function(){...}, connection: function(){...}, }; // And then call it like: init.menu(); init.navBar(); [...] I want to be able to do that, but haven't found a good way to doit. Grouping it inside static classes make it difficult to access the Activity. Instantiating a class, just for that, seems to much for me. Here is what I came up with, but I don't actually like it because I have to assign the context, and instantiate it as a helper class: SwitchToHelper switchTo; @Override protected void onCreate(Bundle savedInstanceState) { [...] // Instantiate fragment helper switchTo = new SwitchToHelper(this); switchTo.Feed(); } class SwitchToHelper{ FragmentActivity context; // This is a default viewId to be used int defaultViewId; SwitchToHelper(FragmentActivity context) { this.context = context; defaultViewId = R.id.fragment; } void Feed(){ // Creates and switches fragment Fragment feedFragment = FeedFragment.newInstance(); makeTransaction(feedFragment).commit(); } } Do you know good practices for that? Thanks
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35085005
type: Question
has comment: http://stackoverflow.com/comment/35083588
has comment: http://stackoverflow.com/comment/35083603
has title: Organizing Java Code with inner classes
has comment: http://stackoverflow.com/comment/35084062
has comment: http://stackoverflow.com/comment/35083857
has comment: http://stackoverflow.com/comment/35084609
answer count: 1
has comment: http://stackoverflow.com/comment/35084972
has comment: http://stackoverflow.com/comment/35084028
favorite count: 0
has comment: http://stackoverflow.com/comment/35084364
has comment: http://stackoverflow.com/comment/35083909
has comment: http://stackoverflow.com/comment/35084548
has answer: http://stackoverflow.com/a/22994584
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35083680
tagged with: android
has comment: http://stackoverflow.com/comment/35083622
has comment: http://stackoverflow.com/comment/35083871
has comment: http://stackoverflow.com/comment/35084642
tagged with: design-patterns

http://stackoverflow.com/comment/43525748
comment on: http://stackoverflow.com/a/23120553
type: AnswerComment
has text: After looking back at this we found flaws with storing compiled Groovy scripts in the database. If Groovy gets updated in our project then all the scripts in the database need to be recompiled. Another case was the implementation I wrote it wasn't made possible to easily handle inner classes, enums, etc. This is a better way to compile scripts at runtime. The only issue I have right now is I am a ton of dead GroovyClassLoaders in Perm Gen that aren't being cleaned up by Full GC (http://stackoverflow.com/questions/27451058/groovy-update-causing-a-ton-of-dead-groovyclassloaders-in-permgen).
score: 0
type: Comment

http://stackoverflow.com/comment/35537448
type: Comment
type: QuestionComment
has text: @LorenzoGatti I am pretty confident that the class name is matching, I pursued the linked `CodeSource` possible solution and now I am seeing that my class file(qualified name and all) is stated as being loaded from the location that I expect it to be loaded. This was accomplished by editing the my logic inside of my overloaded `getClassLoader()` method and `getJavaFileForOutput()` in my extended `ForwardingJavaFileManager<JavaFileManager>` to support feeding the returned classLoader the proper CodeSource URL location.
score: 0
comment on: http://stackoverflow.com/q/23095119

http://stackoverflow.com/q/23129669
downvote count: 0
has title: Java compile error
favorite count: 0
has comment: http://stackoverflow.com/comment/35361670
type: UnansweredQuestion
has body: Could you help me to explain what this error message means when I tried to compile Java code? Matching.java:128: error: ';' expected If (nIsBigger==true){ ^ I don't think ; is needed after the if () ?
has answer: http://stackoverflow.com/a/23129726
score: 1
has comment: http://stackoverflow.com/comment/35361689
tagged with: java
has comment: http://stackoverflow.com/comment/35361682
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35361679
tagged with: compilation
tagged with: boolean
answer count: 2
has answer: http://stackoverflow.com/a/23129699

mapactivity
type: Tag
tags question: http://stackoverflow.com/q/23079205
tag name: mapactivity

http://stackoverflow.com/a/22987978
upvote count: 6
answers question: http://stackoverflow.com/q/22987844
score: 6
has body: From the documentation When the actual type parameter is ?, it stands for some unknown type. Any parameter we pass to add would have to be a subtype of this unknown type. Since we don't know what type that is, we cannot pass anything in. The sole exception is null, which is a member of every type. so, you can add only list.add(null); Please read this tutorial on Generics Wildcards
has comment: http://stackoverflow.com/comment/35107164
downvote count: 0
type: Answer

http://stackoverflow.com/a/22973504
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35082248
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/35129496
upvote count: 1
has body: The Object that you wrote to the ObjectOutputStream is called mediaList, therefore I assume that this is an ArrayList&lt;Media&gt; rather than each individual Media object. On the ObjectInputStream, you are reading an object and casting it to Media, but I think that you will find that it is an ArrayList&lt;Media&gt; (or however mediaList is defined when it is written to the ObjectOutputStream).
has comment: http://stackoverflow.com/comment/35127534
answers question: http://stackoverflow.com/q/22973103
has comment: http://stackoverflow.com/comment/35081015
accepted answer of: http://stackoverflow.com/q/22973103
has comment: http://stackoverflow.com/comment/35119025

http://stackoverflow.com/comment/35167861
type: QuestionComment
comment on: http://stackoverflow.com/q/23021406
has text: any other language like java script etc. if yes can you tell me how?
score: 0
type: Comment

http://stackoverflow.com/q/23060559
has comment: http://stackoverflow.com/comment/35238920
upvote count: 2
has comment: http://stackoverflow.com/comment/35238954
has comment: http://stackoverflow.com/comment/35238914
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35239467
possible better answer: http://stackoverflow.com/a/23060880
score: 1
has comment: http://stackoverflow.com/comment/35238909
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I have a json string which contains custom object details as follow. { "bankapp.bean.account.CustomerDetails": { "setEmail": "value", "setCity": "value", "setAddress": "value", "setBestTime": "value", "getBestTime": "value", "setPhone": "value", "getPassword": "value", "getCustomerId": "value", "setLastName": "value", "getEmail": "value", "getLastName": "value", "setFirstName": "value", "setCustomerId": "value", "getPhone": "value", "setPassword": "value", "getFirstName": "value", "getCity": "value", "getAddress": "value" } } I want all the properties of this class using its getter methods. Here is the code snippet which i tried but failed. String jsonString = "{\"bankapp.bean.account.CustomerDetails\":{\"setEmail\":\"value\",\"setCity\":\"value\",\"setAddress\":\"value\",\"setBestTime\":\"value\",\"getBestTime\":\"value\",\"setPhone\":\"value\",\"getPassword\":\"value\",\"getCustomerId\":\"value\",\"setLastName\":\"value\",\"getEmail\":\"value\",\"getLastName\":\"value\",\"setFirstName\":\"value\",\"setCustomerId\":\"value\",\"getPhone\":\"value\",\"setPassword\":\"value\",\"getFirstName\":\"value\",\"getCity\":\"value\",\"getAddress\":\"value\"}}"; JsonObject jObject = new JsonObject(jsonString); Iterator i = jObject.keys(); while(i.hasNext()) { String currentKey = String.valueOf(i.next()); Object currentValue = jObject.get(currentKey); if(currentValue instanceof String) { System.out.println("Primitive Object"); } else if(currentValue instanceof JSONObject) { //System.out.println("JSON Object"); String key = getKeyName(jsonString); Object jsonObject = jObject.get(key); List&lt;String&gt; lList = breakTheJson(jsonObject.toString()); //List&lt;String&gt; allProperties = new ArrayList&lt;String&gt;(); Iterator&lt;String&gt; iterator = lList.iterator(); while (iterator.hasNext()) { String val = iterator.next(); if(val.startsWith("get") || val.startsWith("is")){ System.out.println(val); } } } else if(currentValue instanceof JSONArray) { System.out.println("Custom Objec…
has comment: http://stackoverflow.com/comment/35238782
has answer: http://stackoverflow.com/a/23060880
has comment: http://stackoverflow.com/comment/35238684
has comment: http://stackoverflow.com/comment/35238713
has answer: http://stackoverflow.com/a/23061168
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35238855
has answer: http://stackoverflow.com/a/23061521
has comment: http://stackoverflow.com/comment/35238876
accepted answer: http://stackoverflow.com/a/23061521
has comment: http://stackoverflow.com/comment/35238371
has title: How to get bean property value from its getter method?
type: AnsweredQuestion

http://stackoverflow.com/q/23056601
has answer: http://stackoverflow.com/a/23157551
has title: Wrong Content-Length for response text with umlaut
score: 4
has comment: http://stackoverflow.com/comment/35411130
answer count: 3
has comment: http://stackoverflow.com/comment/35243897
has body: There is a problem associated with umlaut. I get description on request: @RequestMapping(value = "/description", method = RequestMethod.POST, consumes = "application/json", produces = "text/plain;charset=UTF-8") @ResponseBody private String getDescription() { return "ärchik"; } on frontend response.responseText fails to score the last letter response.responseText = "ärchi" i found that the problem in the wrong Content-Length: 7 if set Content-Length:8, then it will work and return full description "ärchik" But i do not understand why 8? "ärchik".getBytes("UTF-8").length = 7 Response Headers Cache-Control:must-revalidate Content-Length:7 Content-Type:text/plain;charset=utf-8 Date:Mon, 14 Apr 2014 09:08:26 GMT Server:Apache-Coyote/1.1
downvote count: 0
tagged with: diacritics
favorite count: 0
possible better answer: http://stackoverflow.com/a/23157551
has answer: http://stackoverflow.com/a/23098338
tagged with: spring
upvote count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23157828
accepted answer: http://stackoverflow.com/a/23157828
tagged with: http
type: Question

http://stackoverflow.com/a/31367310
type: Answer
has body: Instead of Integer you can use double so that you can get values in decimal also. double First = Double.parseDouble(jTextField1.getText()); // Read the Second number double Second = Double.parseDouble(jTextField2.getText()); // Set the Result double Result = First / Second; jLabel1.setText(String.valueOf(Result));
score: 0
answers question: http://stackoverflow.com/q/23034704

jframe
tags question: http://stackoverflow.com/q/23129402
tags question: http://stackoverflow.com/q/22982739
tags question: http://stackoverflow.com/q/23118594
tags question: http://stackoverflow.com/q/23127807
tags question: http://stackoverflow.com/q/23067313
tags question: http://stackoverflow.com/q/23038674
tags question: http://stackoverflow.com/q/23004079
tags question: http://stackoverflow.com/q/22998891
tags question: http://stackoverflow.com/q/22999315
tags question: http://stackoverflow.com/q/22984760
tag name: jframe
tags question: http://stackoverflow.com/q/23034414
tags question: http://stackoverflow.com/q/23077081
tags question: http://stackoverflow.com/q/23061049
tags question: http://stackoverflow.com/q/23120474
tags question: http://stackoverflow.com/q/23128063
tags question: http://stackoverflow.com/q/23123161
tags question: http://stackoverflow.com/q/23022509
tags question: http://stackoverflow.com/q/22982734
tags question: http://stackoverflow.com/q/23122370
tags question: http://stackoverflow.com/q/23066586
tags question: http://stackoverflow.com/q/23074312
tags question: http://stackoverflow.com/q/23124356
tags question: http://stackoverflow.com/q/23121755
tags question: http://stackoverflow.com/q/23047023
tags question: http://stackoverflow.com/q/23039600
tags question: http://stackoverflow.com/q/23048925
tags question: http://stackoverflow.com/q/23094917
tags question: http://stackoverflow.com/q/22978081
tags question: http://stackoverflow.com/q/23035467
tags question: http://stackoverflow.com/q/23122492
tags question: http://stackoverflow.com/q/22976484
tags question: http://stackoverflow.com/q/23078406
tags question: http://stackoverflow.com/q/23055835
tags question: http://stackoverflow.com/q/23008090
tags question: http://stackoverflow.com/q/23068762
tags question: http://stackoverflow.com/q/23104247
tags question: http://stackoverflow.com/q/22976226
tags question: http://stackoverflow.com/q/22987147
tags question: http://stackoverflow.com/q/23000835
tags question: http://stackoverflow.com/q/23093087
tags question: http://stackoverflow.com/q/23110614
tags question: http://stackoverflow.com/q/23090949
tags question: http://stackoverflow.com/q/23028825
tags question: http://stackoverflow.com/q/23022341
tags question: http://stackoverflow.com/q/22970796
tags question: http://stackoverflow.com/q/23038286
tags question: http://stackoverflow.com/q/23083378
tags question: http://stackoverflow.com/q/22997791
tags question: http://stackoverflow.com/q/23093040
tags question: http://stackoverflow.com/q/23039836
tags question: http://stackoverflow.com/q/23119539
tags question: http://stackoverflow.com/q/23049277
tags question: http://stackoverflow.com/q/22970921
tags question: http://stackoverflow.com/q/22984729
tags question: http://stackoverflow.com/q/22973468
tags question: http://stackoverflow.com/q/23121869
tags question: http://stackoverflow.com/q/23047992
tags question: http://stackoverflow.com/q/23036665
tags question: http://stackoverflow.com/q/23083204
tags question: http://stackoverflow.com/q/23002844
tags question: http://stackoverflow.com/q/22986832
tags question: http://stackoverflow.com/q/23073903
tags question: http://stackoverflow.com/q/23069198
type: Tag
tags question: http://stackoverflow.com/q/23008246
tags question: http://stackoverflow.com/q/23125642

http://stackoverflow.com/a/23067427
downvote count: 0
answers question: http://stackoverflow.com/q/23066144
type: Answer
has body: The Java Language Specification states The Java Virtual Machine dynamically loads, links and initializes classes and interfaces. Loading is the process of finding the binary representation of a class or interface type with a particular name and creating a class or interface from that binary representation. Linking is the process of taking a class or interface and combining it into the run-time state of the Java Virtual Machine so that it can be executed. Initialization of a class or interface consists of executing the class or interface initialization method &lt;clinit&gt; (§2.9). That last part, the &lt;clinit&gt;, is where your static initializers are run. The java launcher option you used -verbose:class simply Displays information about each class loaded. So your class is loaded as part of the web application loading the classpath entries, but it isn't initialized until Jetty instantiates it so that it can use the object to handle a request.
accepted answer of: http://stackoverflow.com/q/23066144
score: 5
upvote count: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/35214142
comment on: http://stackoverflow.com/q/23046619
score: 0
type: QuestionComment
has text: There doesn't appear to be a good reason to use `float`
type: Comment

zoho
type: Tag
tags question: http://stackoverflow.com/q/22986371
tag name: zoho

http://stackoverflow.com/comment/35221596
score: 0
comment on: http://stackoverflow.com/q/23051306
has text: I'm guessing that with some cleverness you could get it down to n*log n or so. Not with a straight-forward algorithm, though.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23120768
tagged with: java
type: Question
upvote count: 1
answer count: 1
downvote count: 0
tagged with: charsequence
tagged with: string
linked to: http://stackoverflow.com/q/1453171
has body: I wrote a program in Java that reads through a Localizable.strings file for iOS localization and creates the counterpart for Android. The iOS files allow special characters, like accented characters (è, é, etc), but for Android these should be converted to decimal unicode representation (and included in an xml file). When I grab the value from the Localizable.strings file, I attempt to replace these symbols using the following code: value = value.replace("...", "&amp;#8230;") .replace("'", "\\'") .replace("’", "\\'") .replace("è", "&amp;#232;") .replace("é", "&amp;#233;"); This successfully replaces ..., ', and ’, but fails to convert the accented characters. I have read the answers here, but this does not address the same problem. What am I doing wrong, and how can I get this to work?
favorite count: 0
has answer: http://stackoverflow.com/a/23120955
tagged with: regex
has title: How can I convert accented characters to HTML symbol in Java?
has comment: http://stackoverflow.com/comment/35346823
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/35346618

http://stackoverflow.com/comment/35188091
type: AnswerComment
comment on: http://stackoverflow.com/a/23022668
type: Comment
has text: I am updating my post. Please wait for a minute.
score: 0

http://stackoverflow.com/comment/35360688
comment on: http://stackoverflow.com/a/23103294
score: 0
type: AnswerComment
type: Comment
has text: i have tried via arguments, but i get runtime exception once I 'setListAdapter(adapter);'. But i can see the bundle was received in debug mode, as-well as ArrayList test contains entered values that came from the bundle arguments. I have updated the all the codes and the LogCat errors. If you can have a look please. Thanks for all your help.

http://stackoverflow.com/comment/35288070
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23088234
has text: Do not understand pseudo-code or any human language, only understand code. Please show code.

http://stackoverflow.com/a/23125394
answers question: http://stackoverflow.com/q/23118747
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has body: Instead of blocking EventDispatcherThread with this try { Thread.sleep(5000); run(); } catch(InterruptedException e){} Use javax.swing.Timer and add your code in the actionPerformed() of Action called by the Timer
accepted answer of: http://stackoverflow.com/q/23118747

http://stackoverflow.com/comment/35181059
score: 0
comment on: http://stackoverflow.com/q/23028949
type: QuestionComment
type: Comment
has text: there is no nested if present in your code and there is nothing like if loop. its `if-else` or `nested if-else`

http://stackoverflow.com/q/23061984
has body: I am trying setting a generic class which will serve as base class for all my Dao classes in my application, but I am facing an error right now. My generic class is defined this way; public class Dao&lt;E&gt; { private final E entity; @Autowired SessionFactory sessionFactory; protected Session getCurrentSession(){ return sessionFactory.getCurrentSession(); } public Dao(E entity) { this.entity = entity; } public E getEntity() { return this.entity; } @Transactional public boolean persist(E transientInstance) { try { sessionFactory.getCurrentSession().persist(transientInstance); return true; } catch (RuntimeException re) { return false; } } @Transactional public boolean remove(E transientInstance) { try { sessionFactory.getCurrentSession().delete(transientInstance); return true; } catch (RuntimeException re) { return false; } } @SuppressWarnings("unchecked") @Transactional public E merge(E detachedInstance) { try { E result = (E) sessionFactory.getCurrentSession().merge(detachedInstance); return result; } catch (RuntimeException re) { return null; } } @Transactional public E findById(int id) { try { E instance = (E) sessionFactory.getCurrentSession().get(E, id); return instance; } catch (RuntimeException re) { return null; } } @SuppressWarnings("unchecked") @Transactional public E findByUsername(String username) { try { E instance = (E) sessionFactory.getCurrentSession().createCriteria(E, username).add(Restrictions.like("login", username)).list().get(0); return instance; } catch (RuntimeException re) { return null; } } @SuppressWarnings("unchecked") @Transactional public List&lt;E&gt; findAll() { try { List&lt;E&gt; instance = sessionFactory.getCurrentSession().createCriteria(E).list(); return instance; } catch (RuntimeException re) { return null; } } } The methods with error are the last three, and is related to the referente to E by get() and createCriteria() in the implementation of them (the error is E cannot be resolved to a variable). Usually, I use something lik…
score: 0
has comment: http://stackoverflow.com/comment/35240758
has comment: http://stackoverflow.com/comment/35241967
tagged with: generics
possible better answer: http://stackoverflow.com/a/23076734
favorite count: 0
upvote count: 1
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35240737
has comment: http://stackoverflow.com/comment/35240825
has answer: http://stackoverflow.com/a/23076734
downvote count: 1
has title: Generic class for the Dao classes
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23062192
accepted answer: http://stackoverflow.com/a/23062192

http://stackoverflow.com/comment/35221267
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23051036
type: Comment
has text: the `nextInt` method is more than capable of catching bad input--you shouldn't be using regular expressions here (it's already done for you in the Java native library).

http://stackoverflow.com/comment/35252384
type: QuestionComment
comment on: http://stackoverflow.com/q/23067739
score: 0
has text: ...so, it is, or isn't, a gui app? Any JFrame's or anything like that? I'm not familiar enough with Netbeans to know if it's making an executable jar or just packaging it all into a jar. Does an icon pop up in the Ubuntu bar?
type: Comment

http://stackoverflow.com/q/23093448
has comment: http://stackoverflow.com/comment/35298442
has title: How to throw `InterruptedException` while junit testing my class?
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/35298307
linked to: http://stackoverflow.com/q/23096026
accepted answer: http://stackoverflow.com/a/23094416
downvote count: 0
tagged with: jmockit
answer count: 3
tagged with: junit
favorite count: 0
has comment: http://stackoverflow.com/comment/35298236
has answer: http://stackoverflow.com/a/23094416
has answer: http://stackoverflow.com/a/23093786
possible better answer: http://stackoverflow.com/a/23094864
score: 4
type: AnsweredQuestion
has body: I am trying to write some junit for a class which is using CountDownLatch and I am using jmockit library for junit testing. public class MappedData { private static final AtomicReference&lt;Map&lt;String, Map&lt;Integer, String&gt;&gt;&gt; mapped1 = new AtomicReference&lt;Map&lt;String, Map&lt;Integer, String&gt;&gt;&gt;(); private static final AtomicReference&lt;Map&lt;String, Map&lt;Integer, String&gt;&gt;&gt; mapped2 = new AtomicReference&lt;Map&lt;String, Map&lt;Integer, String&gt;&gt;&gt;(); private static final CountDownLatch firstSet = new CountDownLatch(1); public static Map&lt;String, Map&lt;Integer, String&gt;&gt; getMapped1Table() { try { firstSet.await(); } catch (InterruptedException e) { throw new IllegalStateException(e); } return mapped1.get(); } public static Map&lt;String, Map&lt;Integer, String&gt;&gt; getMapped2Table() { try { firstSet.await(); } catch (InterruptedException e) { throw new IllegalStateException(e); } return mapped2.get(); } } What is the easiest way to make sure that in the getMapped1Table and getMapped2Table method - I am able to throw an InterruptedException so that I can cover that scenario as well. If you take a look into those two methods, I have a catch block which I am not able to cover. MappedData.getMapped1Table() Is there any way I can make sure that my above two methods are throwing InterruptedException? Update:- What I am trying to do is - how to get firstSet.await() to throw an InterruptedException when I am junit testing.
tagged with: interrupted-exception
has answer: http://stackoverflow.com/a/23094864
tagged with: java

http://stackoverflow.com/comment/35168656
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23020975
has text: Oh thank you very much. but Actually I only have one admin who can add file.

http://stackoverflow.com/a/22975672
upvote count: 3
has body: Ok so this is how I finally solved it. I changed the constructor of the test class to below:- public BasicTest() { super(MainActivity.class); } and it started working. It is kind of strange that this was the reason which kept me busy the whole day.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22974985
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22974985
type: Answer
score: 3

http://stackoverflow.com/comment/35163623
has text: This is an example of the test code public class TestSetInt { public TestSetInt() { SetInt test1 = new SetInt(); for(int i = 2; i<49;i=i+3) test1.add(i);
comment on: http://stackoverflow.com/q/22996587
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35236148
has text: please don't parse xml using pattern matching. There are, in almost every imaginable language, constructs to deal with xml. Use those. It will make your life a lot easier.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23059527
score: 2

http://stackoverflow.com/comment/35237712
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23059888
has text: Read this first.http://stackoverflow.com/help/how-to-ask

http://stackoverflow.com/a/23079172
accepted answer of: http://stackoverflow.com/q/23079030
has comment: http://stackoverflow.com/comment/35273374
answers question: http://stackoverflow.com/q/23079030
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35274611
downvote count: 0
has comment: http://stackoverflow.com/comment/35274103
has body: The magic word here is SWT.RIGHT_TO_LEFT. However, it is not applied to the Layout, but to the Composite containing your widgets. Here is some example code: public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(2, true)); shell.setText("ExpandBar Example"); Composite ltr = new Composite(shell, SWT.LEFT_TO_RIGHT); ltr.setLayout(new GridLayout(3, true)); ltr.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Composite rtl = new Composite(shell, SWT.RIGHT_TO_LEFT); rtl.setLayout(new GridLayout(3, true)); rtl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); for(int i = 0; i &lt; 10; i++) { new Button(ltr, SWT.PUSH).setText("Button " + i); new Button(rtl, SWT.PUSH).setText("Button " + i); } shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } And this is what it looks like: To get both right-to-left and bottom-to-top, you'll just have to use moveAbove/moveBelow with null as the parameter: public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(2, true)); shell.setText("StackOverflow"); Composite ltr = new Composite(shell, SWT.LEFT_TO_RIGHT); ltr.setLayout(new GridLayout(3, true)); ltr.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Composite rtl = new Composite(shell, SWT.LEFT_TO_RIGHT); rtl.setLayout(new GridLayout(3, true)); rtl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); int nrOfItems = 10; int nrOfColumns = ((GridLayout) rtl.getLayout()).numColumns; int fillerItems = nrOfColumns - nrOfItems % nrOfColumns; for (int i = 0; i &lt; nrOfItems; i++) { new Button(ltr, SWT.PUSH).setText("Button " + i); new Button(rtl, SWT.PUSH).setText("Button " + i); } for(int i = 0; i &lt; fillerItems; i++) new Label(rtl, SWT.NONE); Control[] children = rtl.getChildren(); for (int i…
upvote count: 2
has comment: http://stackoverflow.com/comment/35274898
type: Answer
has comment: http://stackoverflow.com/comment/35275918
score: 2

http://stackoverflow.com/comment/35307338
comment on: http://stackoverflow.com/q/23098535
has text: But as you have mentioned that it is about a die..how can array how more than 6 elements?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22983715
has comment: http://stackoverflow.com/comment/35099681
has comment: http://stackoverflow.com/comment/35099201
has comment: http://stackoverflow.com/comment/35099860
favorite count: 0
has answer: http://stackoverflow.com/a/22984265
has answer: http://stackoverflow.com/a/22983900
has body: I want to wrap a class in Java but the problem is as follows: public class A { public A() { doSomething(); } public void doSomething() { } } Now when I try to wrap this class and delegate all methods to the wrapper public class Wrapper extends A { private final A a; public Wrapper(A a) { super(); this.a = a; } @Override public void doSomething() { this.a.doSomeThing(); } } of course I get a NPE as 'a' is still null as it is set after the super()-call which calls the overriden doSomething() method. Is there any solution for this problem? The only thing that came to my mind was making a factory method and setting a static variable holding the reference to a but this seems ugly to me.
possible better answer: http://stackoverflow.com/a/22983820
answer count: 4
has answer: http://stackoverflow.com/a/22983820
type: AnsweredQuestion
has title: Java wrapper: overriding a method called in the super constructor
has answer: http://stackoverflow.com/a/22983859
tagged with: java
has comment: http://stackoverflow.com/comment/35098712
type: Question
accepted answer: http://stackoverflow.com/a/22983900
has comment: http://stackoverflow.com/comment/35098542
tagged with: inheritance
score: 4
upvote count: 4
tagged with: wrapper
has comment: http://stackoverflow.com/comment/35099028
downvote count: 0

http://stackoverflow.com/comment/35376329
type: Comment
has text: No, I am talking about this method --> public static String averagefood() . It is supposed to return data for all gerbils, but only returns it for the first one entered
comment on: http://stackoverflow.com/a/23124234
type: AnswerComment
score: 0

http://stackoverflow.com/q/23031658
has body: I've a problem with Joda Time... So, I'm developing a time difference method and I would be calculate the interval beetwen 2 times... I must develop 2 cases but I don't undestand how can I do: 1° case - interval date1 = "01/02/2014 9:00"; date2 = "01/02/2014 18:00"; Expected result: 9 hours 2° case - difference time date1 = "9:00"; date2 = "1:00"; Expected result: 8 how can I do? I'm very confused... thank you guys!!
score: 0
accepted answer: http://stackoverflow.com/a/23035833
tagged with: java
tagged with: jodatime
has title: Difference hours Joda time in Java
type: AnsweredQuestion
tagged with: datetime
has comment: http://stackoverflow.com/comment/35185995
has answer: http://stackoverflow.com/a/23035833
type: Question
has comment: http://stackoverflow.com/comment/35199661
answer count: 1

http://stackoverflow.com/q/23024530
accepted answer: http://stackoverflow.com/a/23024587
downvote count: 0
tagged with: url
favorite count: 0
has answer: http://stackoverflow.com/a/23024567
has body: I am trying to get user input and print out the contents from the URL received. I have just about everything I need but I need help getting the user input to only have http://. From there I would to move it into my string in order to show it's contents. I also keep getting the java.net.MalformedURLException: no protocol error. How can I fix this and implement this code? import java.util.*; import java.io.PrintWriter; import java.util.Scanner; import java.net.URL; import java.io.IOException; import java.net.URLConnection; class Lab9 { public static void main(String[] args) throws IOException { { System.out.println ("Enter a URL"); Scanner myInput = new Scanner(System.in); String input = myInput.nextLine(); URL url = new URL(input); //Here I want to add user input and get a URL that only contains http:// String address = " "; URL pageLocation = new URL(address); Scanner in = new Scanner(pageLocation.openStream()); while (in.hasNext()) { String line = in.next(); if (line.contains("href=\"http://")) {int from = line.indexOf("\""); int to = line.lastIndexOf("\""); System.out.println(line.substring(from + 1,to)); } } } } }
has title: URL Input and Format
possible better answer: http://stackoverflow.com/a/23024567
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23024587
answer count: 2

http://stackoverflow.com/a/23093966
accepted answer of: http://stackoverflow.com/q/23087598
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/23087598
type: AcceptedAnswer
score: 4
has body: Their repository is not browsable, that's why you get the 404 on testing. You can disregard the error, if should resolve the artifacts just fine (assuming the coordinates are correct).
downvote count: 0

http://stackoverflow.com/comment/35155039
type: QuestionComment
score: 0
has text: @Arcturus, Yes your assumption is correct
comment on: http://stackoverflow.com/q/23014823
type: Comment

http://stackoverflow.com/a/23068371
has body: Try AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); https://developer.android.com/guide/topics/ui/dialogs.html Also make sure that SignUpActivity is declared in the app manifest. I guess make sure that all activities are set up in the manifest. EDIT 1 If line 40 is the issue, then mUserName is null or mUserName.getText() is null. So create a couple checks before hand and also add some debug logs to just verify that they are not null. Make sure that R.layout.activity_sign_up has usernameField as an id. Also make sure in any other app/res/layout folders (ie layout-v14), that all R.layout.activity_sign_up has the edittext as well.
score: 0
answers question: http://stackoverflow.com/q/23068041
type: Answer

http://stackoverflow.com/q/22988262
downvote count: 1
has comment: http://stackoverflow.com/comment/35106645
has comment: http://stackoverflow.com/comment/35108282
has comment: http://stackoverflow.com/comment/35106632
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/35106473
has comment: http://stackoverflow.com/comment/35108643
has comment: http://stackoverflow.com/comment/35107006
type: Question
has answer: http://stackoverflow.com/a/23010971
tagged with: jsoup
upvote count: 0
tagged with: url
answer count: 1
has title: Fetching html from a URL
has comment: http://stackoverflow.com/comment/35108950
favorite count: 0
has comment: http://stackoverflow.com/comment/35106384
type: UnansweredQuestion
has body: I'm trying to fetch the search results from a digital library by accessing the following URL: <a href="http://search.lib.monash.edu/primo_library/libweb/action/search.do?dscnt=0&amp;frbg=&amp;scp.scps=scope%3A%2861MONASH_AU%29%2Cscope%3A%28catcarm%29%2Cscope%3A%28arrow%29%2Cscope%3A%28arrow%29%2Cscope%3A%28MUA%29%2Cscope%3A%28catau%29%2Cprimo_central_multiple_fe&amp;tab=default_tab&amp;dstmp=1397132268717&amp;srt=rank&amp;ct=search&amp;mode=Basic&amp;dum=true&amp;indx=1&amp;vl%28freeText0%29=java&amp;fn=search&amp;vid=MON" rel="nofollow">http://search.lib.monash.edu/primo_library/libweb/action/search.do?dscnt=0&amp;frbg=&amp;scp.scps=scope%3A%2861MONASH_AU%29%2Cscope%3A%28catcarm%29%2Cscope%3A%28arrow%29%2Cscope%3A%28arrow%29%2Cscope%3A%28MUA%29%2Cscope%3A%28catau%29%2Cprimo_central_multiple_fe&amp;tab=default_tab&amp;dstmp=1397132268717&amp;srt=rank&amp;ct=search&amp;mode=Basic&amp;dum=true&amp;indx=1&amp;vl%28freeText0%29=java&amp;fn=search&amp;vid=MON This url works just fine from any web browser, however, when I try to read this URL from my java application it returns this html file, which seems that it redirects the application to another page: &lt;!-- filename: sso --&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Login &lt;/title&gt; &lt;!-- START filename: meta-tags.pds --&gt; &lt;meta http-equiv="Cache-Control" content="no-cache" /&gt; &lt;meta http-equiv="Pragma" content="no-cache" /&gt; &lt;meta http-equiv="Expires" content="Sun, 06 Nov 1994 08:49:37 GMT" /&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;!-- END filename: meta-tags.pds --&gt; &lt;link rel="stylesheet" href="http://monash-dc05.hosted.exlibrisgroup.com:8991/PDSMExlibris.css" type="text/css" /&gt; &lt;/head&gt; &lt;body onload="location = '/goto/http://search.lib.monash.edu:80/primo_library/libweb/action/login.do?afterPDS=true&amp;amp;vid=MON&amp;amp;vid=MON&amp;amp;dscnt=0&amp;amp;targetURL=http%3A%2F%2Fsearch.lib.monash.edu%2Fprimo_library%2Flibweb%2Faction%…

http://stackoverflow.com/q/23014721
downvote count: 0
tagged with: spinner
favorite count: 0
has comment: http://stackoverflow.com/comment/35155970
tagged with: android
has comment: http://stackoverflow.com/comment/35154939
has comment: http://stackoverflow.com/comment/35154918
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/35154865
upvote count: 2
type: UnansweredQuestion
has body: I'm currently developping a small app and therefore want to add a spinner to a dialog. I looked for several tutorials on the web on how to add items to that spinner. So this is what I have so far: @SuppressWarnings({ "rawtypes", "unchecked" }) public void prepareNewClubSpinner(){ DatabaseHandler db = new DatabaseHandler(getApplicationContext()); ArrayList&lt;String&gt; rest = db.getRest(); List&lt;String&gt; list = new ArrayList&lt;String&gt;(); for(String entry : rest){ list.add(entry); } ArrayAdapter dataAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinClub.setAdapter(dataAdapter); } I've checked the list with the debugger and it does contain all the entries, so the loop is filling the list correctly but the items do not show up in my spinner whatsoever. I seem to miss something, but can't figure out what! Anyone got an idea?
has title: Spinner in Dialog not showing items?
has comment: http://stackoverflow.com/comment/35155224
has comment: http://stackoverflow.com/comment/35154785
has comment: http://stackoverflow.com/comment/35154800
tagged with: java
has comment: http://stackoverflow.com/comment/35154707
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35154969

http://stackoverflow.com/comment/35207035
has text: I would use `BigDecimal` here or multiply everything by 1e7
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23043631
score: 1

http://stackoverflow.com/a/23050180
has comment: http://stackoverflow.com/comment/108103493
type: Answer
upvote count: 25
score: 25
has body: No, there isn't. If I understood your question correctly you'd want to use lambdas for interfaces with more than one abstract method. In that case the answer is negative: A functional interface is any interface that contains only one abstract method. (A functional interface may contain one or more default methods or static methods.) Because a functional interface contains only one abstract method, you can omit the name of that method when you implement it. To do this, instead of using an anonymous class expression, you use a lambda expression [...] Read it up there: http://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html
answers question: http://stackoverflow.com/q/23050097
downvote count: 0
has comment: http://stackoverflow.com/comment/68746963

http://stackoverflow.com/comment/35141832
has text: By maintaining session you are violating one of the basic constraints of REST architecture
comment on: http://stackoverflow.com/q/23007445
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23096555
downvote count: 0
has title: Spring MVC page to page navigation not working
tagged with: jsp
favorite count: 0
has body: I have two pages: home.jsp, and stylechoosertable.jsp. home.jsp has a simple link going to stylechoosertable.jsp. Both are in src - main - webapp - views. Starting the app runs fine, loading home.jsp is fine. However, when I click the link, it goes to a 404 Not Found page. Here is HomeController.java @Controller public class HomeController { private static final Logger logger = LoggerFactory.getLogger(HomeController.class); /** * Simply selects the home view to render by returning its name. */ @RequestMapping(value = "/", method = RequestMethod.GET) public String home(Model model) { logger.info("Welcome home! The client locale is {}."); return "home"; } } Here is CSSTableController.java @Controller public class CSSTableController { private static final Logger logger = LoggerFactory.getLogger(CSSTableController.class); private final CSSService cssService; @Autowired public CSSTableController(CSSService cssService) { this.cssService = cssService; } @RequestMapping(value = "/stylechoosertable.jsp", method = RequestMethod.GET) public List<StyleChooser> get() { return cssService.getAllStyleChoosers(); } } servlet-context.xml <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <beans:property name="prefix" value="/WEB-INF/views/" /> <beans:property name="suffix" value=".jsp" /> </beans:bean> web.xml appServlet / A couple of things I've noticed: Only local:8080/myspringmvc/ brings up the home page. local:8080/myspringmvc/home.jsp brings up the same 404 error, which I don't get. On start, I can see it doing the Request/Handler mappings properly: INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/stylechoosertable.jsp],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List com.css.genapp.CSSTableController.get() INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/],methods=[GET],params=[],headers=…
has comment: http://stackoverflow.com/comment/35303849
has comment: http://stackoverflow.com/comment/35303817
tagged with: spring
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23096831
possible better answer: http://stackoverflow.com/a/23097014
has answer: http://stackoverflow.com/a/23097014
answer count: 2
accepted answer: http://stackoverflow.com/a/23096831

http://stackoverflow.com/comment/35194227
has text: Please do not name your type parameter "Object"
comment on: http://stackoverflow.com/q/23015214
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/a/23035201
has comment: http://stackoverflow.com/comment/35209537
has comment: http://stackoverflow.com/comment/35192453
upvote count: 15
score: 15
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23034837
has body: Take a look into play.mvc.Http class, you have some options there (depending on data format) i.e. RequestBody body = request().body(); MultipartFormData formData = request().body().asMultipartFormData(); Map&lt;String, String[]&gt; params = request().body().asFormUrlEncoded(); JsonNode json = request().body().asJson(); String bodyText = request().body().asText(); You can test request().body().asText() i.e. using cUrl from commandline: curl -H "Content-Type: text/plain" -d 'Hello world !' http://domain.com/your-post-action ... or using some tool, like browser plugin: https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo
has comment: http://stackoverflow.com/comment/35193137
answers question: http://stackoverflow.com/q/23034837
has comment: http://stackoverflow.com/comment/35199302
type: Answer

http://stackoverflow.com/comment/35102750
score: 1
type: AnswerComment
has text: Passing the url as a pathparam, you're changing your requesting url and you don't want this. You need to keep your url static and just send a value that will be processed after you select the processing method. Edited: Use "@RequestParam("url") String url" in your method instead of PathParam and, when you perform the http request, create the url correctly, like localhost/app/.../broaders/?url=YOUR_VALUE
comment on: http://stackoverflow.com/a/22986141
type: Comment

http://stackoverflow.com/a/22971508
upvote count: 1
type: AcceptedAnswer
has body: The pattern "\\d*" matches 0 or more digits. Same stands for ".*". It matches 0 or more occurrence of any character except newline. The last match that you get is the empty string at the end of your string, after "b". The empty string satisfies the pattern \\d*. If you change the pattern to \\d+, you'll get expected result. Similarly, the pattern .* matches everything from first character to last character. Thus it first matches "a1b". After that the cursor is after b: "a1b|". Now, matcher.find() again runs, and finds a zero-length string at the cursor, which satisifies the pattern .*, so it considers it as a match. The reason why it gives expected output with "^.*$" is that the last empty string doesn't satisfy the ^ anchor. It is not at the beginning of the string, so it fails to match.
has comment: http://stackoverflow.com/comment/35076957
has comment: http://stackoverflow.com/comment/35077012
type: Answer
accepted answer of: http://stackoverflow.com/q/22971447
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22971447

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/22976815
type: Tag
tags question: http://stackoverflow.com/q/22977873

http://stackoverflow.com/a/23239687
answers question: http://stackoverflow.com/q/23021546
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23021546
has comment: http://stackoverflow.com/comment/85033373
has body: 1: mostly yes, user should choose what to include in the UML(visibility, relations...), and for example when generating class diagrams you will have to place all the objects in order to make it more understandable. 2: you should right click the class and select add->generalized 3: when creating the class diagram you should unselect the option "show icons" and then you will see the '+' and '-' symbols and no other icons 4: the most used standards are '+', '-', '#'... I don't know if those icons are standard because I always use it without icons. Hope I solved your doubts
downvote count: 0

http://stackoverflow.com/q/23045084
has answer: http://stackoverflow.com/a/23056669
tagged with: java
type: Question
upvote count: 1
has title: Trying to use Collections.sort (ArrayList<String>) and Collections.sort(ArrayList<String>, Comparator) with no luck
has comment: http://stackoverflow.com/comment/35210353
tagged with: sorting
favorite count: 0
answer count: 3
has body: I create a simple string arraylist as such: ArrayList&lt;String&gt; filmDirectory = new ArrayList&lt;String&gt;(); filmDirectory.add("Gone with the Wind"); filmDirectory.add("The Sound of Music"); filmDirectory.add("The Titanic"); Collections.sort(filmDirectory); The compiler prompts me to case the filmDirectory to a list, which I do, though I do not understand why I should do it, since and ArrayList is an extension of a List. Still, when the code reaches to: Collections.sort((List)filmDirectory); I have a compiler error of: java.lang.ClassCastException: java.util.ArrayList cannot be cast to acmx.export.java.util.List Implementing Comparator and defining compare method for the current class and using Collections.sort(filmDirectory, this) does not help either.
has comment: http://stackoverflow.com/comment/35209880
has answer: http://stackoverflow.com/a/23056792
downvote count: 0
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/23057295
tagged with: collections
has comment: http://stackoverflow.com/comment/35209919

http://stackoverflow.com/comment/35535214
score: 0
type: Comment
has text: That's what I am saying, if yo know your max depth you can just the default prefix. You just need to make sure that you target these fieldnames, eg parent.name, parent.parent.name, etc in your query.
comment on: http://stackoverflow.com/a/23216293
type: AnswerComment

http://stackoverflow.com/comment/35256388
comment on: http://stackoverflow.com/q/23070332
type: Comment
type: QuestionComment
score: 1
has text: You mean stuck due to logic or performance ?

http://stackoverflow.com/comment/35299935
comment on: http://stackoverflow.com/q/23093947
type: Comment
type: QuestionComment
has text: No, its not an applet, its on a web server.
score: 0

http://stackoverflow.com/q/23063867
tagged with: file
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35244404
has answer: http://stackoverflow.com/a/23064101
answer count: 3
has comment: http://stackoverflow.com/comment/35244306
has comment: http://stackoverflow.com/comment/35244716
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35244343
favorite count: 0
has comment: http://stackoverflow.com/comment/35244638
has comment: http://stackoverflow.com/comment/35244443
has comment: http://stackoverflow.com/comment/35244379
type: UnansweredQuestion
tagged with: io
has answer: http://stackoverflow.com/a/23064111
has title: Failing to print out contents of a file
has body: I'm trying to print out the contents of the file. When I run the program, it doesn't do anything and I'm having trouble figuring out why. public static void main(String[] args) { String fileName = "goog.csv"; File file = new File(fileName); try { Scanner inputStream = new Scanner(file); while(inputStream.hasNext()){ String data = inputStream.next(); System.out.println(data + "***"); } inputStream.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
has answer: http://stackoverflow.com/a/23064067
tagged with: java

http://stackoverflow.com/a/23045038
has comment: http://stackoverflow.com/comment/35210099
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35209942
score: 4
has comment: http://stackoverflow.com/comment/35212733
has comment: http://stackoverflow.com/comment/35212687
has comment: http://stackoverflow.com/comment/35212771
has comment: http://stackoverflow.com/comment/35212997
type: Answer
answers question: http://stackoverflow.com/q/23044976
upvote count: 4
has comment: http://stackoverflow.com/comment/35212881
accepted answer of: http://stackoverflow.com/q/23044976
downvote count: 0
has comment: http://stackoverflow.com/comment/35209792
has comment: http://stackoverflow.com/comment/35212699
has body: I don't think this is a Tomcat issue. It's a Java issue with how you are writing to the file. Use the appropriate character set when writing. PrintWriter printWriter = new PrintWriter(new File("C:/text.txt"), "UTF-8"); and reading, obviously.
has comment: http://stackoverflow.com/comment/35209913
has comment: http://stackoverflow.com/comment/35210162
has comment: http://stackoverflow.com/comment/35209858

http://stackoverflow.com/comment/55353559
type: AnswerComment
type: Comment
has text: If there's a constraint on the bean whose validator uses a service (e.g. to check if an email address is unique) the controller is very much the right place to span the transaction.
comment on: http://stackoverflow.com/a/23120647
score: 0

http://stackoverflow.com/q/23098790
has comment: http://stackoverflow.com/comment/35309384
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/58221698
has comment: http://stackoverflow.com/comment/35308712
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35309333
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/23099857
has answer: http://stackoverflow.com/a/23099818
type: Question
has answer: http://stackoverflow.com/a/23099810
tagged with: java
has answer: http://stackoverflow.com/a/23099898
has title: How can I enter "char" using Scanner in java?
has body: I have a question how can I enter char using Scanner in java? Such as for integer number Scanner input=new Scanner(System.in); int a = input.nextInt(); but how can I do the same for char? thanks for helping.
linked to: http://stackoverflow.com/q/13942701

http://stackoverflow.com/a/49319746
score: 7
upvote count: 7
downvote count: 0
has body: For List : List&lt;Integer&gt; intList = stringList.stream().map(Integer::valueOf).collect(Collectors.toList()); For Array : int[] intArray = Arrays.stream(stringArray).mapToInt(Integer::valueOf).toArray();
type: Answer
answers question: http://stackoverflow.com/q/23057549

http://stackoverflow.com/comment/35358226
score: 1
has text: The anser to the universe and everything is 42. Its a joke. The random function uses seeds for token creation like salt in password encryption, but there to add a non-stored key. Here you can use the same seed (id) to get a result.
comment on: http://stackoverflow.com/q/23127392
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35161760
type: Comment
type: QuestionComment
has text: java is case sensitive. islands and Islands not same. so there will be a compilation error
comment on: http://stackoverflow.com/q/23018302
score: 0

http://stackoverflow.com/a/23020077
has body: The Spring JPA documentation says the following about jpa:repositories [...] Spring is instructed to scan com.acme.repositories and all its subpackages for interfaces extending Repository or one of its subinterfaces. For each interface found, the infrastructure registers the persistence technology-specific FactoryBean to create the appropriate proxies that handle invocations of the query methods. Each bean is registered under a bean name that is derived from the interface name, so an interface of UserRepository would be registered under userRepository. The base-package attribute allows wildcards, so that you can define a pattern of scanned packages. So &lt;jpa:repositories base-package="com.mycompany.rd.misf.repository" /&gt; scans that base package and all its sub packages for classes extending Repository which JpaRepository does and therefore your PersonRepository interface does so a bean is created. This is behavior specific to JPA. With &lt;context:component-scan base-package="com.mycompany.rd.misf.model,com.mycompany.rd.misf.repository" /&gt; you're telling Spring to scan the specified package(s) and its(their) subpackages for components, types annotated with @Component and its specializations. If any annotated classes are found, Spring should create a bean definition for them. In your case, it finds a specialization of @Component, @Repository, but it is an interface, so it doesn't register a bean definition. It is has absolutely no knowledge of JPA in this case.
score: 4
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23019946
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23019946

http://stackoverflow.com/comment/35245647
comment on: http://stackoverflow.com/a/23056261
has text: I tried this but its printing each column on new frame. could you please tell me how to print one complete row on a new frame
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23086667
possible better answer: http://stackoverflow.com/a/23086941
tagged with: playframework-2.2
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35285805
accepted answer: http://stackoverflow.com/a/23089049
tagged with: playframework-2.0
has body: I have an URL which shows me a coupon form based on id: GET /coupon/:couponId All the coupon forms are different and submit different POST params to: POST /saveCoupon/:id I want to have a convenient way of debugging my coupons and be able to have a way of viewing actual POST params submitted. I've made a controller on URL POST /outputPOST/saveCoupon/:id which saves nothing, but prints to browser POST params received. Now I want to have an URL like GET /changeActionUrl/coupon/:couponId which calls GET /coupon/:couponId and then substitutes form's action URL POST /saveCoupon/:id with POST /outputPOST/saveCoupon/:id . In other words I want to do something like: Result.getHtml().replace("/saveCoupon/","/outputPOST/saveCoupon/"); With this I can easily debug my coupons just by adding "/outputPOST" in the browser.
has title: replacing Result's html
tagged with: java
tagged with: playframework
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35285456
has answer: http://stackoverflow.com/a/23086941
has answer: http://stackoverflow.com/a/23089049
type: Question

http://stackoverflow.com/comment/35212713
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23046409
has text: Ok so I removed what you have told me and edited my code. On my previous post one of the users told me to create and addEmployee method similar to the one I created. So now that I have removed it how can I add to the employees and the employee types.
score: 0

http://stackoverflow.com/a/43423836
has body: Stream&lt;Integer&gt; stream = Stream.of(1, 2, 3, 4, 5, 6); Integer[] integers = stream.toArray(it-&gt;new Integer[it]);
downvote count: 2
answers question: http://stackoverflow.com/q/23079003
upvote count: 0
score: -2
type: Answer

http://stackoverflow.com/q/22988653
has comment: http://stackoverflow.com/comment/35108464
answer count: 1
downvote count: 1
has body: I have coded this android app which produces a listView containing songs which are streamed from the internet, and the user can play them by clicking them using the mediaPlayer. What i am having trouble with is allowing the user to add a song to the arrayList that populates the ListView. I have used the settings page to add textboxes so the user can add their songs by inputting, Song Name, Artist and the Direct Link to the song. Though the code i have used for this doesn't work, it should add the Song Name, Artist and Direct Link into the array_list_music ArrayList, then update the ListView, or at least i think that is how it should be done. I have shown my code below. So if someone could help with this problem, that would be great, thanks. MainActivity.java package com.superandroidtutorials.supermusic; import java.util.ArrayList; import android.app.ListActivity; import android.content.Intent; import android.media.MediaPlayer; import android.media.MediaPlayer.OnPreparedListener; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import android.widget.MediaController; import android.widget.Toast; public class MainActivity extends ListActivity implements OnPreparedListener, MediaController.MediaPlayerControl { private static final String TAG = "AudioPlayer"; private ListView list; public MainArrayAdapter adapter; private MediaPlayer mediaPlayer; private MediaController mediaController; private String audioFile; private Handler handler = new Handler(); ArrayList&lt;String&gt; array_list_music = new ArrayList&lt;String&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); list = getListView(); mediaPlayer = new MediaPlay…
has title: Android App - Java: Adding to an arrayList then updating a ListView
has comment: http://stackoverflow.com/comment/35121263
favorite count: 0
has answer: http://stackoverflow.com/a/22988884
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35121242
has comment: http://stackoverflow.com/comment/35107179
score: 0
upvote count: 1

http://stackoverflow.com/comment/35288045
has text: Just a side note: if the purpose of `j` and `k` is just to provide a 1-based version of the loop index, you should instead use `i+1`.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23087082

http://stackoverflow.com/comment/35249127
type: QuestionComment
has text: Considering all the if statements are different, I don't see a way personally, if they were common you could have extended and overridden the JOptionPane method. edit* I also just noticed that if any errors occur with input you restart the process completely, as a user this would annoy me greatly
score: 0
comment on: http://stackoverflow.com/q/23066421
type: Comment

http://stackoverflow.com/comment/35315860
comment on: http://stackoverflow.com/a/23103968
score: 0
type: Comment
has text: Great, the order-and-export was the tab I was missing. The core library will only be used in support of the other libraries, it won't be published on its own.
type: AnswerComment

http://stackoverflow.com/a/23098750
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35307654
score: 1
has body: Agree with user3414693 For using this classes you need to do one of this.(May be some other ways also be there) 1.Keep them in same package and better to make them public 2.Keep all this classis in One File(Not recommended). 3.Use package concept to put all this classes in same directory and than import that package. (Sorry if i am missing something)
answers question: http://stackoverflow.com/q/23098668
has comment: http://stackoverflow.com/comment/35307617
upvote count: 1

http://stackoverflow.com/a/22972012
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22969162
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22969162
has comment: http://stackoverflow.com/comment/35085517
has body: How about @FXML public void playButton() { Task task = new Task&lt;Void&gt;() { @Override public Void call() throws Exception { for (final ImageView image : imageList) { Platform.runLater(new Runnable() { @Override public void run() { previewBoxLabel.setGraphic(image); } }); Thread.sleep((long) (1000 / frameRate)); } return null; } }; new Thread(task).start(); } }
upvote count: 1

http://stackoverflow.com/a/52044755
answers question: http://stackoverflow.com/q/23039871
upvote count: 2
type: Answer
has body: You are assigning a constant to a variable using an octal representation of an type int constant. So the compiler gets the integer value out of the octal representation 010 by converting it to the decimal representation using this algorithm 0*8^0 + 1+8^1 = 10 and then assign j to 10. Remember when you see a constant starting with 0 it's an integer in octal representation. i.e. 0111 is not 1 hundred and 11 but it's 1*8^0 + 1*8^1 + 1*8^2.
score: 2
downvote count: 0

http://stackoverflow.com/comment/35238728
has text: Make tv2 to final and access it's value in onClick() like tv2.getText().toString();
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23060792

http://stackoverflow.com/q/23055752
tagged with: java
has comment: http://stackoverflow.com/comment/35235168
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/22550481
has body: Recently I have developed an eclipse plugin, I exported my plugin by this method "Export">"Deployable plug-ins and fragments", after that I got my .jar plugin , and put it into ~/eclipse/plugins, my plugin has shown successfully in my eclipse. However some of my workmates have no response after they put it into ~/eclipse/plugin, some of them can get it while some can't. Especially the ones who use adt-bundle to install my plugin have no response. I have changed my build jar method to: "Export"> "JAR file", but failed. Is my build jar method wrong or my install method jar wrong?
has comment: http://stackoverflow.com/comment/35233033
has answer: http://stackoverflow.com/a/23242575
accepted answer: http://stackoverflow.com/a/23242575
has comment: http://stackoverflow.com/comment/35232492
has comment: http://stackoverflow.com/comment/35230262
has comment: http://stackoverflow.com/comment/35230625
upvote count: 1
answer count: 1
tagged with: jar
tagged with: eclipse-plugin
favorite count: 0
linked to: http://stackoverflow.com/q/9788404
has title: No response after installing my own eclipse plugin
has comment: http://stackoverflow.com/comment/35231124
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/35087290
type: Comment
comment on: http://stackoverflow.com/a/22977163
score: 0
type: AnswerComment
has text: even though the correct answer button is clicked the games keeps going to Incorrect button clicked, start again:0 + 1 after i changed the code to what u suggested in your answer

http://stackoverflow.com/comment/35142055
has text: OK. But did my Html.fromHtml method help ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23007279
type: Comment

http://stackoverflow.com/a/23102597
downvote count: 0
answers question: http://stackoverflow.com/q/23102429
score: 4
type: Answer
has body: This does not really make sense if you stick to the old File API, since when you .listFiles(), the whole directory entries are swallowed into the array that is returned. That you iterate over it afterwards doesn't make the directory entry loading "lazy". Where is does make sense is if you use the new java.nio.file API (Java 7+) -- and you should use that and drop File --, since Files.newDirectoryStream() does lazy load directory entries. (*) This returns a DirectoryStream which is basically a lazy Iterable over the directory entries, except that it also implements Closeable. And therefore you can interrupt this, like in: try ( final DirectoryStream&lt;Path&gt; entries = Files.newDirectoryStream(...); ) { for (final Path entry: entries) { if (Thread.currentThread().isInterrupted()) break; // proceed with "entry" } } One more reason to use that instead of .listFiles(): if the operation to get a DirectoryStream fails, you don't get null (!!) but an appropriate exception instead: AccessDeniedException, NotDirectoryException, NoSuchFileException, FileSystemLoopException (for filesystems with symlink support), etc etc. Again: ditch File. (*): at least for operating systems which support it (Linux has getdents() for instance) or, more generally, for all FileSystem implementations which support it
upvote count: 4

http://stackoverflow.com/comment/35191249
type: Comment
has text: Exactly. You can add as many `#` characters you want, to get the precision you want. Any 'zero endings' will automatically be removed from the string.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23034484

http://stackoverflow.com/a/23106725
has body: The file located at Environment.getExternalStorageDirectory() + "/MANUAL/workflow/" + bmt does not exist, and throws a FileNotFoundexcption in BitmapTask. Surround with try catch to avoid crash :)
has comment: http://stackoverflow.com/comment/35320075
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23106657

http://stackoverflow.com/a/23105122
upvote count: 2
has body: Not a design pattern, more of a design construct (well, I guess you could argue that the difference is in semantics). A Container would provide an environment (i.e. external code) for your code to run in, and a Context would provide environment settings and additional information for your code.
downvote count: 0
answers question: http://stackoverflow.com/q/23105074
type: Answer
score: 2

http://stackoverflow.com/q/23069493
type: UnansweredQuestion
tagged with: tomcat
has body: I am looking to find a problem to a solution that we are currently facing. The requirement is that I want to develop a REST web-service that takes in user credentials and authenticates to the server and then upload the file to the server and returns a SUCCESS or FAILURE message. So the REST webservice will be a POST but I want to return back the SUCCESS/ERROR message, and I know that is a bad design for a REST webservice. Is there an alternative way that I can approach this problem? Can you let me know if what I thinking in the right way or do I need to take the SOAP route?
answer count: 0
has comment: http://stackoverflow.com/comment/35255680
type: Question
has comment: http://stackoverflow.com/comment/35255509
has title: Rest Webservice Java File Upload with return message
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35255016
tagged with: jersey

http://stackoverflow.com/a/23241593
has body: Task was completed by adding RollingFileAppenders programmatically, just like in this example: http://howtodoinjava.com/2013/04/08/how-to-programmatically-configure-appenders-in-log4j/
accepted answer of: http://stackoverflow.com/q/23055730
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23055730

http://stackoverflow.com/q/23101679
has comment: http://stackoverflow.com/comment/35311798
has answer: http://stackoverflow.com/a/23101973
type: Question
has comment: http://stackoverflow.com/comment/35311850
has comment: http://stackoverflow.com/comment/35311807
tagged with: java
has title: how to convert string abcdefghijklmnop to a 4x4 matrix in java?
has comment: http://stackoverflow.com/comment/35312709
has answer: http://stackoverflow.com/a/23101952
accepted answer: http://stackoverflow.com/a/23101985
upvote count: 2
has comment: http://stackoverflow.com/comment/35312786
possible better answer: http://stackoverflow.com/a/23101753
has comment: http://stackoverflow.com/comment/35312460
favorite count: 0
has answer: http://stackoverflow.com/a/23101985
has comment: http://stackoverflow.com/comment/35312409
has body: I am trying to convert a string to a matrix of 4x4 size. The matrix should contain the elements same as that of the string. For eg. String="1234567890111213141516"; I need to convert this to a 4x4 matrix in java. a[0][0]=1; a[0][1]=2; and so on. Can anyone suggest me the code for the same?
answer count: 4
type: AnsweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35311748
has comment: http://stackoverflow.com/comment/35311831
has answer: http://stackoverflow.com/a/23101753

http://stackoverflow.com/q/22983169
has comment: http://stackoverflow.com/comment/35101256
has answer: http://stackoverflow.com/a/22987888
has comment: http://stackoverflow.com/comment/35104691
type: AnsweredQuestion
tagged with: jsf
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/35104950
has comment: http://stackoverflow.com/comment/35104131
has body: How would I implement a login page using JSF? At the moment I have a registration form which stores the values in a variable in a Java Bean. I now need to create a log in and log out page for this. How would I go about on achieving this ? Here is the code for the bean : public String checkValidUser(String name) { dbData(name); if(name.equalsIgnoreCase(dbUsername)) { if(password.equals(dbPassword)) { return "success.xhtml"; } else { return "fail.xhtml"; } } else { return "fail.xhtml"; } } This is the LogIn Page : &lt;h:outputText value="Forename"/&gt; &lt;h:inputText id="forename" size="25" maxlength="30" required="true" requiredMessage="Please Enter Your Forename" validatorMessage="FR ERR" value="#{databaseLoginReg.name}"&gt; &lt;f:validateLength maximum="30" minimum="1"/&gt; &lt;/h:inputText&gt; &lt;h:message errorClass="error" for="forename"/&gt; &lt;h:outputText value="Enter Password"/&gt; &lt;h:inputSecret id="password" size="25" maxlength="16" required="true" requiredMessage="Please Enter a Password" validatorMessage="ERR" value="#{databaseLoginReg.password}"&gt; &lt;f:validateLength maximum="16" minimum="8"/&gt; &lt;/h:inputSecret&gt; &lt;h:message errorClass="error" for="password" /&gt; &lt;h:commandButton value="Log In" action="{databaseLoginReg.checkValidUser}"/&gt; The error: javax.el.MethodNotFoundException: /logIn.xhtml @47,94 action="#{databaseLoginReg.checkValidUser}": Method not found: databaseLoginReg@77ff927f.checkValidUser()
has comment: http://stackoverflow.com/comment/35103673
has comment: http://stackoverflow.com/comment/35103519
type: Question
has comment: http://stackoverflow.com/comment/35104927
has comment: http://stackoverflow.com/comment/35103633
tagged with: http://stackoverflow.com/tag/xhtml
has comment: http://stackoverflow.com/comment/35103202
score: 0
accepted answer: http://stackoverflow.com/a/22987888
has title: Method not found in JSF view
has comment: http://stackoverflow.com/comment/35105076
has comment: http://stackoverflow.com/comment/35105356
answer count: 1
has comment: http://stackoverflow.com/comment/35102107

http://stackoverflow.com/q/23109768
has answer: http://stackoverflow.com/a/23138009
type: Question
tagged with: java
has body: Wrote a simple code to download a file from file system but still not getting download pop up hence file is not downloading ,not even throwing any error .Please help me out.Following is my code written on controller side. @RequestMapping(value = "download", method=RequestMethod.POST) public @ResponseBody void download(HttpServletRequest request, HttpServletResponse response){ String fileName="/home/test/Testing.xlsx"; PrintWriter out=null; try{ System.out.println(fileName.substring(fileName.lastIndexOf('/')+1)+"fileName"); response.setContentType("application/vnd.ms-excel"); response.setHeader("Cache-Control", "must-revalidate"); response.setHeader( "Pragma", "public" ); response.setHeader("Content-Disposition", "attachment; filename=" + fileName.substring(fileName.lastIndexOf('/')+1) ); out = response.getWriter(); int i; FileInputStream inputStream = new FileInputStream(fileName); while ((i = inputStream.read()) != -1) { out.write(i); } inputStream.close(); out.close(); } catch(Exception e){ System.out.println(e); } }
score: 0
accepted answer: http://stackoverflow.com/a/23138009
answer count: 1
has title: file download pop up is not coming
type: AnsweredQuestion
tagged with: download

http://stackoverflow.com/a/23033370
has comment: http://stackoverflow.com/comment/35211426
answers question: http://stackoverflow.com/q/23032851
has comment: http://stackoverflow.com/comment/35209651
has body: Try with Collections.shuffle() if there is no harm to shuffle the items in original list. Note: Don't use it if there is a large number of items in the list. if(piratewords.size()&gt;0){ Collections.shuffle(piratewords); System.out.println(piratewords.get(0)); }
has comment: http://stackoverflow.com/comment/35211507
score: 0
has comment: http://stackoverflow.com/comment/35211472
type: Answer
has comment: http://stackoverflow.com/comment/35209527
has comment: http://stackoverflow.com/comment/35209996

http://stackoverflow.com/a/23126311
has body: This code will take ten values and sort them in descending order..Hope it will help you..save below code in Test.java and run it import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class Test { public static void main(String[] args) { Integer[] array = new Integer[10]; Scanner scan = new Scanner(System.in); for (int i = 0; i &lt;10; i++) { array[i] = scan.nextInt(); } doSort(array); } static void doSort(Integer[] array) { Arrays.sort(array,Collections.reverseOrder()); for (int i = 0; i &lt; array.length; i++) { System.out.println(array[i]); } } }
score: 0
answers question: http://stackoverflow.com/q/23125945
type: Answer

http://stackoverflow.com/comment/35126592
score: 2
comment on: http://stackoverflow.com/q/22998826
has text: [RoundingMode.DOWN](http://docs.oracle.com/javase/7/docs/api/java/math/RoundingMode.html#DOWN)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35195509
type: AnswerComment
comment on: http://stackoverflow.com/a/23036220
type: Comment
score: 0
has text: Yes. Seems right to me. http://docs.oracle.com/javase/tutorial/java/IandI/usinginterface.html

http://stackoverflow.com/q/22994647
has body: I want to show webpage in Java on Jframe using JeditorPane code I used: edPane.setContentType("text/html"); String data=" \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " "; edPane.setText(data); Ouutput: It is displaying nothing in UI.. I want to display the webpage... Help please
tagged with: swing
has answer: http://stackoverflow.com/a/23241083
linked to: http://stackoverflow.com/q/2438201
score: 0
tagged with: java
has title: Show webpage in java editorPane
type: Question
has comment: http://stackoverflow.com/comment/35560398
has answer: http://stackoverflow.com/a/23117311
has comment: http://stackoverflow.com/comment/35502930
linked to: http://stackoverflow.com/q/5176806
has answer: http://stackoverflow.com/a/67949061
has answer: http://stackoverflow.com/a/23107301
answer count: 6
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/23153361
tagged with: jeditorpane
has answer: http://stackoverflow.com/a/23224994
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/13717769

http://stackoverflow.com/comment/35230179
comment on: http://stackoverflow.com/q/23054136
score: 0
has text: done it now only one error : ClassNotFoundException must be caught class.forName("oracle.jdbc.OracleDriver")
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23039447
has comment: http://stackoverflow.com/comment/35200174
has comment: http://stackoverflow.com/comment/35200166
type: Question
tagged with: context-free-grammar
has answer: http://stackoverflow.com/a/23039470
score: 0
has comment: http://stackoverflow.com/comment/35200467
tagged with: java
answer count: 1
type: UnansweredQuestion
has body: Im trying to read strings such as combinations of Capital and lower case letters such as aSb for context free languages but I don't know how to read each piece of the string separately like read first a then S then b with various amounts of letters so not just 3 it can be any combination of letters.
has title: How to read pieces of a string
has comment: http://stackoverflow.com/comment/35200245
tagged with: string

http://stackoverflow.com/comment/35103969
has text: @CeilingGecko, the Java official doc do not give that information, can you please suggest some link where I can learn them - `anchors literals and modifiers`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22986634
score: 0

http://stackoverflow.com/comment/35223372
has text: Yes, but the idea is to scan the existing portfolio list and create `scoringRule` counts from that (either that or count scoring rules as you build the portfolio list; either way same idea).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23052259

http://stackoverflow.com/comment/35315955
has text: Thanks. I tried ResourcePatternResolver and it seems working but this returns the file path as "E:\path\path\META-INF\module1\definitions\file.xml" but I want to return the path as \META-INF\module1\definitions\file.xml (without the physical location) . Do I need to do any string manipulation to get it or is there any other way?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23102835

http://stackoverflow.com/comment/35247716
type: Comment
comment on: http://stackoverflow.com/a/23065529
type: AnswerComment
score: 0
has text: @patterned You are correct we can substring to extract the date from the String. We can also use regex to make it more robust.

http://stackoverflow.com/q/22982570
has comment: http://stackoverflow.com/comment/35098224
has answer: http://stackoverflow.com/a/22994154
downvote count: 1
has comment: http://stackoverflow.com/comment/35098159
tagged with: defaulttablemodel
has comment: http://stackoverflow.com/comment/35101416
has title: java: dialog with 2 button for event "click on Jtable cell"?
has body: I have a jtable with "data" in my java project: DefaultTableModel model=(DefaultTableModel)jTablePolicyView.getModel(); for(Policy policy : sngltn.GetPerPolicies(cstmr.getPer())) { model.addRow(new Object[] {String.valueOf(policy.getPolicyId()),...,....}); } I want that : for clicking on each cell in my jtable , will spring a dialog(not Form...). will be two buttons (with "my label") on this dialog. i will be able to determine what action will happen(this action should use the contents of the cell) for clicking each button. So what I'm asking? Is it possible? Example code, greatly help me... Thank! i try this code for my first mission(for clicking on each cell in my jtable)... but it's didnt work, why? my code: public class UpdateCstmrForm extends javax.swing.JFrame { ...... public UpdateCstmrForm(long person_id) throws Exception { DefaultTableModel model=(DefaultTableModel)jTablePolicyView.getModel(); ..... initComponents(); ..... for(Policy policy : sngltn.GetPerPolicies(cstmr.getPer())) { model.addRow(new Object[] {......}); } jTablePolicyView.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { JTable target = (JTable)e.getSource(); int row = target.getSelectedRow(); int column = target.getSelectedColumn(); System.out.println(model.getValueAt(row, column)); } } } ..... } }
tagged with: jtable
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22994154
has comment: http://stackoverflow.com/comment/35102561
favorite count: 0
has comment: http://stackoverflow.com/comment/35096619
upvote count: 1
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/35100021
tagged with: dialog
score: 0
tagged with: java

http://stackoverflow.com/comment/35293112
comment on: http://stackoverflow.com/q/23090669
score: 0
type: Comment
type: QuestionComment
has text: @dystroy well, in python I believe the variables are treated as local variables when values are assigned to them, this question is not about javascript (well, the tags aren't) : http://stackoverflow.com/questions/370357/python-variable-scope-question?rq=1

variables
tag name: variables
tags question: http://stackoverflow.com/q/23051789
tags question: http://stackoverflow.com/q/23047309
tags question: http://stackoverflow.com/q/22978122
tags question: http://stackoverflow.com/q/22983481
tags question: http://stackoverflow.com/q/23023177
tags question: http://stackoverflow.com/q/23106203
tags question: http://stackoverflow.com/q/23105270
type: Tag
tags question: http://stackoverflow.com/q/23092684
tags question: http://stackoverflow.com/q/22984871
tags question: http://stackoverflow.com/q/22974522
tags question: http://stackoverflow.com/q/23115179
tags question: http://stackoverflow.com/q/23038215
tags question: http://stackoverflow.com/q/23046138

http://stackoverflow.com/comment/35103204
score: 1
comment on: http://stackoverflow.com/q/22985253
has text: If you have not started implementing the project yet, you could consider to build your application upon the Eclipse RCP framework. Take a look at the following tutorial: http://www.vogella.com/tutorials/EclipseRCP/article.html
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/55121691
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23034024
has text: @user3527319 Have you found a solution?

http://stackoverflow.com/comment/35116834
comment on: http://stackoverflow.com/q/22993501
score: 0
type: Comment
type: QuestionComment
has text: @ajb: I was clean that project and there still variable artifact from previous layout....

http://stackoverflow.com/a/23060849
has body: Just use: tv2 in place of this.
upvote count: 2
answers question: http://stackoverflow.com/q/23060792
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/35216071
score: 0
comment on: http://stackoverflow.com/q/23048276
type: Comment
has text: ever since i added the first while loop it couldnt get it to compile
type: QuestionComment

http://stackoverflow.com/q/23057033
answer count: 1
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35241315
has comment: http://stackoverflow.com/comment/35243309
has comment: http://stackoverflow.com/comment/35529225
has title: Full Dataset Export blank dataset
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35528268
has comment: http://stackoverflow.com/comment/35234393
has comment: http://stackoverflow.com/comment/35234515
has comment: http://stackoverflow.com/comment/35233657
has body: I have a database in libreoffice Base (Debian) which I need to export the tables as an xml file. I have created a piece of Eclipse Java code which is as follows: package NewDB; import java.io.FileOutputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import org.dbunit.database.DatabaseConnection; import org.dbunit.database.IDatabaseConnection; import org.dbunit.database.QueryDataSet; import org.dbunit.dataset.IDataSet; import org.dbunit.dataset.xml.FlatXmlDataSet; import org.dbunit.dataset.DataSetException; public class ExtractTestDataSet { public static void main(String[] args) throws Exception { // database connection Class driverClass = Class.forName("org.hsqldb.jdbcDriver"); Connection jdbcConnection = DriverManager.getConnection "jdbc:hsqldb:/home/debian/Documents/database.odb", "sa", ""); IDatabaseConnection connection = new DatabaseConnection(jdbcConnection); // full database export IDataSet fullDataSet = connection.createDataSet(); FlatXmlDataSet.write(fullDataSet, new FileOutputStream("/home/debian/Documents/fulldataset.xml")); } } After looking at the DBunit pages and other various sites this code should be correct; the database is populated, the connections are valid, there are no warnings or errors in the code, however when the xml file is created the only content is as follows: &lt;?xml version='1.0' encoding='UTF-8'?&gt; &lt;dataset/&gt; Does anyone have any ideas as to why the dataset is not being exported? Thanks
has comment: http://stackoverflow.com/comment/35234097
tagged with: dbunit
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23223520
tagged with: java
tagged with: libreoffice-base
type: Question
has answer: http://stackoverflow.com/a/23223520
has comment: http://stackoverflow.com/comment/35240953
score: 0
has comment: http://stackoverflow.com/comment/35234812

http://stackoverflow.com/comment/35343843
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23118911
has text: @zgc7009 : But, the same file is working on all phones of other brands like Samsung, Sony, LG. I transfer the same file at the same time to a Micromax phone where it doesn't work and to a Non-Micromax phone where it works perfectly.
type: Comment

http://stackoverflow.com/q/23076242
score: 0
has comment: http://stackoverflow.com/comment/35311605
has comment: http://stackoverflow.com/comment/35550984
answer count: 1
tagged with: primefaces
tagged with: java
has comment: http://stackoverflow.com/comment/35319343
has comment: http://stackoverflow.com/comment/35550920
has body: I am using jsf and primefaces. I have a Form in which i have a StudentId input Text and a command Link to View Student Details in a new Pop-Up and a Get Command Button to display I want to Achieve this When i Click on Get Button. if the pop-up window is not Opened before then dont open a Pop-Up. if the pop-up window is already opened, then refresh that window with new arguments. Here is my Code : View page : ...//js code is below .. <h:outputText value="StudentId :" /> <p:inputText value="#{myController.studentId}" > <pe:keyFilter mask="num"/> </p:inputText> <p:commandButton value="Get" actionListener="#{myController.getStudentMarksDetails(myController.studentId)}" > <p:commandLink onclick="openWindow('http://www.google.com','pageName')" > <h:outputText value="Student Info "> </p:commandLink> ...//Displays Student Marks MyController public Student getStudentMarksDetails(Long studentId){ //Some Code to Get the Student Marks // I want to Check whether a Pop-Up already exists or not, if pop-up is opened then refresh with this url RequestContext.getCurrentInstance().execute("updatePopUpWindow('http://stackoverflow.com','pageName');"); } My JS var myWindow; //Opens in the Same window function openWindow(url, name){ myWindow = window.open(url, name,'status=no,toolbar=no,location=no,menubar=no,resizable,width=1008,height=690,scrollbars,left=100,top=50,').focus(); } // To check whether a Pop-Up window is opened or not //if the pop-up window with pageName is not Opened before then dont open a Pop-Up. //if the pop-up window is already opened, then refresh that window with new arguments. function updatePopUpWindow(url, name){ if(myWindow!=null){ if(!myWindow.closed){ myWindow.close(); } } //Check the condition Here myWindow = window.open(url, name,'status=no,toolbar=no,location=no,menubar=no,resizable,width=1008,height=690,scrollbars,left=100,top=50,').focus(); } I tried Placing this Condition but no use: if(myWindow.name == name){ myWindow = window.open(url, name,'status=no,t…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35311696
tagged with: javascript
tagged with: jquery
has comment: http://stackoverflow.com/comment/35512517
has answer: http://stackoverflow.com/a/23127613
type: Question
linked to: http://stackoverflow.com/q/8952385
tagged with: jsf
has title: How to check whether a Browser Window is Opened or not in JSF or Primefaces?

fetch
tags question: http://stackoverflow.com/q/22968462
type: Tag
tag name: fetch

http://stackoverflow.com/comment/35343831
comment on: http://stackoverflow.com/a/23118859
type: AnswerComment
type: Comment
has text: @quartaela Yeah, turns out `SimpleDateFormat` uses that instead of the `getDefault()` method. Setting the `Locale` may set it for all categories. Yeah, I just checked. It does.
score: 0

http://stackoverflow.com/a/23034473
score: 1
accepted answer of: http://stackoverflow.com/q/23031905
upvote count: 1
answers question: http://stackoverflow.com/q/23031905
has body: Well, here is a lovely code I've developed for you. I've added the keyword static to be able to call it from main without creating any objects, but it does not use anything from a static context. As my comments through the code try to explain, this isn't the perfect solution, it's just a start, you may face issues such as multi-threading errors (if you decide to use a separate Thread to update the position) or slight timing issues if the body of the method takes a while to execute. If you feel the nanosecond precision is a bit too much for your purposes, remember there is also Thread.sleep(int milis). Here is the code (try changing the values calling moveLeft(int, int) to see the results): public class Slider { public static void main(String[] args) { Thread thread = new Thread() { @Override public void run() { /* * If you are going to use something like this, beware you are multi-threading * Make sure what you do is thread-safe */ moveLeft(32, 500); } }; thread.start(); } public static void moveLeft(int distance, int milis) { //time_px is how many nanoseconds the Thread can sleep until it has to move 1 dx double time_px = (100000*milis)/distance; if (time_px &gt;= 1) { //Get the milis and nanos, rounding for Thread.sleep long time_round = (long) Math.floor(time_px); long milis_sleep = time_round/100000; System.out.print("Waiting " + milis_sleep + "ms "); int nano_sleep = (int) (time_round%100000); System.out.println(nano_sleep + "ns per dx"); for (int i=0; i&lt;distance; i++) { try { Thread.sleep(milis_sleep, nano_sleep); /* * Your code here * A long code here might not get you the desired result since the sleeping does * not account for the time spent processing the code. But this is a good start */ System.out.println("moving 1 dx"); } catch (InterruptedException e) { e.printStackTrace(); } } } else { System.out.println("Cannot go that fast"); //If you are moving that fast (more than 1 dx per nanosecond) then you need to change this up a little. } } }
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35306278
type: Comment
type: QuestionComment
has text: At a guess you're `infile2` is probably something like a `BufferedReader` when it should be a `Scanner`
score: 0
comment on: http://stackoverflow.com/q/23097980

http://stackoverflow.com/a/23070251
has comment: http://stackoverflow.com/comment/35256274
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/23070200
answers question: http://stackoverflow.com/q/23070200
type: Answer
upvote count: 4
has body: The substring function in Java excludes the second index. So you want hours = Integer.parseInt(militaryTime.substring(0, 2)); minutes = Integer.parseInt(militaryTime.substring(3, 5)); Quoting from the API document: The substring begins at the specified beginIndex and extends to the character at index endIndex - 1.
downvote count: 0

http://stackoverflow.com/a/23011299
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23010783
has body: Are you sure the below is correct? b2=(Button)findViewById(R.id.button1); R.id.button1 or something else?

http://stackoverflow.com/q/23065464
has answer: http://stackoverflow.com/a/23065619
accepted answer: http://stackoverflow.com/a/23065619
tagged with: lucene
type: AnsweredQuestion
has title: How to make Lucene search faster?
type: Question
tagged with: indexing
tagged with: performance
has body: all. I have 12 large indexes, and each is bigger than 20GB. My application is trying to make instance of IndexSearcher to search for every request of a user. because the user can select an index which he wants to search. but the performance of my application is very very very bad. the user should be wait for about 5 minutes for one search. my application shows 50 documents per page. and of course I repeat only 50 times to retrieve the data to show using by 'for statement'. For performance test, I've tried to search using by MatchAllDocsQuery, and it takes about 10 seconds, to find 7,598,870 documents. I can't know why my application is too slow. after many times googling... I've just read a document that says making instance of IndexSearcher is costly. If I merge all my indexes, it will be 317GB after merge, and then using only one IndexSearcher instance to search w/ filter, it will be faster than before? please help me. I can't test freely because my application is on customer's intranet. sorry for my english.
score: 0
tagged with: java
answer count: 1

spring-ioc
tag name: spring-ioc
tags question: http://stackoverflow.com/q/23090350
type: Tag

http://stackoverflow.com/q/23028037
linked to: http://stackoverflow.com/q/10168686
accepted answer: http://stackoverflow.com/a/23202402
type: Question
has title: Detecting an object (words) in an image
answer count: 2
possible better answer: http://stackoverflow.com/a/23283150
tagged with: matlab
tagged with: c++
has body: I want to implement object detection in license plate (the city name) . I have an image: and I want to detect if the image contains the word "بابل": I have tried using a template matching method using OpenCV and also using MATLAB but the result is poor when tested with other images. I have also read this page, but I was not able to get a good understanding of what to do from that. Can anyone help me or give me a step by step way to solve that? I have a project to recognize the license plate and we can recognize and detect the numbers but I need to detect and recognize the words (it is the same words with more cars )
has answer: http://stackoverflow.com/a/23283150
linked to: http://stackoverflow.com/q/15183590
tagged with: java
has comment: http://stackoverflow.com/comment/35181101
downvote count: 3
has comment: http://stackoverflow.com/comment/35484330
tagged with: image-processing
has comment: http://stackoverflow.com/comment/35636056
upvote count: 24
has comment: http://stackoverflow.com/comment/35633293
tagged with: opencv
has answer: http://stackoverflow.com/a/23202402
has comment: http://stackoverflow.com/comment/35180925
type: AnsweredQuestion
score: 21
has comment: http://stackoverflow.com/comment/35180016
favorite count: 0

http://stackoverflow.com/a/23049837
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35264970
has body: I would do it this way with a custom comparator for the ArrayList: Collections.sort(amostra1, new Comparator&lt;double[]&gt;() { @Override public int compare(double[] o1, double[] o2) { int index = 1; // second element of the array return Double.compare(o1[index], o2[index]); } }); To sort according to the first element of the array just set index to 0 and you get the array sorted according to the first element. Note that Collections.sort(...) takes a List and a Comparator
has comment: http://stackoverflow.com/comment/35260255
answers question: http://stackoverflow.com/q/23049603

http://stackoverflow.com/comment/35122689
type: Comment
comment on: http://stackoverflow.com/q/22996284
has text: To connect to postgreSQL on RDS you would just use the normal postgreSQL java driver. The SDK provides methods to control RDS instances.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/44698509
type: AnswerComment
has text: I find it odd that the above logic was supposedly applied to Iterable (I can't have stream() because someone might want it to return IntStream) whereas an equal amount of thought wasn't given to adding the exact same method to Collection (I might want my Collection<Integer>'s stream() to return IntStream also.) Whether it were present on both or absent on both, people would probably have just gotten on with their lives, but because it's present on one and absent on the other, it becomes quite a glaring omission...
type: Comment
score: 157
comment on: http://stackoverflow.com/a/23177907

http://stackoverflow.com/q/23067972
type: UnansweredQuestion
tagged with: runtimeexception
tagged with: jpa
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/23068247
has answer: http://stackoverflow.com/a/25242901
favorite count: 0
type: Question
has title: RunTimeException What's the cause?
answer count: 2
has body: I try to build this jpa project but running into the same error. I updated, changed everything still nothing. What am I missing? I only use EclipseLink (JPA 2.0) in the libaries. NetBeans IDE 7.2. An annotation processor threw an uncaught exception. Consult the following stack trace for details. java.lang.RuntimeException: Exception [EclipseLink-25008] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.XMLMarshalException Exception Description: A descriptor with default root element {http://xmlns.jcp.org/xml/ns/persistence}persistence was not found in the project at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:407) . . . at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:541) at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153) Caused by: Exception [EclipseLink-25008] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.XMLMarshalException Exception Description: A descriptor with default root element {http://xmlns.jcp.org/xml/ns/persistence}persistence was not found in the project at org.eclipse.persistence.exceptions.XMLMarshalException.noDescriptorWithMatchingRootElement(XMLMarshalException.java:129) . . . at org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.<init>(PersistenceUnitReader.java:71) at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:376) ... 49 more C:\Users\drhorvath57\Desktop\nyomt\PizzaJPA\PizzaJPA\nbproject\build-impl.xml:926: The following error occurred while executing this line: C:\Users\drhorvath57\Desktop\nyomt\PizzaJPA\PizzaJPA\nbproject\build-impl.xml:268: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 1 second) persistence.xml: <?xml version="1.0" encoding="UTF-8"?> org.eclipse.persistence.jpa.PersistenceProvider logic.entity.Pizza log…
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
tagged with: hibernate
upvote count: 1

ifc
tags question: http://stackoverflow.com/q/23126700
type: Tag
tag name: ifc

http://stackoverflow.com/comment/35287003
comment on: http://stackoverflow.com/q/23087595
score: 0
type: Comment
type: QuestionComment
has text: You could try an [Introspector](http://docs.oracle.com/javase/7/docs/api/java/beans/Introspector.html) - although it is designed specifically with JavaBeans in mind. In any case, this question is asking to recommend an library and is therefore off topic here.

http://stackoverflow.com/comment/35153986
type: QuestionComment
comment on: http://stackoverflow.com/q/23014133
score: 0
type: Comment
has text: What is the issue? It doesn't compile or the dialog doesn't appear? Your method `showDialogSintesi` is supposed to take a string but you never pass anything to it in the `OnClickListener` registered to your `info` object

http://stackoverflow.com/q/23020099
has comment: http://stackoverflow.com/comment/35165852
has comment: http://stackoverflow.com/comment/35165953
type: Question
has comment: http://stackoverflow.com/comment/35166893
has comment: http://stackoverflow.com/comment/35165751
has comment: http://stackoverflow.com/comment/35165234
has comment: http://stackoverflow.com/comment/35165123
has comment: http://stackoverflow.com/comment/35165255
has comment: http://stackoverflow.com/comment/35165921
has comment: http://stackoverflow.com/comment/35165905
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35165856
has comment: http://stackoverflow.com/comment/35166017
has comment: http://stackoverflow.com/comment/35166107
answer count: 1
has comment: http://stackoverflow.com/comment/35165857
has comment: http://stackoverflow.com/comment/35166317
has comment: http://stackoverflow.com/comment/35166570
type: UnansweredQuestion
has body: For a project I am doing I am required to structure my code this way. However, the return statement on the calcMonthlyStatement returns a NaN(not a number) value. I'm assuming this is because I am dividing 0 by 0 in my monthlyPayment equation. I'm not sure how to get the variables and their values from my public void methods into my private one. import java.text.*; import java.util.*; import java.lang.Math.*; public class Mortgage{ private Scanner s = new Scanner(System.in); private double principal; private double monthlyInt; private double numOfMonths; private double monthlyPayment; private double totalPayment; Random rand = new Random(); private int rng = rand.nextInt(9900) + 100; public void storeLoanAmount(double loanAmt){ principal = loanAmt; } public void storeTerm(double term){ numOfMonths = term; } public void storeInterestRate(double intRte){ monthlyInt = intRte; } private double calcMonthlyPayment(){ monthlyPayment = principal*((monthlyInt*(Math.pow((1+monthlyInt),numOfMonths)))/((Math.pow(1+monthlyInt,numOfMonths))-1)); return monthlyPayment; } public String toString(){ Mortgage call = new Mortgage(); double mPayment = call.calcMonthlyPayment(); String stats = ("Account number: " + rng +"\nThe monthly payment is $" + mPayment); return stats; } //my main class from a seperate .java file public class MortgageEF{ public static void main(String[] args){ Mortgage mort = new Mortgage(); double principle = 100000; double numOfMonths = (15*12); double monthlyInt = ((5.5)/12); mort.storeLoanAmount(principle); mort.storeTerm(numOfMonths); mort.storeInterestRate(monthlyInt); System.out.print(mort.toString()); } }
has comment: http://stackoverflow.com/comment/35167218
has comment: http://stackoverflow.com/comment/35166133
has comment: http://stackoverflow.com/comment/35165691
has comment: http://stackoverflow.com/comment/35165396
has title: Getting public void method variables into a private method?
has answer: http://stackoverflow.com/a/23022966

groovy
tags question: http://stackoverflow.com/q/23088401
tags question: http://stackoverflow.com/q/23054587
type: Tag
tags question: http://stackoverflow.com/q/23038696
tags question: http://stackoverflow.com/q/22998260
tags question: http://stackoverflow.com/q/22995541
tags question: http://stackoverflow.com/q/23005513
tags question: http://stackoverflow.com/q/23062707
tags question: http://stackoverflow.com/q/22981104
tags question: http://stackoverflow.com/q/23055158
tags question: http://stackoverflow.com/q/22968995
tags question: http://stackoverflow.com/q/23097405
tags question: http://stackoverflow.com/q/23001609
tag name: groovy

http://stackoverflow.com/a/23078728
type: Answer
has body: While I have no knowledge of the Spring Framework, the way to figure out a per request Locale object without session information is usually by looking at the Accept-Language HTTP header. Which isn't a very good choice because it misleads people to think they'll acquire the user's whereabouts. As the link above states, you probably want to give the user a way to override your first guess by storing a preference option, looking at the request IP (using a geocoding database like in this question) or something else. Where "storing a preference option" is the only thing that requires the notion of a "returning user". Most common choices are storing the Locale object in the user's session. You can read about the (spring specific) list of options in the manual. To answer the question: the static method Locale.getDefault() will report the JVM "fallback" locale, which is usually derived from the system the JVM is running on (or as @a_horse_with_no_name points out, can be overriden with -Duser.locale).
score: 0
answers question: http://stackoverflow.com/q/23077982

http://stackoverflow.com/q/23052884
has body: Based on a bunch of replies here: Capturing Part of String and Using Java to find substring of a bigger string using Regular Expression I'm trying to get multiple parts of a string as substrings: import java.io.File; import java.util.regex.*; String subject = "Re: New Mail File Alert: MAIL_20140320_0000000002.dat XYZ"; Pattern p = Pattern.compile("^(Re|Fwd?)(.*)(New Mail File Alert: )(MAIL_)((20)\\d\\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])[_](\\d{10})(\\.)(dat|ctl)(\\s)(XYZ|ABC)$"); Matcher m = p.matcher(subject); if (m.find()){ String file = subject.replaceAll("(MAIL_)((20)\\d\\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])[_](\\d{10})", "$1"); String path = subject.replaceAll("(XYZ|ABC)$", "$1"); } The bits I want are: "MAIL_20140320_0000000002" and "XYZ" however the strings I'm getting back are: file: Re: New Mail File Alert: MAIL_.dat XYZ path: Re: New Mail File Alert: MAIL_20140320_0000000002.dat XYZ Can anyone see what I'm doing wrong here?
has title: Java Regex: getting multiple parts of a string as substrings
possible better answer: http://stackoverflow.com/a/23052928
score: 0
has answer: http://stackoverflow.com/a/23052928
answer count: 3
tagged with: string
linked to: http://stackoverflow.com/q/12944973
has answer: http://stackoverflow.com/a/23052983
tagged with: regex
has answer: http://stackoverflow.com/a/23053014
accepted answer: http://stackoverflow.com/a/23053014
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35224331
tagged with: java
linked to: http://stackoverflow.com/q/600733
type: Question

http://stackoverflow.com/comment/40915730
type: QuestionComment
has text: Related: Also, avoid passing the SparkContext into a RDD map/filter/flatMap etc transformation which can give a similar error
comment on: http://stackoverflow.com/q/23050067
score: 0
type: Comment

http://stackoverflow.com/q/23000676
upvote count: 2
has comment: http://stackoverflow.com/comment/35129983
type: UnansweredQuestion
tagged with: quotes
has comment: http://stackoverflow.com/comment/35129804
tagged with: supercsv
has title: CSV parser in JAVA, double quotes in string (SuperCSV, OpenCSV)
tagged with: java
has answer: http://stackoverflow.com/a/23004754
type: Question
has answer: http://stackoverflow.com/a/23001126
has answer: http://stackoverflow.com/a/23001275
has comment: http://stackoverflow.com/comment/35129870
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35129747
answer count: 3
tagged with: http://stackoverflow.com/tag/csv
has body: all day I've been searching how to resolve this probem and nothing... I want to write function, which convert CSV file to collection of lists (of strings). Here is this function: public Collection&lt;? extends List&lt;String&gt;&gt; parse() throws IOException { Collection&lt;List&lt;String&gt;&gt; collectionOfLists = new ArrayList&lt;List&lt;String&gt;&gt;(); CsvListReader parser = new CsvListReader(Files.newBufferedReader(pathToFile, StandardCharsets.UTF_8), CsvPreference.EXCEL_PREFERENCE); List&lt;String&gt; row; while( (row = parser.read()) != null) collectionOfLists.add(row); return collectionOfLists; } public static String toString(Collection&lt;? extends List&lt;String&gt;&gt; csv) { StringBuilder builder = new StringBuilder(); for(List&lt;String&gt; l : csv) { for(String s : l) builder.append(s).append(','); if(builder.length() &gt; 0) builder.setCharAt(builder.length()-1,'\n'); } return builder.toString(); } But e.g. for that input: id, name, city, age 1,"Bob",London,12 Output for toString(parse()) is: id, name, city, age 1,Bob,London,12 instead of the same like input:/ What can I do, that strings contain \" (quotes) ? Please help me.
has comment: http://stackoverflow.com/comment/35129830
tagged with: parsing
score: 2

http://stackoverflow.com/comment/35348410
type: Comment
score: 1
has text: Please explain what you mean by "line". If there's some special byte used as a separator (like `\n`), you'll probably have to do the hard work yourself (i.e. searching for the byte, extracting the desired part of the array with `Arrays.copy`, putting subarrays together if they're in different buffers), unless there's some helpful methods I don't know about.
comment on: http://stackoverflow.com/q/23121982
type: QuestionComment

http://stackoverflow.com/comment/35220684
type: QuestionComment
has text: The .jar will be used by a program written by the owner of the proprietary classes, meaning it probably has access to those libraries. However unfortunately I was unable to find them in the program's folders, I assume they are somewhere packed up in the program's files and then get unpacked at runtime to run the .jar file.
comment on: http://stackoverflow.com/q/23050803
type: Comment
score: 0

http://stackoverflow.com/a/23379102
upvote count: 0
answers question: http://stackoverflow.com/q/23097405
has body: You have to setup the jboss logger in gradle: test { systemProperty 'java.util.logging.manager', 'org.jboss.logmanager.LogManager' }
score: -1
downvote count: 1
type: Answer

http://stackoverflow.com/a/23063777
has comment: http://stackoverflow.com/comment/35244249
accepted answer of: http://stackoverflow.com/q/23063750
score: 10
has comment: http://stackoverflow.com/comment/35244471
has comment: http://stackoverflow.com/comment/35244522
answers question: http://stackoverflow.com/q/23063750
has comment: http://stackoverflow.com/comment/35244326
has comment: http://stackoverflow.com/comment/35244271
has comment: http://stackoverflow.com/comment/35244327
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35244450
has body: Use a switch statement or a HashMap. Switch statement: Readable, but compiles similarly (if not identically) to an if-else chain. switch([USER_INPUT]) { case 1: System.out.println("TEST"); break; case 2: System.out.println("HELLO"); break; // And so on. } Hash Map: Much more readable and simpler. This is preferred. // Initialization. Map&lt;Integer,String&gt; map = new HashMap&lt;Integer,String&gt;(); map.put(1,"TEST"); map.put(2,"HELLO"); // Printing. String s = map.get(USER_INPUT); if (s == null) System.out.println("Key doesn't exist."); System.out.println(s);
upvote count: 10
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35244396

http://stackoverflow.com/q/23091812
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/35294980
has comment: http://stackoverflow.com/comment/35295285
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35295103
upvote count: 1
has comment: http://stackoverflow.com/comment/35294991
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23091856
has comment: http://stackoverflow.com/comment/35295009
has comment: http://stackoverflow.com/comment/35295075
answer count: 2
has comment: http://stackoverflow.com/comment/35295043
accepted answer: http://stackoverflow.com/a/23091856
has comment: http://stackoverflow.com/comment/35295126
possible better answer: http://stackoverflow.com/a/23091848
has comment: http://stackoverflow.com/comment/35295049
has answer: http://stackoverflow.com/a/23091848
favorite count: 0
has comment: http://stackoverflow.com/comment/35295352
has comment: http://stackoverflow.com/comment/35297107
has title: JAVA - won't compile
has body: My driver class won't compile. It keeps saying that I'm giving the wrong types. I have declared the variables in the Phone class and then created information about the phone in the driver and want to store it in the array. Phone class public class Phone extends Technology { private String name; private String type; private String colour; private int inStock=10; private int sold; //Constructor public Phone (String itemsId, String brand, double price, String name, String type, String colour ) { super(itemsId, brand, price ); this.name = name; this.type = type; this.colour = colour; } } This is the part of the driver class that wont compile, I cant figure out what im doing wrong. I have created information about the phone in the same order that they are in the phone class. // Creating 10 phones and storing in arrayList public void pickPhone(){ Phone phone = new Phone("A223","Apple", "€679.00 ", "iPhone 5s", "Smartphone ", " Black"); phoneList.add(phone); phone = new Phone("A252","Apple", " €649.00 ", " iPhone 5s", "Smartphone ", " White"); phoneList.add(phone); phone = new Phone("A264","Apple", " €329.00 ", " iPhone 4s", "Smartphone ", " Black"); phoneList.add(phone); phone = new Phone("S586","Sony", " €570.00 ", " Xperia Z1", "Smartphone ", " Black"); phoneList.add(phone); phone = new Phone("S549","Sony", " €260.00 ", " Xperia SP", "Smartphone ", " Black"); phoneList.add(phone); phone = new Phone("G359","Samsung", " €530.00 ", "Galaxy S4", "Smartphone ", " Black"); phoneList.add(phone); phone = new Phone("G375","Samsung", " €530.00 ", "Galaxy S4", "Smartphone ", "White"); phoneList.add(phone); phone = new Phone("G352","Samsung", " €350.00 ", "Galaxy S4 Mini", "Smartphone ", "White"); phoneList.add(phone); phone = new Phone("H488"," HTC ", " €529.00 ", "One", "Smartphone ", "Black"); phoneList.add(phone); phone = new Phone("H463"," HTC ", " €419.00 ", "One Mini ", "Smartphone ", "Silver"); phoneList.add(phone); }
has comment: http://stackoverflow.com/comment/35294958
has comment: http://stackoverflow.com/comment/35295178
has comment: http://stackoverflow.com/comment/35297325
has comment: http://stackoverflow.com/comment/35294985
type: AnsweredQuestion

http://stackoverflow.com/q/23021546
has answer: http://stackoverflow.com/a/23239687
tagged with: objectaid
type: AnsweredQuestion
score: 1
has body: So I just got ObjectAid for eclipse. I created my first UML by placing the classes in the file and arranging them as neatly as I could. I have a few questions regarding its capabilities: 1: Is it able to completely autogenerate a UML for a given a Project? (No user placement) 2: Am I able to include the java libraries that I imported as referenced dependencies? (I am using Swing and would like to notate which classes use which swing classes, etc) 3: Can I change the symbols that the UML generator uses for things such as making public globals '+' and private '-' instead of the nice symbols 4: Are these symbols considered standard? Thank you!
tagged with: java
tagged with: uml
upvote count: 1
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/23239687
has title: Using ObjectAid in eclipse
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23097037
score: 0
has body: I am working through Apache Cordova Amazon-fireos guide But I am getting an Ant path error when performing "cordova platform add amazon-fireos" command. Looking at the code it looks like it is doing a pre-req check and trying to execute ant -version but failing. I then tried skipping that pre-req only for it to then error out when it tries to execute java -version. But after the cordova command errors out I can type ant -version and java -version and both commands execute successfully, see screenshot below. I am running Windows 7 Pro 64bit and my path variables looks like this: JAVA_HOME = C:\Program Files\Java\jdk1.7.0_51 ANT_HOME = c:\apache-ant-1.9.3 PATH=C:\Program Files\nodejs;%ANDROID_HOME%;%ANDROID_TOOLS%; C:\Users\Super\AppData\Roaming\npm;%JAVA_HOME%\bin;%ANT_HOME%\bin Here is the screenshot from running the command with the -d option.
answer count: 1
has comment: http://stackoverflow.com/comment/35376504
tagged with: android
has answer: http://stackoverflow.com/a/23156064
tagged with: node.js
type: AnsweredQuestion
tagged with: cordova
has comment: http://stackoverflow.com/comment/35391971
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23156064
tagged with: ant
has comment: http://stackoverflow.com/comment/35348099
has title: Ant Path error when performing Apache Cordova Helloworld example for amazon-fireos

jparsec
tags question: http://stackoverflow.com/q/23085960
tag name: jparsec
type: Tag

http://stackoverflow.com/comment/35127237
type: Comment
type: QuestionComment
has text: [Try to ask Short, Self Contained, Correct (Compilable) questions](http://www.sscce.org/) for quick help.
comment on: http://stackoverflow.com/q/22999317
score: 1

http://stackoverflow.com/a/23001654
type: Answer
has comment: http://stackoverflow.com/comment/35140321
has body: It looks like UserAccount isn'tSerializable. So when you serialize the derived TestingUser class, none of the UserAccount data gets serialized. See Object Serialization Specification #2.1.13(a). TestingUser doesn't have any instance state of its own to serialize. The solution is to make UserAccount implement Serializable. Not sure why this comes as a surprise.
accepted answer of: http://stackoverflow.com/q/22992032
score: 1
answers question: http://stackoverflow.com/q/22992032
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22970839
type: Answer
upvote count: 1
has body: The problem is that you're iterating over a List&lt;EventListener&lt;? extends Event&gt;&gt;, but the compiler doesn't know which class, Event or a subclass of Event, the ? wildcard could be. The T type parameter could also be Event or any subclass of Event. They do not match for this reason. Try removing the wildcards: // Removed wildcard private HashMap&lt;String, List&lt;EventListener&lt;Event&gt;&gt;&gt; events = new HashMap&lt;&gt;(); public synchronized &lt;T extends Event&gt; void fireEvent(T event){ String key = event.getClass().getName(); if(events.containsKey(key)){ // Removed wildcard. Iterator&lt;EventListener&lt;Event&gt;&gt; i = events.get(key).iterator(); while(i.hasNext()){ i.next().receiveEvent(event); // This compiles now. } } }
has comment: http://stackoverflow.com/comment/35076259
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22970696
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22970696
has comment: http://stackoverflow.com/comment/35076511
score: 1
has comment: http://stackoverflow.com/comment/35076359

http://stackoverflow.com/q/22984465
type: UnansweredQuestion
tagged with: opencv
has title: OpenCv - Implementing split and merge for DCT
tagged with: java
tagged with: image-processing
has body: I am trying to implement a DCT code in Android. I'm using the split and merge method to obtain the original colors of the image. Here is the snippet of the code image = Highgui.imread(imageName); secondImage = new Mat(image.rows(), image.cols(), CvType.CV_32FC3); image.convertTo(secondImage, CvType.CV_32FC3); int m = Core.getOptimalDFTSize(image.rows()); int n = Core.getOptimalDFTSize(image.cols()); // on the border add zero values Mat padded = new Mat(new Size(n, m), CvType.CV_32FC3); // expand input image to optimal size Imgproc.copyMakeBorder(secondImage, padded, 0, m - secondImage.rows(), 0, n - secondImage.cols(), Imgproc.BORDER_CONSTANT); List&lt;Mat&gt; planes = new ArrayList&lt;Mat&gt;(); Core.split(padded, planes); List&lt;Mat&gt; outplanes = new ArrayList&lt;Mat&gt;(planes.size()); for (int k = 0; k &lt; planes.size(); k++) { outplanes.add(new Mat(padded.size(), CvType.CV_32FC1)); } Mat trans = new Mat(padded.size(), padded.type()); for (int k = 0; k &lt; planes.size(); k++) { Core.dct(planes.get(k), outplanes.get(k)); } List&lt;Mat&gt; ioutplanes = new ArrayList&lt;Mat&gt;(outplanes.size()); for (int k = 0; k &lt; planes.size(); k++) { ioutplanes.add(new Mat(padded.size(), CvType.CV_32FC1)); } for (int k = 0; k &lt; planes.size(); k++) { Core.idct(outplanes.get(k), ioutplanes.get(k)); } Core.merge(ioutplanes, trans); This time got this exception : The function/feature is not implemented (Odd-size DCT's are not implemented) in void cv::dct(cv::InputArray, cv::OutputArray, int), file /home/reports/ci/slave_desktop/50-SDK/opencv/modules/core/src/dxt.cpp, line 2330 Is this code correct? Your help is very much appreciated. Updated: I noticed that the copyMakeBorder() is the one that caused my image size to be odd, that is why I am having this exception.
type: Question
has answer: http://stackoverflow.com/a/22990335
has answer: http://stackoverflow.com/a/22986572
score: 0
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/23902590

http://stackoverflow.com/a/22971747
type: Answer
has comment: http://stackoverflow.com/comment/35078774
upvote count: 6
answers question: http://stackoverflow.com/q/22971705
has comment: http://stackoverflow.com/comment/35077722
has comment: http://stackoverflow.com/comment/35078532
has comment: http://stackoverflow.com/comment/35077783
has comment: http://stackoverflow.com/comment/35079923
has comment: http://stackoverflow.com/comment/35078897
has body: Yes, use Stream#findFirst() method: List&lt;String&gt; list = Arrays.asList("a", "ab", "bc", "abc"); String firstMatch = list.stream().filter(s -&gt; s.length() == 2).findFirst().get();
downvote count: 0
has comment: http://stackoverflow.com/comment/35078211
score: 6

http://stackoverflow.com/comment/35257707
score: 0
has text: My requirement here is to count instances of each class A and B seperately
type: AnswerComment
comment on: http://stackoverflow.com/a/23071028
type: Comment

http://stackoverflow.com/q/23002703
tagged with: adjacency-matrix
type: Question
tagged with: java
tagged with: graph
has comment: http://stackoverflow.com/comment/35134796
has body: Say I have an adjacency matrix boolean[][] adjMatrix = [n][n] and I want a function that returns a boolean[] of all the connected components of a given vertex. public static boolean[] connected(boolean[][] aMatrix, int vertexCount, int givenVertex){ boolean[] connections = [vertexCount] connections[givenVertex] = true; for(int i = 0; i &lt; vertexCount, i++){ If(...) connections[i] = true; ... } return connections; } For example on this graph connected(adjMatrix, 6, 0) //returns [true, true, false, false, true, true, false] I've been working on this for a while, and I think I need to use Breadth First Search or Depth First Search, but I am still kind of confused on using them.
score: 0
has title: How to create boolean[] of all connected components of a given vertex?
has comment: http://stackoverflow.com/comment/35135186
has comment: http://stackoverflow.com/comment/35135254
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23013711
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/49555952
tagged with: properties
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/23168882
type: Question
score: 12
answer count: 2
upvote count: 12
has title: Where should I validate JavaFX Property changes?
downvote count: 0
tagged with: binding
tagged with: validation
favorite count: 0
has body: I have a mvp structured javafx application. There is a view with a textfield, which has its own textProperty of type StringProperty. There is also a model which contains an Object called Item. Item has an IntegerProperty. Now I'd like to bind these two Properties within my presenter-class, so that they get updated, when one or another changes. Eventhough they have different types, there is the possibility to bind them the following way: Bindings.bindBidirectional( textField.textProperty(), item.percentProperty(), new NumberStringConverter() ); This works perfectly fine, unless the value of the textfield gets cleared, which results in a NullPointerException, because an empty value of textProperty results in a Null-Value and setting a null Value in IntegerProperty results in a NullPointerException. Can you think of any way to avoid this? Do I have to write my own NumberStringConverter? Moreover I'd like to define, that Item can only hold a percent value between 0 and 100. The View should be informed, when the value is invalid, so the user can get feedback. Where should I verify these kind of businessrules? I came up with a first example, but I am not sure, if that should be the way to go, so I'd be curious, if you might have better ideas how to solve this. class PercentProperty extends SimpleIntegerProperty { private InvalidValueListener invalidValueListener = null; public PercentProperty ( final Integer defaultValue ) { set( defaultValue ); } @Override public void set( final int newValue ) { if ( isValid( newValue ) ) { super.set( newValue ); if ( invalidValueListener != null ) invalidValueListener.validValue(); } else { if ( invalidValueListener != null ) invalidValueListener.invalidValue(); } } private boolean isValid( final int value ) { return (value &gt;= 0 &amp;&amp; value &lt;= 100);//FIXME: Better use Predicates to define Rules. } public void setListener( final InvalidValueListener listener ) { invalidValueListener = listener; } public void removeListener( @S…
has answer: http://stackoverflow.com/a/23241059

http://stackoverflow.com/q/23071246
has comment: http://stackoverflow.com/comment/35258079
has comment: http://stackoverflow.com/comment/35258389
has comment: http://stackoverflow.com/comment/35261300
has title: How to split of a string with regex
tagged with: regex
accepted answer: http://stackoverflow.com/a/23072978
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35260732
tagged with: java
has comment: http://stackoverflow.com/comment/35259194
type: Question
has answer: http://stackoverflow.com/a/23072978
answer count: 2
has comment: http://stackoverflow.com/comment/35258165
possible better answer: http://stackoverflow.com/a/23075242
score: 0
has answer: http://stackoverflow.com/a/23075242
linked to: http://stackoverflow.com/q/22937618
has comment: http://stackoverflow.com/comment/35260752
has body: public String replace(){ String[] parts = str.split("&amp;([A-Za-z]+|[0-9]+|x[A-Fa-f0-9]+);"); for (int i = 0; i &lt; parts.length; i++) { System.out.println(parts[i]); } return ""; } what makes this line exactly "String[] parts = str.split("&amp;([A-Za-z]+|[0-9]+|x[A-Fa-f0-9]+);");"? i tried in my code but it didnt do anything..could someone give a string example so i can see how it splits ?

http://stackoverflow.com/a/35572535
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23083868
type: Answer
downvote count: 0
has body: channelReadComplete is NOT called after each channelRead. The netty event loop will read from NIO socket and fire multiple channelRead until no more data to read or it should give up, then channelReadComplete is fired.

http://stackoverflow.com/comment/35231499
comment on: http://stackoverflow.com/q/23056662
type: Comment
type: QuestionComment
has text: Thanks a lot for all your quick answers!
score: 0

http://stackoverflow.com/q/23095269
tagged with: if-statement
tagged with: java
linked to: http://stackoverflow.com/q/23072388
has comment: http://stackoverflow.com/comment/35301966
type: Question
tagged with: search
tagged with: for-loop
answer count: 1
tagged with: class
score: 0
has body: The program is to find all of the words in a text file and count how many times each word is found. Our definition of a "word" will be relatively crude and will be done by splitting the line based on characters that are not alphabetic. I know there are easier ways to go about this but we were required to use a class and a search method like the one I attempted. I can't figure out why it's not incrementing word's that are already in wordList. I believe it's either completely skipping over my if (foundAt &gt;=0, or it's not incrementing it correctly, I'm leaning toward my search method being wrong, but I can't figure out the problem. Any and all help is much appreciated, thanks for your time. public class Hmwk { public static void main(String[] args) throws FileNotFoundException { int n=0; WordCount[] wordList= new WordCount[10000]; Scanner words = new Scanner(new File("input.txt")); while (words.hasNextLine() &amp;&amp; n &lt; 10000) { String line = words.nextLine(); String[] tokens = line.split("[^\\p{Alpha}]"); for (int i=0;i&lt;tokens.length;i++) { if (tokens[i].length()&gt;0) { WordCount word = new WordCount(tokens[i]); int foundAt = search(wordList, word, n); if (foundAt &gt;= 0) { wordList[foundAt].increment(); } else { wordList[n]=word; n++; } } } } //Arrays.sort(wordList); String alphabeticFileName = "alphabetic.txt"; String frequencyFilename = "frequency.txt"; PrintWriter output = new PrintWriter(alphabeticFileName); for (int i=0; i&lt;n;i++) { output.println(wordList[i].toString()); } output.close(); //Sort on frequency somehow PrintWriter output2 = new PrintWriter(frequencyFilename); for (int i=0; i &lt; n; i++) { output2.println(wordList[i].toString()); } output2.close(); } public static int search(WordCount[] list,WordCount word, int n) { int result = -1; int i=0; while (result &lt; 0 &amp;&amp; i &lt; n) { if (word.equals(list[i])) { result = i; } i++; } return result; } } class WordCount { String word; int count; static boolean compareByWord; public Wo…
type: UnansweredQuestion
has title: Searching through Objects Issue
has comment: http://stackoverflow.com/comment/35301534
has answer: http://stackoverflow.com/a/23108973

http://stackoverflow.com/comment/35252900
type: Comment
score: 0
type: AnswerComment
has text: An enum is a better use-case for a static singleton.
comment on: http://stackoverflow.com/a/23067984

http://stackoverflow.com/comment/35321114
comment on: http://stackoverflow.com/a/23107149
has text: its not backwards.. it's exactly like I said, each letter that is not in set turns *
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23067143
tagged with: java
tagged with: box2d
type: Question
has answer: http://stackoverflow.com/a/23430405
answer count: 1
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/23430405
score: 0
has body: I'm having a problem trying to extend org.jbox2d.dynamics.Body I've set Rectangle to extend org.jbox2d.dynamics.Body and set it to be DYNAMIC, but the Rectangle will not move. And if I create multiple Rectangle's, they're all positioned in the same position i.e (0.0f, 0.0f), why? Rectangle is defined as: public class Rectangle extends Shape { private PolygonShape blockShape; private Body body; private float width; private float height; public Rectangle ( Vec2 centerPoint, float angle, float width, float height, BodyType bt, float density, float friction, float restitution, World world, BodyDef bd){ super(bd,world); this.width = width; this.height = height; blockShape = new PolygonShape(); blockShape.setAsBox(this.width, this.height); FixtureDef fixtureDef = new FixtureDef(); fixtureDef.shape = blockShape; fixtureDef.density = density; fixtureDef.friction = friction; fixtureDef.restitution = restitution; this.bodydef.type = BodyType.DYNAMIC; this.bodydef.position.set(centerPoint.x, centerPoint.y); this.bodydef.angle = angle; world.createBody(this.bodydef); createFixture(fixtureDef); setType(bt); }; Shape has follow definition: public abstract class Shape extends org.jbox2d.dynamics.Body{ protected World world; protected BodyDef bodydef; public Shape(BodyDef bd, World w) { super(bd, w); this.world = w; this.bodydef = bd; } protected abstract void update(); protected abstract void draw(GLAutoDrawable gLDrawable); } In Level.java which extends org.jbox2d.dynamics.World I create a Rectangle and call Rectangle.draw(gLDrawable) new Rectangle( new Vec2(1.0f,1.0f),//Vec2(x,y) 0.0f, //angle 2.0f, //width 2.0f, //height BodyType.DYNAMIC, //bodyType 0.5f, //density 0.5f, //friction 0.5f, //restitution this, //world new BodyDef())); //BodyDef
tagged with: jbox2d
has title: Correct way to extend org.jbox2d.dynamics.Body
type: AnsweredQuestion

http://stackoverflow.com/q/23078807
has comment: http://stackoverflow.com/comment/35271530
has comment: http://stackoverflow.com/comment/35271940
has answer: http://stackoverflow.com/a/23078916
type: Question
has comment: http://stackoverflow.com/comment/35271536
has comment: http://stackoverflow.com/comment/35271624
downvote count: 0
has body: I have a situation where on construction of an object a static variable is incremented by 1. Now, I want this variable to be decremented as soon as object dies. Overriding finalize is one way, but that does not ensure as soon as part and is not guaranteed too. is there any other way to achieve this? EDIT : real problem is, I require thread sequencing like, "Thread-1" "Thread-2" etc. and if "Thread-2" dies, you want the next created thread to become "Thread-2"
has comment: http://stackoverflow.com/comment/35271657
favorite count: 0
has comment: http://stackoverflow.com/comment/35271687
has comment: http://stackoverflow.com/comment/35271563
has answer: http://stackoverflow.com/a/23079049
answer count: 4
has comment: http://stackoverflow.com/comment/35271630
score: 2
has answer: http://stackoverflow.com/a/23078858
upvote count: 2
type: UnansweredQuestion
tagged with: finalizer
has title: Finalizer method not executed when object dies
linked to: http://stackoverflow.com/q/2506488
has answer: http://stackoverflow.com/a/23078920
has comment: http://stackoverflow.com/comment/35271651
tagged with: java

http://stackoverflow.com/a/22980181
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22979956
has body: Seemed like that your list is empty. What can triggered the exception is the statement: int max = inList.get(0); So your inList do not have the value in the first index,which means the inList is empty.

http://stackoverflow.com/comment/35103220
has text: Have a look at [this answer](http://stackoverflow.com/a/9235912/241990).
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22984403

http://stackoverflow.com/a/23111269
type: Answer
score: 213
upvote count: 213
has comment: http://stackoverflow.com/comment/84502182
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23110853
has body: You can do int sum = lst.stream().filter(o -&gt; o.getField() &gt; 10).mapToInt(o -&gt; o.getField()).sum(); or (using Method reference) int sum = lst.stream().filter(o -&gt; o.getField() &gt; 10).mapToInt(Obj::getField).sum();
accepted answer of: http://stackoverflow.com/q/23110853

http://stackoverflow.com/comment/35093727
comment on: http://stackoverflow.com/a/22980137
type: AnswerComment
has text: @user3503165: No, *don't* make it static - it's perfectly fine to be an instance variable, just avoid creating multiple instances of `Ball`.
score: 0
type: Comment

http://stackoverflow.com/a/23013928
has body: In Intellij IDEA you can create something called Exception breakpoints. Maybe it will fulfill your requirements. Exact procedure is described here. You could combine it with standard Line breakpoint. For example you could add a Line Breakpoint on the line of the statement and use an option Disabled until selected breakpoint is hit and point there at the Exception Breakpoint activated by required exception class.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35179277
answers question: http://stackoverflow.com/q/23013001
upvote count: 1
has comment: http://stackoverflow.com/comment/35153483
type: Answer
has comment: http://stackoverflow.com/comment/35179159
has comment: http://stackoverflow.com/comment/35156398

http://stackoverflow.com/comment/35191086
has text: I think this is exactly what the OP wants. But did you verify that the comparison is double comparison instead of integer? The net effect should be `if((double)((int) result) == result)`.
type: AnswerComment
comment on: http://stackoverflow.com/a/23034489
type: Comment
score: 0

http://stackoverflow.com/comment/35405503
comment on: http://stackoverflow.com/a/23111444
type: Comment
has text: @MonamiSen I just elaborated my proposition there based on the full problem.
score: 0
type: AnswerComment

parameter-passing
tags question: http://stackoverflow.com/q/23011833
tags question: http://stackoverflow.com/q/22998378
tag name: parameter-passing
type: Tag
tags question: http://stackoverflow.com/q/23096792
tags question: http://stackoverflow.com/q/22993009
tags question: http://stackoverflow.com/q/23000372
tags question: http://stackoverflow.com/q/22998951

http://stackoverflow.com/q/23021667
tagged with: web-scraping
type: Question
has title: Unable to parse few xml nodes.What's the protection applied?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23024064
has body: I have an xml feed like this &lt;item&gt;&lt;title&gt;Left hopes BJP surge will eat into Mamata’s votes &lt;/title&gt;&lt;link&gt;http://timesofindia.feedsportal.com/c/33039/f/533916/s/39439a29/sc/7/l/0Ltimesofindia0Bindiatimes0N0Cindia0CLeft0Ehopes0EBJP0Esurge0Ewill0Eeat0Einto0EMamatas0Evotes0Chome0Clok0Csabha0Celections0C20A140Cnews0CLeft0Ehopes0EBJP0Esurge0Ewill0Eeat0Einto0EMamatas0Evotes0Carticleshow0C336252890Bcms/story01.htm&lt;/link&gt;&lt;description&gt;At times sworn enemies can be of help to each other, albeit indirectly. In the current political winds of West Bengal, no one knows it better than the Left.&amp;lt;img width='1' height='1' src='http://timesofindia.feedsportal.com/c/33039/f/533916/s/39439a29/sc/7/mf.gif' border='0'/&amp;gt;&amp;lt;br clear='all'/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;a href="http://da.feedsportal.com/r/194480044196/u/409/f/533916/c/33039/s/39439a29/sc/7/rc/1/rc.htm" rel="nofollow"&amp;gt;&amp;lt;img src="http://da.feedsportal.com/r/194480044196/u/409/f/533916/c/33039/s/39439a29/sc/7/rc/1/rc.img" border="0"/&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;a href="http://da.feedsportal.com/r/194480044196/u/409/f/533916/c/33039/s/39439a29/sc/7/rc/2/rc.htm" rel="nofollow"&amp;gt;&amp;lt;img src="http://da.feedsportal.com/r/194480044196/u/409/f/533916/c/33039/s/39439a29/sc/7/rc/2/rc.img" border="0"/&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;a href="http://da.feedsportal.com/r/194480044196/u/409/f/533916/c/33039/s/39439a29/sc/7/rc/3/rc.htm" rel="nofollow"&amp;gt;&amp;lt;img src="http://da.feedsportal.com/r/194480044196/u/409/f/533916/c/33039/s/39439a29/sc/7/rc/3/rc.img" border="0"/&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;a href="http://da.feedsportal.com/r/194480044196/u/409/f/533916/c/33039/s/39439a29/sc/7/a2.htm"&amp;gt;&amp;lt;img src="http://da.feedsportal.com/r/194480044196/u/409/f/533916/c/33039/s/39439a29/sc/7/a2.img" border="0"/&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;img …
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
tagged with: screen-scraping
tagged with: java

http://stackoverflow.com/a/22987029
has body: The code attribute of the applet tag should not contain the .class extension. It must contain the class name only. You also need to properly specify the codebase attribute of the applet tag. Have a look at the Deploying With the Applet Tag tutorial for details.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35136161
has comment: http://stackoverflow.com/comment/35109206
has comment: http://stackoverflow.com/comment/35108767
has comment: http://stackoverflow.com/comment/35109090
answers question: http://stackoverflow.com/q/22985909
has comment: http://stackoverflow.com/comment/35109423
has comment: http://stackoverflow.com/comment/35113168
has comment: http://stackoverflow.com/comment/35109341
has comment: http://stackoverflow.com/comment/35108738
has comment: http://stackoverflow.com/comment/35109968
has comment: http://stackoverflow.com/comment/35108983
has comment: http://stackoverflow.com/comment/35135983

http://stackoverflow.com/comment/35340632
has text: If you are really talking about Java then `gameBoard = new int[3][3];` should not be an issue. Actually that should be faster than resetting all the elements. Even then I don't know why we would need to worry about the performance here, it's just a 3X3 array.
comment on: http://stackoverflow.com/a/23117713
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35340425
has text: Please could you elaborate on the 2nd way?
comment on: http://stackoverflow.com/a/23113850
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35300014
type: QuestionComment
comment on: http://stackoverflow.com/q/23093748
type: Comment
has text: @zgc7009, Thank you but I don't really understand what I need to do. How can I store that value which I change inside Handler?
score: 0

http://stackoverflow.com/comment/35077189
has text: thanks @RKC, i know this would work, but is there a way i could access it from an outer class without using an inner class. Just like i did earlier, because i want to achieve an MVC design pattern ??
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22971614

http://stackoverflow.com/q/22971519
has comment: http://stackoverflow.com/comment/35077845
type: Question
has answer: http://stackoverflow.com/a/22971760
answer count: 2
possible better answer: http://stackoverflow.com/a/22971799
accepted answer: http://stackoverflow.com/a/22971760
has comment: http://stackoverflow.com/comment/35077121
has comment: http://stackoverflow.com/comment/35077318
has comment: http://stackoverflow.com/comment/35078499
tagged with: hashtable
tagged with: regex
has title: Java Concordance Exercise
has comment: http://stackoverflow.com/comment/35077509
has comment: http://stackoverflow.com/comment/35077264
has comment: http://stackoverflow.com/comment/35077268
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35078164
has body: So I have a programming exercise that involves concordance. I am attempting to take a .txt file, use regex to parse it into strings containing all words, then create a Hashtable that has the key (the word) and the value (the number of times the word appears in the document). We are supposed to be able to account for both case sensitive and non-case sensitive scenarios by passing in a boolean. Here is what I have: public Concordance( String pathName, boolean is_case_sensitive ) { Scanner file = new Scanner(pathName); try { file = new Scanner(new File(pathName)); } catch (FileNotFoundException e) { System.out.println("No File Found"); } String[] words; Pattern pattern = Pattern.compile("\\W+"); words = pattern.split(file.nextLine()); String[] wordsCopy = new String[words.length]; for (int i = 0; i &lt; words.length; i++){ wordsCopy[i] = new String(words[i]); } int counter = 0; while (file.hasNext()){ for (String w : words){ counter = 0; for (String w2 : wordsCopy){ if (is_case_sensitive == false){ if (w.equalsIgnoreCase(w2)){ counter++; //w2 = null; tableOfWords.put(w, counter); file.next(); } } if (is_case_sensitive == true){ if (w.equals(w2)){ counter++; //w2 = null; tableOfWords.put(w, counter); file.next(); } } } } } } To walk you through where I am and where my error I believe is.... I use the scanner to "take in" the file the use the regex \W+ to get all of words. I create a String array, I split the Pattern pattern into the String array. Then I create a deep copy of the array to use during comparison. (So I now have two String arrays - words and wordsCopy). I use an int counter variable to keep track of how many times it appears and address case sensitivity by using an if statement and the equals/equalsIgnoreCase methods. I have been going back and forth between assigning w2 to null (its currently commented out) as I intuitively feel like if it is not set to null, it will be counted twice, but I can't seem to think through it appropriately. I think I am countin…
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22971799

http://stackoverflow.com/comment/35207153
comment on: http://stackoverflow.com/q/23043643
score: 0
type: Comment
type: QuestionComment
has text: oh sorry.. New user too..

http://stackoverflow.com/q/23108727
type: Question
has answer: http://stackoverflow.com/a/23171332
tagged with: inheritance
tagged with: protected
has title: Why am I allowed "direct access" to an object's protected field, whose class is defined inside a different package?
has comment: http://stackoverflow.com/comment/35324526
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35325388
has comment: http://stackoverflow.com/comment/35327845
has comment: http://stackoverflow.com/comment/35324150
has answer: http://stackoverflow.com/a/23108764
accepted answer: http://stackoverflow.com/a/23171332
possible better answer: http://stackoverflow.com/a/23108764
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35323728
tagged with: java
has answer: http://stackoverflow.com/a/23108941
has body: Main.java, main package: package pkgs.main; import pkgs.test.B; // Just some method inside the "main class" void method() { B b = new B(); b.x ++; // &lt;--- why is this allowed? } A.java, main package: package pkgs.main; public class A { protected int x; } B.java, test package: package pkgs.test; import pkgs.main.A; public class B extends A { } Edit: Another way of looking at this issue is as follows. I'll add two extra lines of code to the existing example code: Main.java, main package: // Just some method inside the "main class" void method() { B b = new B(); b.x ++; // &lt;--- why is this allowed? b.y ++; // (Additional code) Compilation ERROR, which is correct. } B.java, test package: public class B extends A { protected int y; // (Additional code) protected field; // access to it is disallowed inside the // "main calling class" above. }

http://stackoverflow.com/comment/35291435
comment on: http://stackoverflow.com/q/23090043
type: Comment
type: QuestionComment
has text: If he doesn't even know how to use a simple for-loop, I doubt lists are the thing to look for.
score: 2

http://stackoverflow.com/q/22977121
has comment: http://stackoverflow.com/comment/35087165
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/35087124
has answer: http://stackoverflow.com/a/22977156
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35087169
has comment: http://stackoverflow.com/comment/35087208
tagged with: java
has comment: http://stackoverflow.com/comment/35087151
has title: If and else if synatax
has answer: http://stackoverflow.com/a/22977182
accepted answer: http://stackoverflow.com/a/22977182
has comment: http://stackoverflow.com/comment/35087136
has answer: http://stackoverflow.com/a/22977199
downvote count: 1
type: Question
tagged with: if-statement
upvote count: 0
possible better answer: http://stackoverflow.com/a/22977156
score: -1
has body: Is this if (score &gt;= 93) grade = "A"; if (score &gt;= 84 &amp;&amp; score &lt;= 92) grade = "B"; if (score &gt;= 75 &amp;&amp; score &lt;= 83) grade = "C"; if (score &lt; 75) grade = "F"; the same as this if (score&gt;= 93) grade = "A"; else if (score &gt;= 84) grade = "B"; else if (score &gt;= 75) grade = "C"; else grade = "F"; I think they are both different because for the bottom one, if somebody has a score of 95 it is greater than 84 and 75. Which means the grade will be A, B, and C. The first if statement gives a restriction on the upper and lower bound of the score so there can be only one grade per score.

http://stackoverflow.com/a/23051002
answers question: http://stackoverflow.com/q/23050955
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23050955
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
has body: You need an interface: interface MyInterface { void commonMethod(); } class MyClass implements MyInterface { // implement `commonMethod()` } Now your method would be: public void aMethod(MyInterface object) { ... object.commonMethod(); ... } You can now pass an instance of MyClass (or any other class that implements MyInterface) to aMethod().
has comment: http://stackoverflow.com/comment/35351939
has comment: http://stackoverflow.com/comment/35263640
has comment: http://stackoverflow.com/comment/35458811

http://stackoverflow.com/comment/117728953
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/33630549
type: Comment
has text: Thanks! I was stuck at it for so long :D.

http://stackoverflow.com/q/23071791
tagged with: java
type: Question
tagged with: jpa
answer count: 1
tagged with: google-app-engine
has title: What is the difference between an Entity and a Persistent Object in App Engine?
has body: I am fairly new to App Engine and I am trying to figure out how to store and retrieve data. However, I am confused about the difference between a java class marked with @Entity(name="name") and a class marked with @PersistenceCapable. What is the difference between these two if I am trying to store something which can be sent off to a client? For example, if I have an API which makes a list of Cars available for rental, would I use an Entity or a PersistenceCapable class for the Car object?
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23071923

http://stackoverflow.com/comment/35088359
score: 2
comment on: http://stackoverflow.com/q/22977729
has text: Please have a look [here](http://stackoverflow.com/q/5102519/522444) at use of a ScheduledExectorService, but first by wrapping the Callable into a Runnable.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/71422654
has text: Nearly three years later and I am seeing this behavior when I create a maven project with a com.zenjava javafx archetype. Similar problems with running junit and getting a <terminated> line in the console without any other additional information. Other maven archetypes work fine, but I can't find a difference in build path or other property that would indicate what is going on.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22996958
type: AnswerComment

http://stackoverflow.com/q/23002915
has comment: http://stackoverflow.com/comment/35133715
type: Question
has comment: http://stackoverflow.com/comment/35154463
answer count: 2
tagged with: libgdx
has comment: http://stackoverflow.com/comment/35139301
has body: Hi I am using Libgdx to create a game. I am currently trying to add a button to my main menu screen. I have created a stage and have added the button actor to the stage. The problem is my app crashes on start up and my logcat says there is an error reading file data/ui/uiskin.json. This is really frustrating me please can you help me solve the error. I have followed this exactly to no avail this is also where I got the uiskin files.Using scene2d.ui with libgdx: where does the skin come from?. Sample code below. Skin skin = new Skin(Gdx.files.internal("data/ui/uiskin.json")); stage = new Stage(); btnlogin = new TextButton("click me",skin); stage.addActor(btnlogin); Render method Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f)); stage.draw();
has answer: http://stackoverflow.com/a/23011317
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/18526116
has title: Libgdx uiskin.json not loading error
has answer: http://stackoverflow.com/a/23014886
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/35127352
has text: man o man who will read this.can u give a abstract or jist what is ur problem?
comment on: http://stackoverflow.com/q/22999317
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35270531
has text: unfortunatelly, it takes that path string as response body, just displaying it on a page.
type: Comment
comment on: http://stackoverflow.com/a/23077603
score: 0
type: AnswerComment

http://stackoverflow.com/a/23127775
type: Answer
score: 0
has body: //sc.register(selector, SelectionKey.OP_READ); This is the line you need. It is commented out. Why? NB you also need some code to handle OP_READ when you get it, and you need to make it,remove() unconditional and fail-safe. Best way to do that is to move it straight after you call it.next().
answers question: http://stackoverflow.com/q/23125890

http://stackoverflow.com/comment/35299504
type: Comment
type: QuestionComment
has text: where scan is declared and initialized ? I `cannot find symbol: variable scan` and so the compiler
comment on: http://stackoverflow.com/q/23094209
score: 5

http://stackoverflow.com/comment/35344951
comment on: http://stackoverflow.com/q/23119909
score: 0
type: Comment
type: QuestionComment
has text: postRoute is a string which contains "http://some address/assignments"

http://stackoverflow.com/comment/35359488
type: QuestionComment
has text: no i have not added any api but i a am unable to find that api here is the link of example http://antipastohw.pbworks.com/w/page/41729078/How-to%20use%20a%20serial%20port%20with%20Android,%20Liquidware%20Ambrosia%20edition
comment on: http://stackoverflow.com/q/23127740
score: 0
type: Comment

http://stackoverflow.com/q/23083342
favorite count: 0
tagged with: cpu-usage
accepted answer: http://stackoverflow.com/a/23090056
type: AnsweredQuestion
has title: New Relic cpu usage Heroku app
score: 1
tagged with: newrelic
type: Question
has answer: http://stackoverflow.com/a/23090056
tagged with: heroku
tagged with: performance
has body: I have simple Java EE app on Heroku. I tested this app via JMeter. And now I need measure server statistic. The most important for me is server CPU usage. I installed New Relic plugin by instructions, chapter "Add the New Relic agent as a Maven dependency". Now I examine my app in section "Applications" (categories Monitoring, Events, Reports, Settings). I need measure server CPU usage during generate requests by JMeter. Which graph or statistic is best for this purpouse. For example: OR OR OR another statistic or graph is most suitable for CPU usage analysis? Thanks
tagged with: java
upvote count: 1
downvote count: 0
answer count: 1

http://stackoverflow.com/q/23103028
has answer: http://stackoverflow.com/a/23103294
tagged with: arraylist
answer count: 2
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/23160112
upvote count: 2
type: UnansweredQuestion
tagged with: android
score: 2
tagged with: android-fragments
tagged with: java
has title: Pass ArrayList from fragment to another fragment(extends ListFragment) using bundle, seListAdapter runtime error
type: Question
has body: I have tried using Static variable for the ArrayList but in the ListFragment class, while debugging it's value is null. I think the ListFragment gets created before initialising the ArrayList, thats why it's null, but not sure. Suggest if i can use any other way to send the inflated ArrayList from Fragment class to other Fragment class which extends ListFragment. Thanks in advance. Objective (This is the clue, what needs to be done) In the Monday_fragment's onStart() method use the findByView() method to find the label for the save entry button in the pages view. Using the reference to the button attach a setOnClickListener() method to the save button. You will need to save the time and the diary entry strings contained in the EditText fields on the page in this method. Use findViewById() to also get a reference to the first EditText field and use this to get the text of the field as a string and save it to a string. Repeat this for the next EditText - the diary entry. You will need a publicly accessible variable to store a reference for the day (Monday..Friday), the date time string, and the diary entry string. Create a new class (diaryLogs) with these fields to hold the values and a single constructor that takes an int (0 Mon, 1 Tue, 2 Wed etc) and two strings for the date time and diary entry to initialise an instance of the object. As a number of entries will be made for the same day, use an ArrayList &lt; diaryLogs > to store the values. As this value will be shared between fragments declare the variable as static in the MainActivity class. Use the .add() method of ArrayList to add the new diaryLog to the ArrayList in your setOnClickListener() method. Repeat this operation for the other diary page fragments. The monday_list fragment consists of a ListView and a button used to return to the Monday_fragment page. Create these objects in the monday_list xml file. Create a Monday_list_fragment that extends the ListFragment class. In the onCreateView() method inflat…
tagged with: android-listfragment
has comment: http://stackoverflow.com/comment/35314316
has answer: http://stackoverflow.com/a/23149170

http://stackoverflow.com/a/23101473
has body: You can use el: ${value &lt; 0 ? -value:value} or Create a custom EL function which delegates to Math#abs(int).
type: Answer
downvote count: 0
score: 7
accepted answer of: http://stackoverflow.com/q/23100995
answers question: http://stackoverflow.com/q/23100995
upvote count: 7
type: AcceptedAnswer

http://stackoverflow.com/comment/35204650
has text: I read your link. I explain you again. At the beginning, I did like getResource("/bar/bla.txt"). But when I did like this, it was working on Eclipse, but not when I run the jar. And I was told that the jar need the sounds to be in a source folder. And you told me I cannot do that, the sound has to be in the package no? So I guess that I have to use the file IO but I am afraid it is going to bug. So do you have a solution? If it is still not clear I put a picture of my folders and my code, but I think you understood above.
score: 0
comment on: http://stackoverflow.com/q/23041673
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22972365
has comment: http://stackoverflow.com/comment/35078635
tagged with: imageicon
has body: I have been asked this question before Can not get image from a path, and i try to do the way as this link NullPointerException when using path name to load image file, but it is still not working for me. I tried delete file and add a new one or create a folder and put this image file in this folder (image/12345.jpg). All those ways are not working. Could i need to delete all image file and import it all again?? or is there any way i can do it?? Thank you Because i tried to export exec jar file. it didn't show the image.
has comment: http://stackoverflow.com/comment/35078653
downvote count: 2
upvote count: 1
has title: NullPointerException when using path name to show image in jar file
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22972564
accepted answer: http://stackoverflow.com/a/22972564
tagged with: java
score: -1
tagged with: image
type: Question
linked to: http://stackoverflow.com/q/18254620
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/35294442
score: 0
has text: The trie class is unfinished at the moment - but I'll post the relevant code
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23091321

http://stackoverflow.com/comment/35318038
has text: @user3540384 Yes, sorry, missed that line. I updated my answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/23104822
score: 0
type: Comment

http://stackoverflow.com/comment/35190588
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23026094
has text: @user2651804: yep, see edit. I'm not sure that JToggleButtons are wired to use the rollover property.

http://stackoverflow.com/comment/35151814
type: AnswerComment
has text: No, I'm telling you that the *package names* matter. Just read what I actually wrote.
comment on: http://stackoverflow.com/a/23012444
score: 0
type: Comment

http://stackoverflow.com/comment/35089586
type: AnswerComment
comment on: http://stackoverflow.com/a/22977502
type: Comment
has text: were abouts wouldi add this
score: 0

http://stackoverflow.com/comment/35157459
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23015821
has text: It was because you call one method from another and the second one calls the first. You can return true instead of false, but you shouldn't call activity.onKeyDown(..) because you've overridden it, and call in it this function again. So you get a loop)
type: AnswerComment

http://stackoverflow.com/comment/35092020
has text: Your test is already right. Or do you want to test that the Modules in Student.moduleRecords don't change when you change csc8001?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22976404
score: 0

http://stackoverflow.com/q/23008311
has comment: http://stackoverflow.com/comment/35144421
has comment: http://stackoverflow.com/comment/35142929
tagged with: java
has answer: http://stackoverflow.com/a/23105058
has title: Write an XML with multiple elements which in turn contains multiple elements
has comment: http://stackoverflow.com/comment/35146384
type: Question
has comment: http://stackoverflow.com/comment/35146681
accepted answer: http://stackoverflow.com/a/23105058
has comment: http://stackoverflow.com/comment/35149792
has body: Here I have an XML file with multiple students and multiple teachers: <?xml version="1.0" encoding="UTF-8" standalone="no"?> Alan 11 01/01/2001 A+ Bob 22 02/02/2002 A David 33 03/03/2003 Maths Ellen 44 04/04/2004 English I have a Java application that reads this file with no problem. However, in terms of writing it, its a confusing mess. It has something to do with the fact that the application behaves as expected when reading and writing the name/age/dob, but the moment I try and write grade/subject, it looses control. I test this by printing the name for each item within the list; and it prints as expected: Alan Bob David Ellen I test this again by printing the age for each item within the list as well; and again, it prints as expected: Allan 11 Bob 22 David 33 Ellen 44 However this time, I try and print the subject instead: Allan Maths Bob English David It prints the subjects under the students and breaks after printing the first teacher, and I'm trying to understand why. So for my final test, I decided to print all of the elements that are at index 0, including both grade and subject to see what happens: Alan 11 01/01/2001 A+ Maths Subject should be at index 2, not 0, so why is it doing this? Why is the system reading and writing correctly up until this exact point? Just encase, here is my XSD that is used to validate the XML before reading it. <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'> <xs:element name="users"> <xs:complexType> <xs:sequence> <xs:element ref="students" minOccurs='1' maxOccurs='unbounded'/> <xs:element ref="teachers" minOccurs='1' maxOccurs='unbounded'/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="students"> <xs:complexType> <xs:sequence> <xs:element ref="student" minOccurs='1' maxOccurs='unbounded'/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="student"> <xs:complexType> <xs:sequence> <xs:element ref="name" minOccurs='0' maxOccurs='1'/> <xs:element ref="age" minOccurs='0' maxOccurs='1'/> <xs:…
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35147028
linked to: http://stackoverflow.com/q/22883296
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35143061
tagged with: xsd
has comment: http://stackoverflow.com/comment/35145690
type: AnsweredQuestion

http://stackoverflow.com/q/23037654
upvote count: 2
tagged with: api
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35200749
type: UnansweredQuestion
tagged with: streaming
has body: I am making a Twitter bot that will reply whenever it's account is tagged with @accountname. The problem is that I can't find a way to do something when a user is tagged. I've looked into the Streaming API, but there were not methods relating to a user being tweeted at. Can anyone point me in the right direction?
answer count: 0
score: 1
tagged with: java
tagged with: twitter
type: Question
tagged with: twitter4j
has title: Twitter4J - Get when user is tagged and reply?

http://stackoverflow.com/comment/35197003
type: Comment
has text: It was a bug and I've fixed it but the code still didn't work. So it's a bigger problem or something.
comment on: http://stackoverflow.com/a/23037674
type: AnswerComment
score: 0

http://stackoverflow.com/q/23094316
type: Question
has comment: http://stackoverflow.com/comment/35310028
tagged with: amazon-web-services
tagged with: amazon-sqs
answer count: 1
has title: Getting "peer not authenticated" exception on Amazon SQS
downvote count: 0
tagged with: amazon-ec2
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35308693
has answer: http://stackoverflow.com/a/23101466
has body: When running the following code from a JAR locally: public static List&lt;Message&gt; getMessages(AmazonSQS sqs, String queueUrl) throws IOException { ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(queueUrl).withWaitTimeSeconds(5); List&lt;Message&gt; messages = sqs.receiveMessage(receiveMessageRequest).getMessages(); return messages; } It works just fine. But when trying to run it remotely on an EC2 instance, I get the following exception: Apr 15, 2014 8:30:48 PM com.amazonaws.http.AmazonHttpClient executeHelper INFO: Unable to execute HTTP request: peer not authenticated javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated at sun.security.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:371) at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:126) at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:572) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:1 80) at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:645) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:480) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805) at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:384) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:232) at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:2170) at com.amazonaws.services.sqs.AmazonSQSClient.receiveMessage(AmazonSQSClient.java:942) at Utils.getMessages(Utils.java:80) at Manager.run(Manager.java:51) at Main.main(Main.java:10) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.Nativ…
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/23120647
score: 151
type: Answer
has body: TLDR: this is because only the service layer in the application has the logic needed to identify the scope of a database/business transaction. The controller and persistence layer by design can't/shouldn't know the scope of a transaction. The controller can be made @Transactional, but indeed it's a common recommendation to only make the service layer transactional (the persistence layer should not be transactional either). The reason for this is not technical feasibility, but separation of concerns. The controller responsibility is to get the parameter requests, and then call one or more service methods and combine the results in a response that is then sent back to the client. So the controller has a function of coordinator of the request execution, and transformer of the domain data to a format the client can consume such as DTOs. The business logic resides on the service layer, and the persistence layer just retrieve / stores data back and forth from the database. The scope of a database transaction is really a business concept as much as a technical concept: in an account transfer an account can only be debited if the other is credited etc., so only the service layer that contains the business logic can really know the scope of a bank account transfer transaction. The persistence layer cannot know what transaction it's in, take for example a method customerDao.saveAddress. Should it run in it's own separate transaction always? there is no way to know, it depends on the business logic calling it. Sometimes it should run on a separate transaction, sometimes only save it's data if the saveCustomer also worked, etc. The same applies to the controller: should saveCustomer and saveErrorMessages go in the same transaction? You might want to save the customer and if that fails then try to save some error messages and return a proper error message to the client, instead of rolling back everything including the error messages you wanted to save on the database. In non tra…
has comment: http://stackoverflow.com/comment/35358097
has comment: http://stackoverflow.com/comment/35359378
has comment: http://stackoverflow.com/comment/35358351
upvote count: 152
has comment: http://stackoverflow.com/comment/124411453
has comment: http://stackoverflow.com/comment/35357641
downvote count: 1
has comment: http://stackoverflow.com/comment/61393572
has comment: http://stackoverflow.com/comment/35358221
has comment: http://stackoverflow.com/comment/55353559
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35358287
accepted answer of: http://stackoverflow.com/q/23118789
answers question: http://stackoverflow.com/q/23118789
has comment: http://stackoverflow.com/comment/41616703
has comment: http://stackoverflow.com/comment/91578229

http://stackoverflow.com/comment/35244455
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23063738
has text: Thanks, I know about the camelCase, Thats my next thing to do. I had it all nice then changed and changed to try and get it to work. Appreciate the help

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/23043248
tags question: http://stackoverflow.com/q/23071765
tag name: csv
tags question: http://stackoverflow.com/q/23050068
tags question: http://stackoverflow.com/q/23044824
tags question: http://stackoverflow.com/q/23077489
tags question: http://stackoverflow.com/q/23000676
tags question: http://stackoverflow.com/q/23057761
tags question: http://stackoverflow.com/q/23033263
tags question: http://stackoverflow.com/q/22994875
tags question: http://stackoverflow.com/q/23011649
tags question: http://stackoverflow.com/q/23084344
tags question: http://stackoverflow.com/q/23078954
tags question: http://stackoverflow.com/q/23025618
tags question: http://stackoverflow.com/q/23053151

atomicinteger
tag name: atomicinteger
tags question: http://stackoverflow.com/q/23122321
type: Tag

http://stackoverflow.com/a/22972507
type: Answer
has comment: http://stackoverflow.com/comment/35084253
has comment: http://stackoverflow.com/comment/35087488
has comment: http://stackoverflow.com/comment/35089767
has body: Referenced libraries are an IDE concept that the VM has no clue about. So you'll need to run your stuff as java -cp mysql.jar:. modelo.ConectorBaseDatos -- if you need further assistance, leave a comment.
has comment: http://stackoverflow.com/comment/35079963
accepted answer of: http://stackoverflow.com/q/22972426
answers question: http://stackoverflow.com/q/22972426
has comment: http://stackoverflow.com/comment/35084014
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/35085381
has comment: http://stackoverflow.com/comment/35079166

http://stackoverflow.com/q/22990167
linked to: http://stackoverflow.com/q/11772120
tagged with: jsp
type: UnansweredQuestion
tagged with: tomcat
tagged with: servlets
tagged with: file-io
has answer: http://stackoverflow.com/a/22991096
type: Question
has body: In my web based application (Tomcat7 / JDK 7 - JSP 3.0), I built a translator to take csv files, clean them up, and save the file off. A second part then parses the file for certain information and creates a second file (so it can be loaded into another system for verification). This happens every day. These files are being written to ${ECLIPSE_HOME} (because I'm running this in Eclipse). What I want to do is have a folder created in the application's root directory {i.e, [app-root]/toBeDLd} specifically for saving the generated files into and downloading them, have my front end JSP be able to read and display the files (like a list of downloadable files, you click the link it downloads in your web browser) and at a specific time, delete all the files in that directory. I don't need to keep them, or have a backup of them. From what I have read, Sending OutputStream to browser and let browser save it would be a decent starting point, but I have also read some other comments on SO that it is a violation of servlet spec to save files inside of the web app directory. I'm not sure if that is due to it being the root of the webapp or not though. Ideally I would like to keep this completely contained within the web application. Is this possible? Is this the best way to do this?
score: 0
tagged with: java
has title: Create downloadable files and store in web app subdirectory in Java
answer count: 1

http://stackoverflow.com/q/23053426
has comment: http://stackoverflow.com/comment/35229809
tagged with: servlets
has title: I would like to pass an Image tag data to servlet. How?
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35235448
tagged with: jsp
has body: I have a jsp page where am displaying image (which is generated in servlet and passed with name in jsp) and accepting text. Now i would like to pass that image tag value and textarea value to another jsp page. I am able to get textarea value but how to retrieve image to servlet. JSP code: &lt;form id="form1" action="CallServlet"&gt; &lt;img src="PieChartDemo" width="600" height="400" border="0" name="chartsample"/&gt;&lt;br&gt; &lt;textarea rows="4" cols="150" id=t1 name=t1&gt;&lt;/textarea&gt; &lt;input type="Submit" value="Send"/&gt; &lt;/form&gt; Servlet Code: PrintWriter out=response.getWriter(); PieChartDemo pcd=new PieChartDemo(); String textvalues=request.getParameter("t1"); System.out.println("Text values : "+textvalues); out.println(textvalues); Now i would like to display or store it into a variable that image. How to go about? Suggest. Thanks in Advance.
favorite count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/35231063
linked to: http://stackoverflow.com/q/4998908
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23056497
has comment: http://stackoverflow.com/comment/35225343
type: Question
has comment: http://stackoverflow.com/comment/35226904
has comment: http://stackoverflow.com/comment/35225241
tagged with: javascript
score: -1

http://stackoverflow.com/q/23031788
has answer: http://stackoverflow.com/a/23043767
accepted answer: http://stackoverflow.com/a/23043767
has title: Localization in a GWT multi-module project
score: 0
answer count: 1
tagged with: maven
has body: I have a GWT maven webapp project that used to consist of a single module. As a result of requirements evolution, I need to extract some of the code into separate modules to make them reusable. So far, this process was going well until I decided to extract localization code in order to use it in another project. What I have is MyAppConstants and MyAppMessages interfaces with corresponding .properties files, which are used in client code by means of GWT.create(). I moved them to separate module, added Localization.gwt.xml file and specified the following inside pom.xml: org.codehaus.mojo gwt-maven-plugin com.myapp.Localization true com.myapp.client.MyAppConstants_ru com.myapp.client.MyAppMessages_ru i18n resources compile In main application module I simply inherited Localization.gwt.xml. As a result of compilation, I can see that .cache.html files do not contain localized constants and messages (they look like \u0410\u043B...) which they used to have. I suppose this happens because GWT compiler doesn't see source files (f.e., com.myapp.client.MyAppConstants_ru.java) in .generated folder where they normally reside after successful execution of i18n phase of maven plugin. Instead, they can be found in localization.jar. I feel like I'm missing something because this doesn't seem like a non-trivial task to solve. What would be the proper way of handling such a scenario?
tagged with: internationalization
tagged with: gwt
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/23055738
type: Answer
answers question: http://stackoverflow.com/q/23035465
score: 2
type: AcceptedAnswer
downvote count: 0
has body: Fixed this editing my hosts file: echo "127.0.0.1 localhost linux-hkem.site" &gt;&gt; /etc/hosts Thanks to: Why does java.net.UnknownHostException require changes to the hosts file? Play Framework GUID
accepted answer of: http://stackoverflow.com/q/23035465
upvote count: 2

http://stackoverflow.com/a/23049460
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35218217
has body: String st = ""; for (int i = 0; i &lt; 15; i++) st += name[i][0] + " " + name[i][1] + "\n"; outPut.setText(value); This loops over the array and creates a string containing all the full names, separated by a line break. This then sets the text using outPut.setText(value);
answers question: http://stackoverflow.com/q/23049419

http://stackoverflow.com/comment/35322811
has text: https://www.dropbox.com/s/mdfdniivhbm7cwf/java%20gui%20code.txt please fell free to tell here if there were any problems
comment on: http://stackoverflow.com/a/23104292
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35307107
comment on: http://stackoverflow.com/a/23058129
has text: Thanks Roman for the answer. Ok the situation is like this. Current application has developed lot of custom tags using stuts 1. So when migrate as you mentioned i have to remove those tags depend on struts 1 which is a huge effort. Any way since it has to be some how migrated what i thought of doing is rewrite those struts 1 written tag using struts 2 custom tags so that i dont have to touch any of current jsp's. Please advice whether its the correct approach? Thank you
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35219757
has text: Still have the same exceptions
score: 0
comment on: http://stackoverflow.com/a/23050323
type: AnswerComment
type: Comment

monkey
tag name: monkey
tags question: http://stackoverflow.com/q/23050483
type: Tag

http://stackoverflow.com/a/23118056
type: Answer
has body: This simple program loops through array values, testing each until it finds a value that doesn't generate an exception public static void main(String[] args) { int[] array=new int[]{0,0,0,0,5}; for(int i=0; i&lt;array.length;i++) { try { System.out.println(10/array[i]); break; } catch(Exception e) { try { Thread.sleep(1000); } catch(Exception ignore){} } } }
answers question: http://stackoverflow.com/q/23117622
score: 0
has comment: http://stackoverflow.com/comment/35341392
has comment: http://stackoverflow.com/comment/35341324
has comment: http://stackoverflow.com/comment/35341223

http://stackoverflow.com/comment/35794321
type: Comment
has text: Note that while this solution gives the desired results, it is very inefficient. See above and implement the chosen answer if possible.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23017657

http://stackoverflow.com/q/23085302
has answer: http://stackoverflow.com/a/30885935
has body: Hi all we have develope an J2EE application which can execute the stored procedure to get data from databases. Previously it was working fine before we upgrade our MySql Version to 5.5 to 5.6 now I am getting Communications link failure during commit() also I am not sure that this error is due to upgrade of mysql or not. I have allready spend a week to solve this problem. NOTE: Also when I restart my application and mysql it will work fine for some times then it started to giving following exception. Framework We Use Spring 3.0.1 Hibernate 3.3 Just Upgraded Following things C3P0 (Previous Version 9.1.2) c3p0-0.9.5-pre8.jar c3p0-oracle-thin-extras-0.9.5-pre8.jar mchange-commons-java-0.2.7.jar Connector/J (Previous Version 5.1.7) mysql-connector-java-5.1.30-bin.jar C3P0 Configuration initialPoolSize=10 maxPoolSize=30 minPoolSize=5 acquireIncrement=3 acquireRetryAttempts=0 preferredTestQuery=SELECT 1 idleConnectionTestPeriod=600 numHelperThreads=10 testConnectionOnCheckout=true maxIdleTime=300 JDBC proprities DriverClassName=com.mysql.jdbc.Driver Url=jdbc:mysql://localhost:3306/mydatabase?useOldAliasMetadataBehavior=true&amp;autoReconnect=true Username=root Password= Error Message ERROR org.hibernate.transaction.JDBCTransaction#toggleAutoCommit - Could not toggle autocommit com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure Last packet sent to the server was 0 ms ago. at sun.reflect.GeneratedConstructorAccessor56.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3009) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2895) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3438) at com.mys…
score: 4
tagged with: connection-pooling
tagged with: java
tagged with: hibernate
tagged with: mysql
answer count: 1
upvote count: 4
tagged with: c3p0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35311817
linked to: http://stackoverflow.com/q/2983248
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/35290913
has title: Communications link failure during commit(). Transaction resolution unknown

http://stackoverflow.com/comment/35110769
score: 3
has text: The problem is you haven't stated a clear question - your mention of libraries in the title is particularly spurious as they are not involved. Do you want to know how the AndroidManifest.xml is created, or do you want to know how that influences what activity is launched? For the record, it is normally created - or at least modified - by hand. Anything else is a convenience shortcut not to be relied upon.
comment on: http://stackoverflow.com/q/22990102
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23100288
has comment: http://stackoverflow.com/comment/59320880
has comment: http://stackoverflow.com/comment/38154150
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40647411
upvote count: 8
answers question: http://stackoverflow.com/q/23100211
type: Answer
score: 8
has body: You double-click on the failure in the JUnit view. Note that the diff is only available if the test fails with a ComparisonFailure
has comment: http://stackoverflow.com/comment/35309665
has comment: http://stackoverflow.com/comment/35355397
has comment: http://stackoverflow.com/comment/67594100
accepted answer of: http://stackoverflow.com/q/23100211
has comment: http://stackoverflow.com/comment/67593157

http://stackoverflow.com/comment/35215794
score: 0
type: Comment
has text: Well, yes. You don't have to import it but imagine You need to share this project with somebody else. Adding .project and .classpth to source control is always a bad idea. And.. second developer uses IntelliJ. How can he import the project? With maven or gradle (IntelliJ recognizes both formats) this is done automatically, with all dependencies being downloaded also.
comment on: http://stackoverflow.com/a/23047848
type: AnswerComment

http://stackoverflow.com/comment/35114773
score: 0
type: AnswerComment
has text: @Vakh I was updating the answer to include it. I'm more used to the first way.
type: Comment
comment on: http://stackoverflow.com/a/22992641

http://stackoverflow.com/q/23032051
has answer: http://stackoverflow.com/a/23040184
type: Question
answer count: 1
has title: How to create a modular UI using MigLayout without nesting multiple panels?
score: 0
type: UnansweredQuestion
tagged with: swt
tagged with: swing
has body: MigLayout is a highly versatile layout manager for Swing, SWT and JavaFX. As per the documentation, it should be possible to (re-)create any given layout with just a single instance of that layout manager. However, I could never figure out how to create a modular application with decentralized control over layouting with that single instance: I have a parent panel that controls where individual components contributed by submodules go. Aiming for decoupled and independent submodules, those components are free to choose whether they do their layout with MigLayout or with any given layout manager. Thus, they hand out an instance of Node (or JComponent), and I end up with nested layout managers. Are there any emergent/good/best practices for achieving both decoupled architecture and adhering to MigLayout's single-instance paradigm?
tagged with: miglayout
tagged with: java
tagged with: javafx

http://stackoverflow.com/a/26114266
has comment: http://stackoverflow.com/comment/106837372
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/82263126
has comment: http://stackoverflow.com/comment/47298386
upvote count: 20
answers question: http://stackoverflow.com/q/22978245
type: Answer
accepted answer of: http://stackoverflow.com/q/22978245
has body: All you need to do is Extend all the activities with BaseActivity. The app never crashes at any point Code sniplet for BaseActivity : public class BaseActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread paramThread, Throwable paramThrowable) { Log.e("Error"+Thread.currentThread().getStackTrace()[2],paramThrowable.getLocalizedMessage()); } }); } }
score: 19

http://stackoverflow.com/a/23012921
has body: try this: JLabel label = new JLabel(" this is your text ");
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23012795

http://stackoverflow.com/comment/35248511
comment on: http://stackoverflow.com/a/23064521
type: Comment
has text: But which FFmpeg version should i use ?? i'm having Windows 7 / Eclipse Indigo / Opencv 2.4.2 / javacv 0.2
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35255857
score: 0
type: AnswerComment
has text: Indeed, using the `@Override` annotation will generate a compilation error when this happens. There is really no reason not to use it.
type: Comment
comment on: http://stackoverflow.com/a/23070012

http://stackoverflow.com/comment/35127053
comment on: http://stackoverflow.com/q/22999096
score: 0
has text: yeah, could go either way. multiple individual "int" values, e.g "123", being "three ints", but one single value
type: Comment
type: QuestionComment

tdd
tags question: http://stackoverflow.com/q/22984983
type: Tag
tags question: http://stackoverflow.com/q/23119230
tag name: tdd
tags question: http://stackoverflow.com/q/22992545
tags question: http://stackoverflow.com/q/23068468
tags question: http://stackoverflow.com/q/23074480

http://stackoverflow.com/q/23079030
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23079172
accepted answer: http://stackoverflow.com/a/23079172
has answer: http://stackoverflow.com/a/23079175
has title: Can Java SWT GridLayout lay out widgets from right to left?
has answer: http://stackoverflow.com/a/23097093
type: AnsweredQuestion
tagged with: java
tagged with: swt
type: Question
tagged with: layout
possible better answer: http://stackoverflow.com/a/23097093
has body: From API document of GridLayout: "Widgets are laid out in columns from left to right,...", I'm wondering if there is someway to lay out the widgets from right to left? Or, when I just have one column which applies GridLayout, can I lay out widgets from bottom to top? (Sorry for my poor English!)

http://stackoverflow.com/q/22981028
has body: I have many(Let say 10 (A, B, C...)) eclipse plugin which is maven based. I have one master pom file which includes all other plugin projects. now by building master file with sonar:sonar goal it will build all the plugins. So my question: Is there is any way so that I can exclude some plugin let say A and C.?
tagged with: sonarqube
score: 36
answer count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/22981461
tagged with: eclipse-plugin
favorite count: 0
has title: How to exclude some maven project from sonar analysis
tagged with: maven
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/33544478
tagged with: eclipse
has answer: http://stackoverflow.com/a/53769250
has answer: http://stackoverflow.com/a/22981461
type: Question
possible better answer: http://stackoverflow.com/a/33544478
upvote count: 36

http://stackoverflow.com/a/26657035
answers question: http://stackoverflow.com/q/23073115
type: Answer
has body: Late answer, but... First it looks like the wordId would be a more natural PK for the WordEntity. The LexiconEntity should also define a PrimaryKey. The WordEntity should define the SecondaryKey which refers to the LexiconEntity or "Specifies the entity to which this entity is related". public class WordEntity { @PrimaryKey private int wordId; private String content; @SecondaryKey(relate = Relationship.ONE_TO_ONE, relatedEntity = LexiconEntity.class) private int lexId; } public class LexiconEntity { @PrimaryKey private int lexId; private int numDocs; } Therefore data would be: LexiconEntity: lexId ----- 100 101 102 WordEntity: wordId lexId ------ ----- 1 100 2 101 3 102 Since the relationship is one_to_one, the secondary key is unique to the object defining it. So in this case, lexId is unique in the WordEntity, so you cannot have: WordEntity: wordId lexId ------ ----- 1 100 2 101 3 100 -- Exception on insert since it is a dup See http://docs.oracle.com/cd/E17277_02/html/GettingStartedGuide/dplindexcreate.html#dplsecondaryidxdecl http://docs.oracle.com/cd/E17277_02/html/java/com/sleepycat/persist/model/SecondaryKey.html#relatedEntity()
score: 0

http://stackoverflow.com/q/23027414
has title: How to implement accordions in Java swing
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35179079
type: Question
has comment: http://stackoverflow.com/comment/35225528
score: 0
has body: I have implemented accordions in Java using the code from https://code.google.com/p/k-diapo/source/browse/trunk/kdiapo/src/View/AccordianPanel.java?r=17 But to this I have panels which I have designed which is in Null layout, when I inserted these panels into accordions it is fine but, when I re-size the frame, contents not getting re-sized in it. This accordion I have place using grid-bag layout. Whole idea is to get re-size the components as window re-sized. How can this be achieved?
has comment: http://stackoverflow.com/comment/95017699
has comment: http://stackoverflow.com/comment/35179644
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/q/23018426
score: 0
answer count: 2
has body: can you have two listeners at the same time. I have two EditText which are defined as follows &lt;EditText android:id="@+id/editTextnum" android:layout_width="0sp" android:layout_height="50dp" android:paddingLeft="10dp" android:imeOptions="actionDone" android:background="@drawable/back" android:textSize="30dp" android:ems="10" android:textColor="#000000" android:layout_weight="1" android:inputType="number"&gt; &lt;EditText android:id="@+id/editTextnum2" android:layout_width="0sp" android:layout_height="50dp" android:paddingLeft="10dp" android:layout_weight="1" android:background="@drawable/back" android:ems="10" android:imeOptions="actionDone" android:inputType="number" android:textColor="#000000" android:textSize="30dp"&gt; When I get focus any either one it brings up a soft numeric keypad so that I can enter a number and then press done. the following code is run on pressing done while focused on EditTexnum 2 //Listner and result in MainActivity.java db = new DBAdapter(this); editText = (EditText) findViewById(R.id.editTextnum2); editText.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { EditText mEdit = (EditText)findViewById(R.id.editTextnum2); if(mEdit.length()==0){ Toast.makeText(getBaseContext(), "No Fault Reference Number Entered", Toast.LENGTH_LONG).show(); } else{ db.open(); Cursor c = db.getAsset2(mEdit.getText()); if (c.moveToFirst()) DisplayContact(c); else Toast.makeText(getBaseContext(), "No Fault Reference found", Toast.LENGTH_LONG).show(); } db.close(); This works perfect for editTextnum2 but editTextnum doesnt do anything because there isnt a listener i have tried copying the text and changing the listener but it kepps throwing erros basically hat I am doing is they are search boxes that search an sqlite database but they search on two different columns Any idea how I do this? Any help appreciated Mark
tagged with: sqlite
has answer: http://stackoverflow.com/a/23018622
has answer: http://stackoverflow.com/a/23018574
accepted answer: http://stackoverflow.com/a/23018574
tagged with: android
type: AnsweredQuestion
tagged with: android-edittext
type: Question
possible better answer: http://stackoverflow.com/a/23018622
has title: Android java Two Listners for edittext
tagged with: java

http://stackoverflow.com/q/23051880
has body: Why Hibernate not support distributed transactions, even though we can communicate with multiple databases using different cfg files Hibernate?
upvote count: 1
tagged with: java
tagged with: hibernate
downvote count: 3
tagged with: orm
type: Question
has answer: http://stackoverflow.com/a/23053025
has comment: http://stackoverflow.com/comment/35222790
score: -2
tagged with: database
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: Why does Hibernate not support distributed transactions?

http://stackoverflow.com/a/23057743
type: AcceptedAnswer
has body: You could create helper methods that would convert a list (array) of type T to a list (array) of type U using the map operation on stream. //for lists public static &lt;T, U&gt; List&lt;U&gt; convertList(List&lt;T&gt; from, Function&lt;T, U&gt; func) { return from.stream().map(func).collect(Collectors.toList()); } //for arrays public static &lt;T, U&gt; U[] convertArray(T[] from, Function&lt;T, U&gt; func, IntFunction&lt;U[]&gt; generator) { return Arrays.stream(from).map(func).toArray(generator); } And use it like this: //for lists List&lt;String&gt; stringList = Arrays.asList("1","2","3"); List&lt;Integer&gt; integerList = convertList(stringList, s -&gt; Integer.parseInt(s)); //for arrays String[] stringArr = {"1","2","3"}; Double[] doubleArr = convertArray(stringArr, Double::parseDouble, Double[]::new); Note that s -&gt; Integer.parseInt(s) could be replaced with Integer::parseInt (see Method references)
score: 133
has comment: http://stackoverflow.com/comment/100523229
type: Answer
upvote count: 135
accepted answer of: http://stackoverflow.com/q/23057549
answers question: http://stackoverflow.com/q/23057549
has comment: http://stackoverflow.com/comment/53269885
downvote count: 2

http://stackoverflow.com/q/23024823
favorite count: 0
has title: Using drawImage() to display a smaller section of larger image
type: Question
answer count: 1
score: -1
tagged with: java
downvote count: 1
has body: In attempt to use drawImage(), particularly: drawImage(Image img,int dx1,int dy1,int dx2,int dy2,int sx1,int sy1,int sx2,int sy2,Color bgcolor,ImageObserver observer) to scale a larger image into a smaller box for custom scroll-viewing I run into the issue of not understanding what each of the parameters do. After reading the description on the Oracle website I still feel uninformed. How exactly do each of these parameters work?
upvote count: 0
has answer: http://stackoverflow.com/a/23024896
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35174249
tagged with: user-interface

http://stackoverflow.com/comment/35163631
comment on: http://stackoverflow.com/q/23019260
score: 0
type: Comment
type: QuestionComment
has text: yes I now.. StringBuffer would be better, but I am just asking in terms of reference variables

http://stackoverflow.com/a/23056392
score: 88
has comment: http://stackoverflow.com/comment/35230641
accepted answer of: http://stackoverflow.com/q/23056324
type: Answer
answers question: http://stackoverflow.com/q/23056324
has comment: http://stackoverflow.com/comment/35230700
has comment: http://stackoverflow.com/comment/138989230
has body: Firstly null means non-existence of an instance. Providing a default constant like DEFAULT or NONE, will change that meaning. Secondly, why would you need something default to represent what seems to be non-existent? That is the purpose of null. Basically, you would have to initialize and store an extra object, which shouldn't even exist whatsoever. BTW, it's not a language choice. It's completely on you how you implement your enum. You can provide another constant like DEFAULT, or UNKNOWN in your enum, and avoid the assignment of null to the reference in your code. This is famously known as Null Object Pattern. But saying that the null assignment should itself be compiler error, then I would say, since an Enum is anyways compiled to a Class, so it would be perfectly valid to use null to represent non-existence of an instance. One pitfall of allowing null though is with the usage of enum in switch-case. The below code will throw NPE, even with a default case: public class Demo { enum Color { WHITE, BLACK; } public static void main(String[] args) { Color color = null; switch (color) { // NPE here case WHITE: break; case BLACK: break; default: break; // null value does not fall into the default } } } Java does not allow a case null: either, producing the following compile error: an enum switch case label must be the unqualified name of an enumeration constant
has comment: http://stackoverflow.com/comment/70154093
upvote count: 91
downvote count: 3
has comment: http://stackoverflow.com/comment/132086591
has comment: http://stackoverflow.com/comment/35231007
has comment: http://stackoverflow.com/comment/82151542
has comment: http://stackoverflow.com/comment/35230594
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35231238

http://stackoverflow.com/comment/35362809
score: 0
type: AnswerComment
has text: @someone2088 Disable ability to edit it using .setEditable(false) or use JLabel.
type: Comment
comment on: http://stackoverflow.com/a/23129931

http://stackoverflow.com/comment/35289111
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22991222
score: 0
has text: yes i have a id field in my entity added this to my form ` ` but still not storing data to my email field

http://stackoverflow.com/q/22974970
score: 2
tagged with: jpa
downvote count: 0
tagged with: tomcat
has body: I have some issues setting up Hibernate to work with Tomcat. Here is the project structure: ├── build.gradle └── src └── main ├── java │ └── com │ └── test │ ├── domain │ │ └── Person.java │ └── web │ └── Servlet.java ├── resources │ └── META-INF │ └── persistence.xml └── webapp └── META-INF └── web.xml The build.gradle content: apply plugin: 'java' apply plugin: 'idea' apply plugin: 'tomcat' apply plugin: 'war' sourceCompatibility = 1.5 version = '1.0' repositories { mavenCentral() } buildscript { repositories { jcenter() } dependencies { classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.2.3' } } dependencies { compile 'javax.servlet:javax.servlet-api:3.0.1' compile 'org.hibernate:hibernate-entitymanager:4.3.4.Final' compile group: 'org.hibernate', name: 'hibernate-core', version: '4.3.4.Final' compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.30' def tomcatVersion = '8.0.5' tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}", "org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}" tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") { exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj' } } war { webXml = file('src/main/webapp/META-INF/web.xml') } The Servlet class: package com.test.web; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.servlet.ServletException; import javax.servlet.http.*; import java.io.IOException; public class Servlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("com"); EntityManager entityManager = entityManagerFactory.createEntityManager(); } } The WAR structure: ├── META-INF │ ├── MANIFEST.MF │ └── web.xml └── WEB-INF ├── classes │ ├── META-INF │ │ └── persistence.xml │ └── com │ └── test │ ├── domai…
favorite count: 0
has title: Hibernate JPA: Unable to build entity manager factory
upvote count: 2
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: hibernate
tagged with: gradle
type: Question

http://stackoverflow.com/comment/35128485
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22999936
has text: Sort your ranges first, then iterate through them - the start of each range will be the end of a gap and vice versa.
score: 0

http://stackoverflow.com/a/23004376
downvote count: 0
answers question: http://stackoverflow.com/q/22989091
upvote count: 2
has body: I totally understand that you would like to write this by your self, but there are lots of frameworks out there that will help you with the complex stuff and let you focus on the actuall business issues to solve. We use XSockets.NET most of the time since that is perfect for our needs. Setting ap a one to one chat (or other scenarios) is very easy with XSockets since it is all about publish/subscribe... And you can also filter where to send messages on the server with powerful extension methods A simple sample chat: To save some time and keep it stupid and simple I will use two dropdowns where you select your name and the city you are in. So not actually 1-1, but it is so that you would get the concept. JAVASCRIPT/MARKUP steve ben tomas london paris tokyo C# using XSockets.Core.XSocket; using XSockets.Core.XSocket.Helpers; namespace SimpleChat { public class ChatMessage { public string From { get; set; } public string Text { get; set; } public string Time { get; set; } } public class Chat : XSocketController { /// /// My name, we set this from javascript... /// public string UserName { get; set; } /// /// We only send to people being in the same city, we set it from javascript /// public string City { get; set; } /// /// A user sends a message /// /// public void ChatMessage(ChatMessage chatMessage) { chatMessage.From = this.UserName; //Send only to the client(s) being in the same city, but you can ofcourse change ot to another user only etc this.SendTo(p => p.City == this.City, chatMessage,"chatmessage"); } } } Summary The only thing I did except the code above was to create a new project and then Install XSockets (to start a xsockets server) Install XSockets.JsApi (for publish subscribe over websockets) Install jQuery (becasue I am lazy) Install Momoent.JS (for working wiht dates in javascript) Install knockoutjs (for modelbinding) Added a XSockets bootstrapper into App_Start (found under Add->NewItem->XSockets->XSockets.Web.Bootstrapper
type: Answer
score: 2

http://stackoverflow.com/q/23085320
answer count: 4
has body: I'm trying to launch a thread that needs to execute a task every second. So what I did from now is making a loop on this code: // execute my task .. lastScan.setTime(lastScan.getTime() + 1000); long timeToSleep = (lastScan.getTime() - new Date().getTime()); try { Thread.sleep(timeToSleep); } catch (InterruptedException e) { e.printStackTrace(); } This works, but I was wondering if there is something more elegant, and maybe more safe, for example a function that awake my thread when the current Date reach a given time. Thanks in advance for your suggestions.
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23085398
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23085588
type: AnsweredQuestion
has title: How to awake a Thread every second, Java
has comment: http://stackoverflow.com/comment/35282639
has answer: http://stackoverflow.com/a/23085418
possible better answer: http://stackoverflow.com/a/23085418
accepted answer: http://stackoverflow.com/a/23085398
has comment: http://stackoverflow.com/comment/35282698
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23085365

http://stackoverflow.com/q/23020415
upvote count: 8
has comment: http://stackoverflow.com/comment/35165990
has answer: http://stackoverflow.com/a/24150935
accepted answer: http://stackoverflow.com/a/24150935
has comment: http://stackoverflow.com/comment/37080954
score: 8
has title: Reading from a Barcode Scanner in Swing
tagged with: barcode
has comment: http://stackoverflow.com/comment/35204211
tagged with: swing
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/13115704
has answer: http://stackoverflow.com/a/25958826
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35165870
answer count: 2
has comment: http://stackoverflow.com/comment/37177532
has comment: http://stackoverflow.com/comment/37285704
downvote count: 0
has body: I have installed a bar-code scanner from Datalogic, with the goal of reading the bar-code into a java textfield. However, when I scan the bar code in Swing, the resulting text is garbage. I cannot use this. On standalone java.awt.TextField is works fine, but when I integrate this into my code, it also produces garbage non-mappable characters. Don't know if I'll need a specific driver for JAVA, I have tried converting the string from UTF-8 to ISO-88... to no avail. Been looking at this since 2 days in-vain. Any help will be greatly appreciated. Thanks -innocent
favorite count: 0
has comment: http://stackoverflow.com/comment/37251975
has comment: http://stackoverflow.com/comment/36668612
possible better answer: http://stackoverflow.com/a/25958826

http://stackoverflow.com/q/23089090
possible better answer: http://stackoverflow.com/a/23089276
has answer: http://stackoverflow.com/a/23089271
has answer: http://stackoverflow.com/a/23089276
accepted answer: http://stackoverflow.com/a/23089271
answer count: 2
favorite count: 0
upvote count: 0
downvote count: 5
tagged with: regex-negation
has title: Regular Expression three characters in sequence and not repeated in the string
tagged with: regex
type: AnsweredQuestion
score: -5
tagged with: java
has body: I tried to solve the problem below using regular expression, but couldn't (end up using other approach): http://community.topcoder.com/stat?c=problem_statement&amp;pm=13006&amp;rd=15846 Given a string, you must check if contains the characters C, A and T in this order, and that there's only one occurrence of each. It can be other characters between these characters. Ex: CTA -&gt; false XCYAZTX -&gt; true ACBBAT -&gt; false CATT -&gt; false CCAT -&gt; false CAAT -&gt; false CAT -&gt; true So, it would be: public String getAnswer(String S) { if(S.matches("pattern???")) return "Possible"; return "Impossible"; } Does someone know a pattern to use and can share please?
type: Question

http
tags question: http://stackoverflow.com/q/23070892
tags question: http://stackoverflow.com/q/23112653
tags question: http://stackoverflow.com/q/23006099
tags question: http://stackoverflow.com/q/22999666
tags question: http://stackoverflow.com/q/23098360
tags question: http://stackoverflow.com/q/23010890
tags question: http://stackoverflow.com/q/23106877
tags question: http://stackoverflow.com/q/22995049
tags question: http://stackoverflow.com/q/23120815
tags question: http://stackoverflow.com/q/23056931
tag name: http
tags question: http://stackoverflow.com/q/23122522
tags question: http://stackoverflow.com/q/23021763
tags question: http://stackoverflow.com/q/23080906
tags question: http://stackoverflow.com/q/23025534
tags question: http://stackoverflow.com/q/23075673
type: Tag
tags question: http://stackoverflow.com/q/23117263
tags question: http://stackoverflow.com/q/23118716
tags question: http://stackoverflow.com/q/23056601

http://stackoverflow.com/comment/35089607
score: 0
type: Comment
has text: Thanks for your response. I am trying to replicate the solution here: http://stackoverflow.com/questions/3028490/calling-a-java-servlet-from-javascript
comment on: http://stackoverflow.com/a/22978288
type: AnswerComment

http://stackoverflow.com/q/23092027
score: 1
has body: I have a TreeMap &lt;String, TreeSet &lt;String&gt;&gt; {Heat = [Bosh, Lebron, Wade], Nets =[DWill, KG], Sonics = null, Warriors = [Curry,Iggy,Thompson]} and I want to print out. Heat Bosh Lebron Wade Nets DWill KG Sonics Warriors Curry Iggy Thompson I've tried for ( String w : listNBA){ System.out.print( w + " "); if (treemap.containsKey(w)) System.out.println(treemap.get(w)); else System.out.println( "" ); // print nothing if team doesn't exist But this isn't quite right either, and it's output is... Heat [Bosh, Lebron, Wade] Nets [DWill, KG] Sonics null Warriors [Curry,Iggy,Thompson] So, my question is: Is there any easy way to convert a TreeSet to a String in my print method?
upvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23092726
has answer: http://stackoverflow.com/a/23092160
tagged with: printing
answer count: 3
possible better answer: http://stackoverflow.com/a/23092726
downvote count: 0
has title: Printing out a TreeMap<String, TreeSet<String>> Key and Mapped Values
has answer: http://stackoverflow.com/a/23092305
has comment: http://stackoverflow.com/comment/35295375
favorite count: 0
accepted answer: http://stackoverflow.com/a/23092305
type: AnsweredQuestion

http://stackoverflow.com/a/23077825
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23075933
has body: PDF is a binary format, and should be handled by both the servlet and the user's web browser without doing any text-based character encoding and decoding. So if characters are not being displayed correctly, the problem is either in the PDF itself (i.e. there is some problem with the way that it has been generated) or in the software that it displaying it. It is puzzling that just changing the response content type is having this effect, because that should have no effect on the way that the response is created on the server side. So I have two possible explanations for you: You are actually changing something else in addition to the response content type. If that is the case, you need to explain (better) what you are actually doing. The content that you are trying to send is actually really HTML ... and when you set the response content type to PDF, you are causing the browser to send an HTML document to a PDF viewer. (I'm surprised that you get anything at all when you do that. I'd have thought that the browser-side PDF viewer would report a corrupted document or something.)
has comment: http://stackoverflow.com/comment/35312361

http://stackoverflow.com/q/23049459
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/35230718
score: 2
tagged with: jpa
downvote count: 0
has body: I have a class A, that has an optional link to an instance of a B class. For the sake of user-friendliness, I want to filter the output of the grid displaying the instances of the A class, with a switch allowing to display all of As, only As with a B or only As without a B. My abstract DAO is taking care of the process by dynamically building criteria queries according to the user desire for sorting/filtering. Works great for the two first scenarios, however, the last one always returns an empty list. Looking at the generated SQL code, I've got something like this (stripped down on purpose): Select t0.id as id [...] from person t0, user_profile t1 where t1.person_id = t0.id and t1.people_id is null; I see the logic behind this. However, this will definitely never work for my last case. I wonder how to get around this use case ? Any help ? The criteria is built programmatically, here is how it would look like if built manually: final CriteriaBuilder cb = getEntityManager().getCriteriaBuilder(); CriteriaQuery&lt;T&gt; cq = getContextQuery(context); // Juste create the base Criteria Root&lt;T&gt; root = findRoot(cq); // Retrieve the root. Path p = root.join(part, JoinType.LEFT); // 'part' is the entity to join on, got from metamodel. cq.where(cb.isNull(p)); return getEntityManager().createQuery(cq).getResultList(); What entities look like (stripped down to the meaningful part): @Entity @Table(name = "person") @Getter @Setter public class Person extends AbstractEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") protected Integer id; @XmlTransient @OneToOne(optional = true, mappedBy = "person") private UserProfile user; } @Entity @Table(name = "user_profile") public class UserProfile extends AbstractEntity implements Authenticated { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) protected Integer id; @OneToOne(optional = false) @JoinColumn(name = "person_id", referencedColumnName = "id") @Getter @Setter private Person person; }
type: UnansweredQuestion
favorite count: 0
type: Question
tagged with: eclipselink
has title: In a optional OneToOne join scenario, how to get entity A that does not have a B?
has answer: http://stackoverflow.com/a/23074789
has comment: http://stackoverflow.com/comment/35220397
upvote count: 2
answer count: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/23027268
type: Question
has title: Abstract class in Java.
downvote count: 0
has answer: http://stackoverflow.com/a/23027343
has comment: http://stackoverflow.com/comment/35178519
has answer: http://stackoverflow.com/a/23027314
favorite count: 0
has answer: http://stackoverflow.com/a/23027322
tagged with: scjp
has answer: http://stackoverflow.com/a/23027311
answer count: 5
type: UnansweredQuestion
has body: Wat does it mean by indirect Instantiation of abstract class ? how do we achieve this ? as i tried few times like .. it gives error has any one done something regarding this abstract class hello //abstract class declaration { void leo() {} } abstract class test {} //2'nd abstract class class dudu { //main class public static void main(String args[]) { hello d = new test() ; // tried here } }
has answer: http://stackoverflow.com/a/23027369
has comment: http://stackoverflow.com/comment/35178458
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/23106824
favorite count: 0
tagged with: timer
tagged with: executorservice
has body: I need to run a particular thread at a certain interval of time. I saw in this SO link that using timer is same as while(true) thread.sleep if we use it for delaying a certain period of time. What are the difference between these 3 and which of the above 3 stated methods will be effective and will be useful in reducing CPU usage.
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: timertask
has comment: http://stackoverflow.com/comment/35322158
type: Question
linked to: http://stackoverflow.com/q/3535754
has comment: http://stackoverflow.com/comment/35320274
tagged with: java
has comment: http://stackoverflow.com/comment/35352779
tagged with: infinite-loop
has title: while(true) { thread.sleep(time)} vs Timer.schedule , Timer Task vs Executor Service
downvote count: 0
has comment: http://stackoverflow.com/comment/35321827

http://stackoverflow.com/q/23021894
favorite count: 0
tagged with: system
type: UnansweredQuestion
has body: Just a simple Q. It is possible to code OS in Java? If yes, how I can i run Java via Assembly? Or how exactly it works.
has answer: http://stackoverflow.com/a/23022038
has comment: http://stackoverflow.com/comment/35168772
tagged with: java
upvote count: 1
type: Question
has title: Operating system in Java Language (JVM)
has comment: http://stackoverflow.com/comment/35168800
score: -3
linked to: http://stackoverflow.com/q/1988196
answer count: 2
downvote count: 4
tagged with: operating-system
has answer: http://stackoverflow.com/a/23021972
duplicate of: http://stackoverflow.com/q/1988196
tagged with: jvm

http://stackoverflow.com/a/23069270
upvote count: 11
score: 11
has comment: http://stackoverflow.com/comment/35257057
accepted answer of: http://stackoverflow.com/q/23069213
answers question: http://stackoverflow.com/q/23069213
has body: I suggest you to open it with MAT Eclipse Memory Analyzer , its a powerful tool to analyze that kind of Heap dump files, beside its the common way to analyze Heap files. Also you need to increase MAT memory in order to open that big size file, you can do that as the following: Open config.ini file that located in MAT_HOME directory. Change the value of -Xmx to more than 6GB. The Above Link contain also a tutorial to how to use MAT. If MAT won't open the Heap file, then the file is probably corrupted.
has comment: http://stackoverflow.com/comment/35254590
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/120561897
type: Answer
has comment: http://stackoverflow.com/comment/35256947

http://stackoverflow.com/comment/35171933
type: QuestionComment
comment on: http://stackoverflow.com/q/23023559
has text: Read more about [Ant javac task](http://ant.apache.org/manual/Tasks/javac.html)
score: 0
type: Comment

ruby
tags question: http://stackoverflow.com/q/23121703
tag name: ruby
tags question: http://stackoverflow.com/q/23077099
tags question: http://stackoverflow.com/q/23049489
tags question: http://stackoverflow.com/q/23070892
tags question: http://stackoverflow.com/q/23062918
tags question: http://stackoverflow.com/q/23044498
tags question: http://stackoverflow.com/q/23122674
type: Tag

http://stackoverflow.com/q/23103901
tagged with: java
tagged with: hibernate
type: Question
has body: I have some trouble with Hibernate 4 and inheritance: I use a ChildData class which inherit from BaseData by a JOIN inheritance strategy. My mapping is done by annotation in classes. Everything is working fine except that when I delete a ChildData instance (with session.delete() or with a Hql query) the BaseData entry is also deleted. I understand that in most case this is the awaited behavior, but for my particular case, I would like to preserve the BaseData entry no matter what for history purpose. In other words I want all actions on the child class to be cascaded to base class except deletion. I have already tried @OnCascade on the child class, with no success. Is it a way to achieve this by code or do I have to use a SQL Trigger ON DELETE ? EDIT : Base Class @Entity @Table(name = "dbBenchHistory", uniqueConstraints = @UniqueConstraint(columnNames = "Name")) @Inheritance(strategy = InheritanceType.JOINED ) public class DbBenchHistory implements java.io.Serializable { private int id; private String name; private String computer; private String eap; private Date lastConnexion; private Set&lt;DbPlugin&gt; dbPlugins = new HashSet&lt;DbPlugin&gt;(0); private Set&lt;DbSequenceResult&gt; dbSequenceResults = new HashSet&lt;DbSequenceResult&gt;( 0); public DbBenchHistory() { } public DbBenchHistory(int id, String name) { this.id = id; this.name = name; } public DbBenchHistory(int id, String name, String computer, String eap, Date lastConnexion, Set&lt;DbPlugin&gt; dbPlugins, Set&lt;DbSequenceResult&gt; dbSequenceResults) { this.id = id; this.name = name; this.computer = computer; this.eap = eap; this.lastConnexion = lastConnexion; this.dbPlugins = dbPlugins; this.dbSequenceResults = dbSequenceResults; } @Id @Column(name = "Id", unique = true, nullable = false) @GeneratedValue(strategy=GenerationType.IDENTITY) public int getId() { return this.id; } public void setId(int id) { this.id = id; } //Getters/Setters Child Class : @Entity @Table(name = "dbBench") @OnDelete(action…
has comment: http://stackoverflow.com/comment/35317852
has title: hibernate inheritance : How to protect base class entry on child class deletion
tagged with: inheritance
has answer: http://stackoverflow.com/a/23105969
score: 0
tagged with: sql
answer count: 1
tagged with: cascade
accepted answer: http://stackoverflow.com/a/23105969
type: AnsweredQuestion

http://stackoverflow.com/comment/35313270
comment on: http://stackoverflow.com/q/23102399
type: QuestionComment
has text: What plugins did you install? Try removing them and adding them one by one to rule out one of these is the culprit.
score: 0
type: Comment

http://stackoverflow.com/comment/35211828
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23044719
has text: @SamiKorhonen We have that system coming in 3 months or so but this is just a temporary maintenance tool.

http://stackoverflow.com/a/23068521
score: 3
has body: I assume it's because of parsing an empty string, No it is because the String it is attempting to parse is Total: 8.78 quick way to remove that label is (assumming you have control over the label substring("Total:".length()).trim();
upvote count: 3
answers question: http://stackoverflow.com/q/23068508
downvote count: 0
has comment: http://stackoverflow.com/comment/35252899
type: Answer
has comment: http://stackoverflow.com/comment/35253026

http://stackoverflow.com/a/41108367
has comment: http://stackoverflow.com/comment/75119611
type: Answer
has comment: http://stackoverflow.com/comment/75086785
upvote count: 55
has comment: http://stackoverflow.com/comment/75124085
has comment: http://stackoverflow.com/comment/74324297
score: 55
downvote count: 0
has comment: http://stackoverflow.com/comment/75119768
answers question: http://stackoverflow.com/q/23004921
has body: While the accepted answer is correct, I'll add a more elegant version (in my opinion): boolean idExists = tabPane.getTabs().stream() .map(Tab::getId) .anyMatch(idToCheck::equals); Don't neglect using Stream#map() which allows to flatten the data structure before applying the Predicate.
has comment: http://stackoverflow.com/comment/75356928

http://stackoverflow.com/q/23083867
tagged with: android
has answer: http://stackoverflow.com/a/23084071
has body: I have a big big problem... I created an application on android and i published it firstly under the name : "Flappy Pinkie". Then i changed my application design etc... and i wanted to change also the name of the application to : "Flappy Insects". I changed the name under title and many other options on my google developer console then i published the update... but when i go on the Play Store, it's still appearing as "Flappy Pinkie" and not as "Flappy Insects".. Don't know what is wrong.... Someone can help me ? Thank you.
has comment: http://stackoverflow.com/comment/35279885
has title: Application Name is not correct ! Google Console?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35280025
type: Question
has comment: http://stackoverflow.com/comment/35280729
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/35279889
answer count: 1

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/22976762
tags question: http://stackoverflow.com/q/23037802
type: Tag

http://stackoverflow.com/a/23091353
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35312826
accepted answer of: http://stackoverflow.com/q/23090949
answers question: http://stackoverflow.com/q/23090949
has comment: http://stackoverflow.com/comment/35314170
has body: When you create your arc in the constructor of DrawStuff here: arc = new Arc2D.Double(this.getWidth() / 2 - 50, this.getHeight() / 2 - 50, 100, 100, 0, 120, Arc2D.PIE); this.getWidth() and this.getHeight() will give a result of 0 because the components are not sized yet. A simple fix would be to use the fixed size like this: arc = new Arc2D.Double(210 / 2 - 50, 140 / 2 - 50, 100, 100, 0, 120, Arc2D.PIE);

http://stackoverflow.com/a/23054318
has body: Let's say you have 1 million users. Would you find it effective to get all the users from the database, and compare their username and password with the ones entered? A database is used to store data, and to be able to query the data. You should search for a user which has the entered usename, and the entered password. If you find one, then the user is authenticated. If you don't find any, then either the username or the password is wrong. Read the JDBC tutorial about prepared statements. Your query should look like select &lt;what_you_need&gt; from user where username = ? and password = ? Also, if this is more than a toy application that is not meant to go to production, you should not store passwords in clear text in the database. Passwords must be cryptographically salted and hashed, preferrably with a slow algorithm.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23054136

http://stackoverflow.com/q/23096870
tagged with: java
has body: I'm working on developing a ray tracer at the moment and I'm trying to work out the math behind some of the transformations I want to apply to the camera. What I have for now, in code, is a viewpoint and a screen located a certain distance from it. I've managed to work out how to pan or tilt the camera but I'm not sure how to combine the two in one transformation. Does anyone have an idea how I could do this?
has title: Perspective transformations for graphics
type: Question
tagged with: graphics
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/23096930
favorite count: 0
type: UnansweredQuestion
tagged with: raytracing
downvote count: 0
score: 1

http://stackoverflow.com/a/22987830
has body: You can use Collections.sort(List,Comparator), with a comparator like this: class MyComp implements Comparator&lt;UserObject&gt; { private int[] ref; public MyComp(int [] reference) { this.ref=reference; } public compare(UserObject o1, UserObjects o2) { return Ints.indexOf(ref,o1.id) - Ints.indexOf(ref,o2.id); } }
type: Answer
answers question: http://stackoverflow.com/q/22987541
score: 0

http://stackoverflow.com/comment/35287951
type: Comment
has text: You changed your question, put in the hints that we gave you, and then after it solved your NullPointerException asked for the next error that you got. That's not good practice, because it makes the first answers useless.
comment on: http://stackoverflow.com/q/23087491
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35214389
type: AnswerComment
has text: well it depends on how you want to implement it, if on wrong user input you want to exit, you can break the loop or else you can ask user to enter it again after reading his input if it is wrong
type: Comment
comment on: http://stackoverflow.com/a/23047354
score: 0

http://stackoverflow.com/comment/35142998
type: Comment
has text: Are you trying to consume a resource? Or call some method? Your details are a bit sparse.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23007239

http://stackoverflow.com/comment/123615835
has text: @mramsath this just defaults the keystoreType, according to this: http://support.ptc.com/help/thingworx/azure_connector_scm/en/index.html#page/thingworx_scm_azure/azure_connector/c_azure_trbl_input_stream_getlength_too_big.html
comment on: http://stackoverflow.com/a/58095479
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35215175
type: Comment
type: QuestionComment
has text: sure I can, but the program doesnt even run as far as running a test.
comment on: http://stackoverflow.com/q/23035465
score: 0

dao
tags question: http://stackoverflow.com/q/23114050
type: Tag
tag name: dao

http://stackoverflow.com/comment/35333719
comment on: http://stackoverflow.com/q/23114015
has text: I guess this is a good question for the [Lambda Mailing List](http://mail.openjdk.java.net/mailman/listinfo/lambda-dev).
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/35272877
comment on: http://stackoverflow.com/a/23079404
score: 0
type: AnswerComment
has text: replace 2*i +1 by 2*1 and start sum to 1;
type: Comment

http://stackoverflow.com/comment/35200593
has text: If your mipsim-/A.java reads from System.in and write to System.out it does not make sense to pass file names to your program - which you've already been told elsewhere.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23038047

http://stackoverflow.com/comment/35301842
type: QuestionComment
score: 1
has text: The `File` class takes a `URI` not a `URL` as an argument. `getResource()` returns a `URL`.
comment on: http://stackoverflow.com/q/23095441
type: Comment

http://stackoverflow.com/a/23088072
downvote count: 0
score: 7
accepted answer of: http://stackoverflow.com/q/23088036
upvote count: 7
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23088036
has body: Use java.math.BigInteger. BigInteger a = new BigInteger("123456789012345678901234567890"); BigInteger b = new BigInteger("314159265"); BigInteger c = a.add(b); System.out.println(c); Note (1) BigIntegers are immutable and (2) you have to use the methods add, subtract, etc. rather than +, -, etc. Also, BigInteger (and its floating-point analog, BigDecimal) is much lower slower than primitive types. BigInteger is fine for most cases, but avoid it if possible in performance sensitive code.
type: Answer

http://stackoverflow.com/a/23025418
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35175546
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/35175509
score: 8
has body: The short answer is that you can't, and that you don't need to. The GC will reclaim the memory when it needs to ... and there is no reason to interfere with that. The only situation I can think of for needing to delete an object sooner is when the object contains information that needs to be erased ... for information security reasons. (The classic example is when you are processing a password provided by the user and you are worried that it might leak via a code dump or something) In that case, you need to implement a method on your object for erasing the object's fields by overwriting them. But this requires careful design; e.g. to make sure that you find and erase all traces of the information. It is also sometimes necessary to "help" the GC a bit to avoid potential memory leaks. A classic example of this is the ArrayList class, which uses a Java array to represent the list content. The array is often larger than the list's logical size, and the elements of the array could contain pointers to objects that have been removed from the list. The ArrayList class deals with this by assigning null to these elements. Note that neither of these examples involve actually deleting objects. In both cases, the problem / issue is addressed another way. It is also worth noting that calling System.gc() is usually a bad idea: It is not guaranteed to do anything at all. In most situations, it won't do anything that wouldn't happen anyway. In most situations, it is inefficient. The JVM is in a better position than application code to know the ergonomically most efficient time to run the GC. (Read this for a first-principles explanation of the ergonomics.) The only cases where running the GC in production code is advisable are when you are trying to manage GC pauses, and you know that a pause is acceptable at a particular point in time. (For example, when you are changing levels in an interactive game ... )
accepted answer of: http://stackoverflow.com/q/23025376
answers question: http://stackoverflow.com/q/23025376
has comment: http://stackoverflow.com/comment/35175484

http://stackoverflow.com/a/23078857
has body: You can do it this way. In eclipse: File -> Import Git -> Projects from Git, click Next select Clone URI, Next Location URI: https://code.google.com/p/asqare/ , Next master, Next Destination Directory: C:... (browse to a place you want), Next Import existing projects, Next Finish This will clone the project in the place you specified and will import the project in the Eclipse Package Explorer:
accepted answer of: http://stackoverflow.com/q/23078213
type: Answer
has comment: http://stackoverflow.com/comment/35281290
has comment: http://stackoverflow.com/comment/35272762
score: 0
has comment: http://stackoverflow.com/comment/35275928
has comment: http://stackoverflow.com/comment/35321642
answers question: http://stackoverflow.com/q/23078213
type: AcceptedAnswer

http://stackoverflow.com/a/22996275
score: 0
answers question: http://stackoverflow.com/q/22996029
type: Answer
has body: If you look at the tutorial at line #130: holder.name.setTag(country); You don't have something like this in your code

http://stackoverflow.com/a/28868547
has comment: http://stackoverflow.com/comment/46143775
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/46142769
has comment: http://stackoverflow.com/comment/46142442
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23097106
has body: Well I finally figured out an answer. I'm leaving this here for posterity. The solution is complicated and somewhat of a Hack but it WORKS. Update the parent projects pom.xml file cloverDB: ${project.basedir}.clover\clover.db Merge CloverDB: ${project.basedir}.clover\cloverMerge.db Create your Unit Tests to Run in IntelliJ IDEA setup a Before launch - Run Maven Goal clean clover2:setup prepare-package -DSkipTests Create a Maven Run Configuration Make the Unit-Tests a Before launch condition In the command line have Maven run clover2:aggregrate Update Intellij Project Settings for clover to point to the merge file Make sure the Relative to project directory. checkbox is checked. InitString to User specified with the value the same as your pom file. in my case: .clover\cloverMergeDB Once the command is run, just click the Referesh Coverage icon to see and work with the coverage data in idea. If the tests fail you will also have the nice IntelliJ Test runner Tab to figure out why.
upvote count: 2
answers question: http://stackoverflow.com/q/23097106

http://stackoverflow.com/q/23123710
tagged with: java
tagged with: hibernate
has body: I've got an entity with an annotated @Version field. I am trying to use this field to check for concurrent modifications to the entity while by front end is displaying the data. However, this does not seem to be producing the desired effects. @Entity public class User { @Id @GeneratedValue(strategy=GenerationType.TABLE, generator="UUIDGenerator") @Column(name="id") private Long id; @NotNull private String username; private String password; @Version @Column(name="version") private Integer version; } I'm asking the front end to send the version field back to the server when posting data. On the server end, I am retrieving the entity from the DB using the PK, updating the version (along with other fields) with the posted value, and then having the entitymanager persist the entity. I was hoping that it would automatically throw a StaleObject exception if the version has changed in the meantime, but it does nothing. After further reading, it appears that I am not allowed to modify the version field programatically. According to the JPA spec, the application is not allowed to modify the version field: JPA 2.0 Final Spec, Section 3.4.2: An entity may access the state of its version field or property or export a method for use by the application to access the version, but must not modify the version value. With the exception noted in section 4.10, only the persistence provider is permitted to set or update the value of the version attribute in the object. Is my only choice at this point to manually check the posted data's version against the DB's version every time myself? Is there not a way to have the JPA provider do this for me?
has answer: http://stackoverflow.com/a/23124311
type: Question
tagged with: locking
has title: Can I use the @Version field to automatically check for concurrent modifications?
score: 0
answer count: 2
tagged with: jpa
has answer: http://stackoverflow.com/a/23124288
type: UnansweredQuestion

http://stackoverflow.com/a/23108046
score: 0
type: Answer
has body: how about this..? it will query apartmentIDs which are outside your specified date (in your original post) boundary.. SELECT tr.apartmentID, ta.apartmentNAME FROM tblRESERVATION tr JOIN tblAPARTMENT ta ON tr.apartmentID =ta.apartmentID AND tr.startDate &lt;= _a-date_ AND tr.endDate &gt;= _a-date_ UPDATE: actually I don't really know what you want.. if above query doesn't give you the result you want, you might wanna change this: AND tr.startDate &lt;= _a-date_ AND tr.endDate &gt;= _a-date_ to: AND (tr.startDate &lt;= _a-date_ OR tr.endDate &gt;= _a-date_)
answers question: http://stackoverflow.com/q/23107807

http://stackoverflow.com/comment/35205606
has text: i would like to know why i cant be done ?
score: 0
comment on: http://stackoverflow.com/q/23039505
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35142924
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23007942
type: QuestionComment
has text: There are classes that `extends Dao` (example: `Impl1Dao`) and they have their `createDao()` which `return new Impl1Dao();`

http://stackoverflow.com/comment/61377455
has text: To reproduce: `> keytool -list -keystore keystore.jks -storetype pkcs12` gives `keytool error: java.io.IOException: DerInputStream.getLength(): lengthTag=109, too big.`. Make sure you specify `-storetype` when using `keytool`.
comment on: http://stackoverflow.com/q/23126282
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35139094
type: Comment
comment on: http://stackoverflow.com/a/23005981
type: AnswerComment
has text: I am still having the same problem with single quotes :
score: 0

http://stackoverflow.com/comment/35333848
has text: I want to create file whose name is typed into text field 'File name' but only after user pressed Approve button on JFileChooser
comment on: http://stackoverflow.com/a/23113324
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35243001
comment on: http://stackoverflow.com/q/23024806
has text: Yes, I did. But to be completely honest I don't fully understand what I need to put in those props.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23068055
type: Answer
has body: What you're describing seems to be a more functional programming approach which is not implemented "beautifully" in Java... until now. I hate to simply link sources, but this is a good overview of what you're trying to do and where Java is at with it. If you have Java 8 available on this project, you are in luck because it does contain Lambda Expressions (it was just released in March this year). Here's the link: http://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html You basically want to define functionality and pass it to a method. Without seeing the source code or project goals, I'm not sure I can comment further.
answers question: http://stackoverflow.com/q/23066778
has comment: http://stackoverflow.com/comment/35257761
score: 0

http://stackoverflow.com/a/23039459
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35200218
answers question: http://stackoverflow.com/q/23039311
downvote count: 0
has body: try this menu.xml &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:showAsAction="ifRoom" android:title="@string/action_search"/&gt; &lt;item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="never" android:title="@string/action_settings"/&gt;
type: Answer

http://stackoverflow.com/q/23006796
type: Question
tagged with: standards
has comment: http://stackoverflow.com/comment/35140312
answer count: 3
has answer: http://stackoverflow.com/a/23006987
favorite count: 0
type: UnansweredQuestion
has title: Chicken and egg dilemma with linked list implementation
has comment: http://stackoverflow.com/comment/35140266
downvote count: 1
has comment: http://stackoverflow.com/comment/35140215
has body: I mainly learned about linked lists in the context of C++. Here's a node implementation struct node { int data; node* next;//node IS what is being defined }; I was taught that the C++ standards make a special exception for this because there is a self reference where the struct being defined has a member that is itself and that's a problem because it's not fully defined. Why is this possible? This screwed me up on an interview question and I need to know if other languages support this. For example I've seen a Java implementation class Link { public int data1; public double data2; public Link nextLink; //Link constructor public Link(int d1, double d2) { data1 = d1; data2 = d2; } //Print Link data public void printLink() { System.out.print("{" + data1 + ", " + data2 + "} "); } } So this seems to support Java makes some sort of "special exception" as well where public Link nextLink; occurs within the implementation of Link. In general do most programing languages have this feature? When can it be used? So you are always allowed to have: struct X{ X* y; }; and Plublic class X { Public X y; }
tagged with: c++
score: 2
has answer: http://stackoverflow.com/a/23006919
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23006874

http://stackoverflow.com/comment/35293816
comment on: http://stackoverflow.com/q/23090669
score: 0
has text: @ᴋᴇʏsᴇʀ i'll guess the only people that actually know are those that work on the interpreters themselves, most people don't need to concern themselves with the fine details of typing, we just accept strong typing and weak typing, there is no real benefit to going deeper and investigating how those variables are allocated because we're dealing with high-level languages where most of the time everything but type(and sometimes even type) are abstracted out of the syntax/language
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35260579
score: 0
has text: that shouldn't be a problem since in another update i do in my program i say "UPDATE info SET login = 0" and it works perfectly
comment on: http://stackoverflow.com/q/23072419
type: Comment
type: QuestionComment

axis
tags question: http://stackoverflow.com/q/23005703
tag name: axis
tags question: http://stackoverflow.com/q/23005458
tags question: http://stackoverflow.com/q/23052765
type: Tag

http://stackoverflow.com/a/71845518
score: 3
has body: I had a similar problem with this code: DateTimeFormatter.RFC_1123_DATE_TIME.format(new Date().toInstant()) java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: DayOfMonth I solved it this way: DateTimeFormatter.RFC_1123_DATE_TIME.format( ZonedDateTime.ofInstant(new Date().toInstant(), ZoneId.systemDefault()))
answers question: http://stackoverflow.com/q/23069370
upvote count: 3
type: Answer
downvote count: 0

http://stackoverflow.com/comment/35357275
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23126916
type: QuestionComment
has text: Related: http://stackoverflow.com/a/3512494/1225328

http://stackoverflow.com/a/23039856
has body: The simple fact is that "10.0%" is not a number data type and in JSON it cannot be expressed without being expressed as a string. The smart way to handle this would be to just drop the percentage sign and leave it as 10.0, or if you want to make it more correct, set it to 10.0/100.0 = 0.1 percent
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23039819
type: Answer

http://stackoverflow.com/a/23171109
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23046017
has body: <?xml version="1.0" encoding="UTF-8"?> LoginServlet LoginServlet LoginServlet com.connection.servlet.LoginServlet LoginServlet /LoginServlet Logout Logout Logout com.connection.servlet.Logout Logout /Logout ServletFilter com.connection.filter.ServletFilter avoid-urls Login.jsp ServletFilter /* this is logout servlet protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.setHeader("Cache-Control", "no-cache, no-store"); response.setHeader("Pragma", "no-cache"); request.getSession().invalidate(); response.sendRedirect("Login.jsp"); }
answers question: http://stackoverflow.com/q/23046017
score: 3
type: AcceptedAnswer
upvote count: 3
type: Answer

http://stackoverflow.com/q/23095258
tagged with: xstream
tagged with: hashmap
has answer: http://stackoverflow.com/a/23117186
score: 0
answer count: 2
tagged with: converters
has body: I have a JSON String of the map form : { "Lucy":{ "id": 456, "full_name": "GOOBER, ANGELA", "user_id": "2733245678", "stin": "2733212346" }, "Myra":{ "id": 123, "full_name": "BOB, STEVE", "user_id": "abc213", "stin": "9040923411" } } I want to convert it to HashMap with keys as "Lucy", "Myra" etc. and values as JavaObject Class Person { String id; String fullName; String userId; Strring stin; } How would I do it ? I kind of have a hint that I need to use MapConverter, but there is little documentation on how to. I have created Lists (using addImplicitCollection) using XStream but have no idea about Map.
has title: Convert JSON to HashMap using XStream
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23117336
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/comment/35274768
has text: Thanks for your answer, the child views are still receiving the click/tap event do I need to also remove the handler for the "click" (TapListener).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23080253

http://stackoverflow.com/q/23014853
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35155364
tagged with: jdbc-odbc
has comment: http://stackoverflow.com/comment/35155025
has comment: http://stackoverflow.com/comment/35155432
linked to: http://stackoverflow.com/q/13776320
has answer: http://stackoverflow.com/a/23015162
has body: I have to import data from a MySQL DB to a MS Access DB. I use JDK8 on a Windows7Pro 64 bit. When I run the code I get an exception at the following line of code: String database = .../ Connection conn = DriverManager.getConnection(database, "", "mypw"); and the error is: java.sql.SQLException: [Microsoft][Driver ODBC Microsoft Access] Not a valid password However, when I open the db via MSAccess the password is accepted. What am I missing? Maybe something related to the user value?
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35155111
favorite count: 0
tagged with: password-protection
has title: Password not recognized in Java for MS Access
has comment: http://stackoverflow.com/comment/35155518
has comment: http://stackoverflow.com/comment/35155212
has comment: http://stackoverflow.com/comment/69990782
accepted answer: http://stackoverflow.com/a/23015162
type: AnsweredQuestion
tagged with: ms-access-2010

http://stackoverflow.com/q/22993009
tagged with: java
has title: JAVA two way communication between classes
type: Question
tagged with: this
tagged with: class
has answer: http://stackoverflow.com/a/22993170
score: 0
answer count: 3
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22993134
has body: I want to be able to create an instance of my Client class in my GUI and then pass GUI.this as a parameter for the Client constructor but I'm not sure exactly how to do that. I know I'm missing something obvious! I want to be able to call methods on the other from either class. Obviously I have commented code out because I don't know how or what I am supposed to do to achieve this two way communication without merging the classes! I want to be able to do stuff like send a command through the Client from the GUI class when the "Up" button is clicked on the GUI etc. Thanks for the help in advance. Client class: public class Client{ //static playerGUI GUI; public static void main(String[] args) { //GUI = new playerGUI(); //GUI.getFrame().setVisible(true); //Client cli = new Client("localhost",4444); } public Client(playerGUI GUI){ try{ final Socket sock = new Socket("localhost",4444); final DataInputStream in = new DataInputStream(sock.getInputStream()); final PrintStream out = new PrintStream(sock.getOutputStream()); DataInputStream inputLine = new DataInputStream(new BufferedInputStream(System.in)); final Thread serverResponse = new Thread(){ public void run(){ System.out.println("DUNGEON OF DOOM HAS STARTED"); if(sock != null){ if(in != null){ try{ String response; while((response = in.readLine()) != null){ //GUI.processgrid(response); //send to GUI to process output! System.out.println(response); } }catch(UnknownHostException uhe){ System.err.println("Unknown host1: " + uhe); }catch(IOException ioe){ System.err.println("IOException1: " + ioe); }catch(NullPointerException npe){ System.err.println("Null Pointer1: " + npe); } } } } }; serverResponse.start(); if(sock != null){ if(out != null){ try{ while(true){ //inputbuttons! String sending = inputLine.readLine(); out.println(sending); if(sending.equals("QUIT")) break; } }catch(UnknownHostException uhe2){ System.err.println("Unknown host2: " + uhe2); }catch(IOException ioe2){ System.err.println("IOException2: " + ioe2…
has comment: http://stackoverflow.com/comment/35121526
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35115471
tagged with: swing
tagged with: parameter-passing
has answer: http://stackoverflow.com/a/22993067

http://stackoverflow.com/comment/35077636
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22971246
type: Comment
has text: But just as a method can declare to return `List` and has the right to return `ArrayList`, why can't my method do the above? I declare to return `X<Y>`, why can't I return subclass of `X` and inside the angular brackets a subtype of `Y`?

http://stackoverflow.com/q/23128829
has comment: http://stackoverflow.com/comment/35361233
has body: I converted a byte array into string by doing String s = encryptedBytes1.toString(); String gh = convertStringToHex(s); Then I printed on screen gh which is the hex form it returned this: gh:[B@5985910 this is the function convert public static String convertStringToHex(String str){ char[] chars = str.toCharArray(); StringBuffer hex = new StringBuffer(); for(int i = 0; i &lt; chars.length; i++){ hex.append(Integer.toHexString((int)chars[i])); } return hex.toString(); } Can any one help me printing the hex form string?
tagged with: java
tagged with: forms
linked to: http://stackoverflow.com/q/9655181
type: Question
score: 0
answer count: 2
tagged with: printing
has comment: http://stackoverflow.com/comment/35360354
linked to: http://stackoverflow.com/q/923863
has answer: http://stackoverflow.com/a/23130447
tagged with: string
has title: Printing the address of hex string instead of hex string value
has comment: http://stackoverflow.com/comment/35360297
tagged with: hex
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23128976

http://stackoverflow.com/q/22996386
answer count: 2
has comment: http://stackoverflow.com/comment/35170344
has title: Modifying a PDF file with java
has comment: http://stackoverflow.com/comment/35170549
tagged with: http://stackoverflow.com/tag/pdf
accepted answer: http://stackoverflow.com/a/22997491
possible better answer: http://stackoverflow.com/a/22996464
tagged with: velocity
has comment: http://stackoverflow.com/comment/35169889
has answer: http://stackoverflow.com/a/22997491
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35169903
has body: i have a template with plain text, some tables and a few images, i want to fill several of that template with data from a Data base. Is possible to open a pdf file in java an modify it? if it's possible, what (free)libraries i need (with documentation)? is compatible with apache velocity?
type: Question
has answer: http://stackoverflow.com/a/22996464
score: 0

http://stackoverflow.com/comment/35350728
has text: Please format your code. And only post relevant parts.
score: 0
comment on: http://stackoverflow.com/q/23123336
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35321171
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23105982
score: 0
has text: What macziaksz said. The issue here is that you don't seem to have any idea of the Java bascis; the solution is of course to **learn Java**. As such, I voted to close this question as too broad, since what you really need is to read and learn about the Object Model in Java, which is too broad of a topic to handle in a single answer.

gui-testing
type: Tag
tags question: http://stackoverflow.com/q/23123766
tag name: gui-testing

http://stackoverflow.com/comment/35234430
type: QuestionComment
comment on: http://stackoverflow.com/q/23058541
score: 0
type: Comment
has text: I am pretty sure it is the sendMessage method that is not working.

http://stackoverflow.com/q/22984623
tagged with: graphviz
favorite count: 0
has answer: http://stackoverflow.com/a/33135198
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/38817886
has comment: http://stackoverflow.com/comment/35107742
has title: Using GraphVIZ Native library from Java
score: 1
tagged with: java
type: Question
has body: I am trying to use graphviz native library from java.I am able to compile the program in Eclipse. But getting exception: Exception in thread "main" java.lang.UnsatisfiedLinkError: no gv in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681) at java.lang.Runtime.loadLibrary0(Runtime.java:840) at java.lang.System.loadLibrary(System.java:1047) at org.graphviz.test.Test.&lt;clinit&gt;(Test.java:12) Could not find the main class: org.graphviz.test.Test. Program will exit. Here is my code(copied from somewhere of course): package org.graphviz.test; import org.graphviz.internal.SWIGTYPE_p_Agedge_t; import org.graphviz.internal.SWIGTYPE_p_Agnode_t; import org.graphviz.internal.SWIGTYPE_p_Agraph_t; import org.graphviz.internal.gv; public class Test { static { System.loadLibrary("gv"); } public static void main(String[] args) { SWIGTYPE_p_Agraph_t g, sg; SWIGTYPE_p_Agnode_t n, m; SWIGTYPE_p_Agedge_t e; g = gv.digraph("G"); System.out.println(gv.setv(g,"aaa","xxx")); System.out.println(gv.getv(g,"aaa")); sg = gv.graph(g,"SG"); n = gv.node(g,"hello"); System.out.println(gv.getv(n,"label")); System.out.println(gv.setv(n,"aaa","xxx")); System.out.println(gv.getv(n,"aaa")); m = gv.node(g,"world"); System.out.println(gv.getv(m,"aaa")); e = gv.edge(n,m); System.out.println(gv.setv(e,"aaa","xxx")); System.out.println(gv.getv(e,"aaa")); gv.rm(e); gv.rm(n); gv.rm(m); gv.rm(g); g = gv.readstring("digraph G {a-&gt;b}"); gv.rm(g); g = gv.read("hello.gv"); gv.layout(g,"dot"); gv.render(g,"png","hello.png"); gv.rm(g); } } I have pointed the library correctly, but at runtime getting UnsatisfiedLinkError. Any one ever tried using the graphviz native library?Please let me know how to configure JNI.
answer count: 2
tagged with: java-native-interface
downvote count: 0

http://stackoverflow.com/q/23104445
type: Question
upvote count: 1
has title: how to make tess4j work with Deutsche language
favorite count: 0
has body: I am currently using Tess4J in order to integrate tesseract within my java program. Is it possible for me to work with lang.traineddata files like deu.traineddata , and afterwards just include this in my tessdata folder used by my Tess4J wrapper from my java program. because i tried to include the deu.traineddata in tessdata folder used it on a Deutsche document but the result is the same as using only English eng.traineddata i don't know if i have to include something in the config , how can i fix this problem ?
answer count: 1
accepted answer: http://stackoverflow.com/a/23109412
tagged with: tesseract
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23109412
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/23090862
has body: Technically the complexity is O(1) because 100 is a constant and thus the number of operations is always the same. If the author assumed that 100 is a parameter and can be some variable, i.e. int n = 100; //or read it somewhere for (int i = 10; i &lt; n; ++i) { .... } then the complexity is O(n^3). The first cycle body is executed n - 10 times which is O(n), the second cycle's body is executed from n - 10 times to once, which is again O(n), and the same can be stated for the innermost cycle, thus giving us O(n^3). Article useful for understanding the big O notation: Big O notation
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23090730
type: Answer
answers question: http://stackoverflow.com/q/23090730
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/q/23098312
upvote count: 0
score: -2
tagged with: ide
possible better answer: http://stackoverflow.com/a/23098591
has answer: http://stackoverflow.com/a/23098591
answer count: 2
has body: everybody. I have a Java Eclipse project. It contains many packages, and the class names can be the same with the package, just like: org.a a.java &lt;--------- this class is org.a.a b.java org.b a.java org.a.a &lt;---------- this package is also org.a.a a.java b.java When compiling the project, Eclipse reports error: The type "xxx" collides with a package. So is there a Java IDE that supports the same package and class names? Or is there a way I can compile it just in Eclipse?
has title: Is there a Java IDE that supports the same package and class names?
has answer: http://stackoverflow.com/a/23098504
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23098504
has comment: http://stackoverflow.com/comment/35307118
tagged with: java
downvote count: 2
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35306982

http://stackoverflow.com/comment/35188536
type: Comment
comment on: http://stackoverflow.com/q/23031820
score: 0
type: QuestionComment
has text: Thanks. I got the point.

http://stackoverflow.com/comment/35208686
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23041206
has text: and can i compile C, C++ in this too, that was the main reason i was asking for the method to manipulate cmd.

http://stackoverflow.com/comment/35301429
has text: I was learning from a certain free JavaFX tutorial on Youtube that I'm hesitant to post the name of because I know that the guy makes a living off his paid courses. Let's just say he's british and searching "javafx tutorial" on youtube yields his video in the top 5 results.
comment on: http://stackoverflow.com/a/23095126
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35170278
type: AnswerComment
has text: Slight correction: `?` after a `*` or `+` doesn't make the match optional--it makes it non-greedy, meaning the `*` will stop matching as soon as the regex can match the next step of the pattern (and still resolve the entire match when it's done).
comment on: http://stackoverflow.com/a/23022659
type: Comment
score: 1

http://stackoverflow.com/comment/35241934
has text: What's not working? What you've described/posted is analagous to calling up the doctor and telling him "something's wrong" and expecting him to fix it.
comment on: http://stackoverflow.com/q/23062340
score: 0
type: Comment
type: QuestionComment

eclipse
tags question: http://stackoverflow.com/q/23107835
tag name: eclipse
tags question: http://stackoverflow.com/q/23120039
tags question: http://stackoverflow.com/q/23026050
tags question: http://stackoverflow.com/q/22974218
tags question: http://stackoverflow.com/q/22974961
tags question: http://stackoverflow.com/q/22995555
tags question: http://stackoverflow.com/q/23045557
tags question: http://stackoverflow.com/q/22976752
tags question: http://stackoverflow.com/q/22980164
tags question: http://stackoverflow.com/q/23095119
tags question: http://stackoverflow.com/q/23128411
tags question: http://stackoverflow.com/q/22999794
tags question: http://stackoverflow.com/q/23048171
tags question: http://stackoverflow.com/q/23016209
tags question: http://stackoverflow.com/q/23055534
tags question: http://stackoverflow.com/q/22982195
tags question: http://stackoverflow.com/q/23107340
tags question: http://stackoverflow.com/q/23025461
tags question: http://stackoverflow.com/q/23043982
tags question: http://stackoverflow.com/q/22971774
tags question: http://stackoverflow.com/q/23058940
tags question: http://stackoverflow.com/q/23110894
tags question: http://stackoverflow.com/q/23109934
tags question: http://stackoverflow.com/q/23063046
tags question: http://stackoverflow.com/q/23016934
tags question: http://stackoverflow.com/q/23005586
tags question: http://stackoverflow.com/q/23029694
tags question: http://stackoverflow.com/q/23086382
tags question: http://stackoverflow.com/q/22968545
tags question: http://stackoverflow.com/q/23071624
tags question: http://stackoverflow.com/q/23025835
tags question: http://stackoverflow.com/q/23040087
tags question: http://stackoverflow.com/q/23072887
tags question: http://stackoverflow.com/q/23035417
tags question: http://stackoverflow.com/q/23118346
tags question: http://stackoverflow.com/q/22991806
tags question: http://stackoverflow.com/q/23057600
tags question: http://stackoverflow.com/q/22997476
tags question: http://stackoverflow.com/q/23086230
tags question: http://stackoverflow.com/q/23009836
tags question: http://stackoverflow.com/q/23050902
tags question: http://stackoverflow.com/q/22978170
tags question: http://stackoverflow.com/q/23081733
tags question: http://stackoverflow.com/q/23080968
tags question: http://stackoverflow.com/q/23092722
tags question: http://stackoverflow.com/q/23113223
tags question: http://stackoverflow.com/q/23001910
tags question: http://stackoverflow.com/q/23023751
tags question: http://stackoverflow.com/q/22986898
tags question: http://stackoverflow.com/q/23103719
tags question: http://stackoverflow.com/q/23026859
tags question: http://stackoverflow.com/q/23078262
tags question: http://stackoverflow.com/q/23018862
tags question: http://stackoverflow.com/q/23063530
tags question: http://stackoverflow.com/q/22988475
tags question: http://stackoverflow.com/q/22990874
tags question: http://stackoverflow.com/q/22984534
tags question: http://stackoverflow.com/q/23117541
tags question: http://stackoverflow.com/q/23042050
tags question: http://stackoverflow.com/q/23094552
tags question: http://stackoverflow.com/q/23120454
tags question: http://stackoverflow.com/q/23031435
tags question: http://stackoverflow.com/q/23094436
tags question: http://stackoverflow.com/q/23119661
tags question: http://stackoverflow.com/q/23060856
tags question: http://stackoverflow.com/q/23103278
tags question: http://stackoverflow.com/q/23085245
tags question: http://stackoverflow.com/q/23105062
tags question: http://stackoverflow.com/q/22982846
tags question: http://stackoverflow.com/q/23097675
tags question: http://stackoverflow.com/q/22992910
tags question: http://stackoverflow.com/q/22975117
tags question: http://stackoverflow.com/q/23095382
tags question: http://stackoverflow.com/q/23113506
tags question: http://stackoverflow.com/q/22995385
tags question: http://stackoverflow.com/q/23003618
tags question: http://stackoverflow.com/q/23010385
tags question: http://stackoverflow.com/q/22993550
tags question: http://stackoverflow.com/q/22979352

http://stackoverflow.com/q/23033296
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23033312
tagged with: multithreading
tagged with: observer-pattern
tagged with: design-patterns
type: Question
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23033312
has body: I have computational class that implements Runnable interface (for the readability I've simplified it): public class ColorReduction extends Observable implements Runnable { public ColorReduction(Layer inputLayer, Layer outputLayer) { this.init(); } private void init() { addObserver(new ActionObserver()); } public void run(){ notifyObservers(EAction.COLOR_REDUCTION_START); setChanged(); // some computation stuff..... notifyObservers(EAction.COLOR_REDUCTION_FINISH); setChanged(); } } and in a controller I run this class as a new thread: ColorReduction cr = new ColorReduction(model.getInputLayer(), model.getOutputLayer()); Thread t = new Thread(cr); t.start(); Question: an observer (ActionObserver) is notified only at the end of color reduction phase (COLOR_REDUCTION_FINISH) and not at the beginning of this phase (COLOR_REDUCTION_START). What is wrong with my code?
has title: Why observer is not notified when observable object runs as new thread?

http://stackoverflow.com/q/23046821
favorite count: 0
has comment: http://stackoverflow.com/comment/35213333
type: UnansweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/35213297
has comment: http://stackoverflow.com/comment/35213321
tagged with: java
has answer: http://stackoverflow.com/a/23046885
has comment: http://stackoverflow.com/comment/35213268
tagged with: sqrt
type: Question
has comment: http://stackoverflow.com/comment/35213292
has answer: http://stackoverflow.com/a/23046879
has title: Filling a int[] array
tagged with: arrays
score: -1
has answer: http://stackoverflow.com/a/23046926
answer count: 3
downvote count: 1
has body: I must make a int array filled with 5000 numbers, and then take the value of each cell, which is a random number up to 1000, and multiply it by the square root of the cell index. So far, my code is: import java.util.*; public class thousandArray{ public static void main (String args[]){ int numbers[] = new int[5000]; int r = 0 + (int)(Math.random()*1000); double rt = numbers[r]; while(rt==numbers[r]){ r=0+(int)(Math.random()*1000); double square = rt*Math.sqrt(numbers[r]); System.out.println(square); System.exit(0); } } } im pretty sure I did the code right, I cant figure out how to fill my array.

http://stackoverflow.com/q/23055076
has body: I have an existing Java Project that runs fine by itself. I created a new Dynamic Web Project and am using Tomcat to run the Dynamic Web Project. In Eclipse I selected the build path of the Dynamic Web Project and went to Java Build Path-&gt;Projects and selected the existing Java Project. In my servlet I can import myPackage.myClass; from the existing Java Project and run the servlet without issue. Yet if I use anything in that class, even a simple myClass testclass = new myClass(); I get a ClassNotFound exception. Do I need to do anything else to make this servlet call and use this other package? Both projects are in the exact same directory. Dir structure looks like this: parentDir/ myPackage/ myServlet/ I tried adding the Class Folder by going to Java Build Path-&gt;Libraries-&gt;Add Class Folder... and selecting the project folder as well, but I get an error in the dialog box saying Build path contains duplicate entry: I've never worked with servlets before nor have I used multiple packages, so I'm unsure what I'm doing wrong or if this can even work.
has comment: http://stackoverflow.com/comment/35228586
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35228066
has comment: http://stackoverflow.com/comment/35238992
has comment: http://stackoverflow.com/comment/35228242
linked to: http://stackoverflow.com/q/5719270
tagged with: java
has title: How to import existing Java Project into Dynamic Web Project in Eclipse
tagged with: eclipse
has answer: http://stackoverflow.com/a/65885723
tagged with: servlets
has comment: http://stackoverflow.com/comment/35228051
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35228135
has comment: http://stackoverflow.com/comment/35228087
has comment: http://stackoverflow.com/comment/35228046
score: 0
duplicate of: http://stackoverflow.com/q/5719270
has comment: http://stackoverflow.com/comment/35228166
has comment: http://stackoverflow.com/comment/35228095

http://stackoverflow.com/comment/35350110
type: Comment
has text: That's fine for initializing the 2d array but it doesn't change the fact that you're trying to access more characters than the `String` contains.
type: AnswerComment
comment on: http://stackoverflow.com/a/23122905
score: 0

http://stackoverflow.com/comment/35320652
has text: can you provide code sample?
comment on: http://stackoverflow.com/q/23105433
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/53801525
has body: I'm using Spring Boot, and this is what solved it for me: org.springframework.boot spring-boot-starter-activemq
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22987656

http://stackoverflow.com/comment/35303998
score: 1
has text: Then look at `S.contains(P)`, and your description of "see if their name is the same", and then see how that code doesn't in any way mirror your intention. You should be able to then see what the solution should be.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23096628

http://stackoverflow.com/q/23083574
accepted answer: http://stackoverflow.com/a/23084334
upvote count: 13
score: 13
type: AnsweredQuestion
has body: I got a javax.mail.Session named lSession, and a MimeMessage lMessage : Session lSession = Session.getDefaultInstance(properties); MimeMessage lMessage = new MimeMessage(lSession); I got a List of Byte Array who contains file's representations : List &lt;byte[]&gt; pPiecesJointes I try to attach these file to the message, but I can't fix it.... if(!pPiecesJointes.isEmpty()){ lMultipart = new MimeMultipart(); lMessageBodyPart = new MimeBodyPart(); // text message lMessageBodyPart.setText(pMessage); lMultipart.addBodyPart(lMessageBodyPart); for(int i = 0; i &lt; pPiecesJointes.size(); i++){ lMessageBodyPart = new MimeBodyPart(); /* ?????? How add attachment in lMessageBodyPart with a Byte Array ? */ lMultipart.addBodyPart(lMessageBodyPart); } lMessage.setContent(lMultipart); } Transport.send(lMessage); Please, if somebody knows who attach the file with a byte array ?
has title: Mail Attachments with byte array
tagged with: java
possible better answer: http://stackoverflow.com/a/23102570
has answer: http://stackoverflow.com/a/23102570
has answer: http://stackoverflow.com/a/23084334
type: Question
answer count: 2
tagged with: email
tagged with: arrays
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35279738
tagged with: byte

http://stackoverflow.com/q/23060774
has comment: http://stackoverflow.com/comment/35238778
has comment: http://stackoverflow.com/comment/35238817
has comment: http://stackoverflow.com/comment/35239227
answer count: 1
has comment: http://stackoverflow.com/comment/35239090
has answer: http://stackoverflow.com/a/23060979
tagged with: arraylist
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35238460
has comment: http://stackoverflow.com/comment/35238676
has comment: http://stackoverflow.com/comment/35239037
has comment: http://stackoverflow.com/comment/35238937
has title: ArrayList removes only content and not element
has body: I've written a code similar to this: ArrayList&lt;String&gt; someArrayList = new ArrayList&lt;String&gt;(); .... .... inserts elements into someArrayList .... .... int location = 4; someArrayList.remove(location); It has a size of 5, when I run through this, it removes the content at position 4, but the size doesn't change, it keeps being of 5 and when I get to the 4th element it is shown as empty. Should I do something else to erase position 4 completely or what? EDIT Logcat before removing: 04-14 15:03:41.790: W/System.err(22971): [1, 2, 3, 4] 04-14 15:03:41.790: W/System.err(22971): [1396850896.089319.jpg 04-14 15:03:41.790: W/System.err(22971): , 1396850896.47272.png 04-14 15:03:41.790: W/System.err(22971): , 1396850897.830785.jpg 04-14 15:03:41.790: W/System.err(22971): , 1396850895.729823.jpg 04-14 15:03:41.790: W/System.err(22971): ] Logcat exactly after doing a someArrayList.remove(location); 04-14 15:03:41.790: W/System.err(22971): [1, 2, 3, 4] 04-14 15:03:41.790: W/System.err(22971): [1396850896.089319.jpg 04-14 15:03:41.790: W/System.err(22971): , 1396850896.47272.png 04-14 15:03:41.790: W/System.err(22971): , 1396850895.729823.jpg 04-14 15:03:41.790: W/System.err(22971): ] i do this: // get all ids curFileName.moveToFirst(); while(!curFileName.isAfterLast()) { ids.add(curFileName.getString(curFileName.getColumnIndex("id"))); curFileName.moveToNext(); } // get all filenames curFileName.moveToFirst(); while(!curFileName.isAfterLast()) { filenames.add(curFileName.getString(curFileName.getColumnIndex("filename"))); curFileName.moveToNext(); } and then after doing some work: filenames.remove(location); // location is calculated when the work is being done
has comment: http://stackoverflow.com/comment/35238704
type: Question
has comment: http://stackoverflow.com/comment/35238453
tagged with: java
score: 0

http://stackoverflow.com/comment/35259011
comment on: http://stackoverflow.com/a/23071184
has text: its now; ObjectOutputStream oos = new ObjectOutputStream(clientSocket.getOutputStream()) oos.writeObject(connections); oos.close(); - although im getting the error "ERROR: java.io.NotSerializableException: Server.ClientConnectionInfo"
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22978307
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22978358
duplicate of: http://stackoverflow.com/q/218384
has body: so I am having a few errors in my code but Im not sure what they are telling me to change. This is my first linked list code. If anyone can help me out i would appreciate it. This is my linked list public class MyLinkedList&lt;E&gt; { private Node&lt;E&gt; head = null; public void add(E element) { if(size() == 0) { head = new Node&lt;E&gt;(element); return; } Node&lt;E&gt; cursor = head; while (cursor.next != null) { cursor = cursor.next; } cursor.next = new Node&lt;E&gt;(element); } public void add(int index, E element) { Node&lt;E&gt; cursor = head; E temp, before; for(int x = 0; x &lt; index; x++) { cursor = cursor.next; } before = cursor.content; cursor.content = element; while(cursor.next != null) { cursor = cursor.next; temp = cursor.content; cursor.content = before; before = temp; } add(before); } public boolean remove(E element) { Node&lt;E&gt; cursor = head; if (head.content == element) { head = cursor.next; return true; } while(cursor.next != null) { if (cursor.next.content == element) { cursor.next = cursor.next.next; } else { cursor = cursor.next; } } if (cursor.next == null) { return false; } return true; } public E remove(int index) { E result = null; if (index &lt; 0 || index &gt;= size()) { return null; } Node&lt;E&gt; cursor = head; for (int x = 0; x &lt; index; x++) { cursor = cursor.next; } result = cursor.content; cursor = head; for (int x = 0; x &lt; index - 1; x++) { cursor = cursor.next; } if(index != 0) { cursor.next = cursor.next.next; } else { head = cursor.next; } return result; } public E set(int index, E element) { Node&lt;E&gt; cursor = head; E temp; for (int x = 0; x &lt; index; x++) { cursor = cursor.next; } temp = cursor.content; cursor.content = element; return temp; } public boolean contains(E element) { Node&lt;E&gt; cursor = head; while(cursor != null) { if(cursor.content == element) { return true; } cursor = cursor.next; } return false; } public E get(int index) { Node&lt;E&gt; cursor = head; if (index &lt; 0 || index &gt;= size…
has comment: http://stackoverflow.com/comment/35089311
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35089176
has title: Java Linked list-NullPointerException
tagged with: linked-list
type: UnansweredQuestion
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/22978617
tagged with: list

http://stackoverflow.com/comment/35136302
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23004309
has text: @bgth He/she has used a JUnit annotation to check that the exception is thrown.

http://stackoverflow.com/a/23032816
type: Answer
accepted answer of: http://stackoverflow.com/q/23032662
answers question: http://stackoverflow.com/q/23032662
score: 0
type: AcceptedAnswer
has body: Right, it's null because (unless you haven't copied the code correctly), the line final String alice=table.get("Alice", "Smith"); Is called when the class is instantiated. However, your setTab() function presumably isn't called until sometime after that. You can fix this by not setting alice until after you have called setTab()

http://stackoverflow.com/q/23032235
type: Question
tagged with: jakarta-ee
tagged with: opencv
tagged with: java
linked to: http://stackoverflow.com/q/921262
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23032798
favorite count: 0
has body: I am having a jnlp file and a web application.My swing application file make use of a xml file in it.Now the problem is where to define that xml file inside jnlp code ? and also where to keep it in my project directory of web application in which am using that jnlp file of swing application.Please help. I am trying to get over it since one day,But didnt know how to do it.
tagged with: jnlp
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: swing
has title: Xml file in jnlp code not working

http://stackoverflow.com/comment/35196040
type: QuestionComment
comment on: http://stackoverflow.com/q/23019826
score: 0
has text: Thanks for your help guys I've updated the question with some more info. Sortirios I think it just creates a rectangle for me the constructor seems to work ok.
type: Comment

http://stackoverflow.com/comment/35206086
comment on: http://stackoverflow.com/a/23042783
score: 0
type: AnswerComment
has text: I thought that it will work only for the boolean logic inside the if statement, but yeah... I was wrong. Thanks so much again!
type: Comment

http://stackoverflow.com/a/30885935
has body: Network instability reappear code: con.query() sleep(10) //when sleep shutdown your network conn.roolback()
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23085302
upvote count: 1
score: 1

http://stackoverflow.com/a/23087307
has comment: http://stackoverflow.com/comment/35317528
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23086658
has body: If you want to write a simple text file, would be better if you use a BufferedWriter. For your content, you can format it in a StringBuffer or a StringBuilder if it is too long. Here in this post, I replied to a question related with the kind of formatting you're trying to make. But you should need to adapt it according to your format and the logic of using a wrapping array. Export array values to csv file java I think, the loop or "enhanced for" statement should be used as something like: for (ArrayList&lt;String&gt; innerArray: wrapperArray) { for (String word : innerArray) { //Adapt to your required format using a StringBuilder } } //Here at the end save the content of your StringBuilder or StringBuffer using the BufferedWriter. Hope you can get an idea on how to achieve this. Best regards :)
answers question: http://stackoverflow.com/q/23086658
type: Answer

http://stackoverflow.com/comment/35087007
has text: The only problem I'm getting is that I cant get the taregetted values
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22976886
score: 0

http://stackoverflow.com/comment/35277013
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23080209
has text: Don't be sorry, we were all noobs, and we all learn everyday :) You have to put one (not the both) line between `String delqty = qtyField.getText();` and the first `Integer.parseInt(delqty)`.
type: AnswerComment

http://stackoverflow.com/q/23000327
tagged with: java
downvote count: 2
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23000395
score: -1
has comment: http://stackoverflow.com/comment/35129107
has title: Array of 15 elements with possibility of entering specific number at a specific location?
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35129109
type: UnansweredQuestion
has body: I need an array of 15 elements with random numbers (1-15). I should enter a value at a specific location, but the values after my selected location should go on by one location. ex: I have 1 12 3 8 9 3 5 4 4 10 3 7 7 2 1 and I want to insert the number "5" at location 3 and now I should have 1 12 5 3 8 9 3 5 4 4 10 3 7 7 2 . You have an idea? Thanks in advance.

http://stackoverflow.com/comment/35335173
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23114806
has text: `Now when i pull the data from DB and it shows exact same way as it is in DB having html tags around it.` Could you ask a question? I can't understand this sentence.

http://stackoverflow.com/comment/35254163
has text: @BigT See the updated example in the answer. It operates on your `Login` class and produces the output you described. I have added a second `@HasUserPreferences` annotation that can be used to mark objects that should be recursively descended into and scanned. Note that no casting is necessary here. Also in my last comment when I wrote "you're trying to analyze", I meant "you actually want to analyze". Sorry.
type: AnswerComment
comment on: http://stackoverflow.com/a/23067387
score: 0
type: Comment

http://stackoverflow.com/a/23083794
has comment: http://stackoverflow.com/comment/35280286
has comment: http://stackoverflow.com/comment/35279999
upvote count: 1
has body: Could you please write the stack trace? It could be very useful in order to solve the problem. Without seeying it I can suppose that maybe you've incorrectly loaded the SQL JDBC driver and for this reason the program is unable to load the class.
type: Answer
downvote count: 2
has comment: http://stackoverflow.com/comment/35280090
has comment: http://stackoverflow.com/comment/35280410
has comment: http://stackoverflow.com/comment/35280637
score: -1
answers question: http://stackoverflow.com/q/23083702

http://stackoverflow.com/comment/35102930
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22985909
has text: Add [SSCCE](http://sscce.org) example to your post.

http://stackoverflow.com/comment/35170971
type: QuestionComment
has text: Out of curiousity, why are you reinventing this wheel? `ArrayList` grows (not doubles, IIRC it does the 150% thing) as necessary, why not use that?
score: 1
comment on: http://stackoverflow.com/q/23023079
type: Comment

http://stackoverflow.com/comment/35257306
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23070414
has text: I used a filechannel and bytebuffer then use the bytebuffer to write into a bytearray

http://stackoverflow.com/comment/35200324
type: AnswerComment
has text: Does it mean, those keys has to be in the HashMap while benchmarking or if it is not there then it is also fine?
type: Comment
comment on: http://stackoverflow.com/a/23039492
score: 0

http://stackoverflow.com/comment/35167158
score: 0
type: Comment
type: QuestionComment
has text: The pictures class code is up. "Pictures " Class.
comment on: http://stackoverflow.com/q/23020635

http://stackoverflow.com/comment/35375867
type: QuestionComment
comment on: http://stackoverflow.com/q/23127955
score: 0
has text: Not a single comment other than mine? strange
type: Comment

http://stackoverflow.com/a/23121206
score: 0
has body: For such big data file you should place it somewhere on file system rather storing it physically within web application.
type: Answer
answers question: http://stackoverflow.com/q/23121028

http://stackoverflow.com/comment/35078512
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22972135
has text: i aint getting the issue , i even tried to debug with the help of the breakpoints, but not of any use @PearsonArtPhoto

http://stackoverflow.com/comment/35089812
comment on: http://stackoverflow.com/a/22978378
score: 1
type: AnswerComment
type: Comment
has text: But you can do even better for the whole diff-operation that you are doing: Take a look at AJed's answer here: http://stackoverflow.com/questions/5283047/intersection-and-union-of-arraylists-in-java (third from the bottom)

http://stackoverflow.com/q/23103974
has answer: http://stackoverflow.com/a/23104024
has comment: http://stackoverflow.com/comment/35316320
has comment: http://stackoverflow.com/comment/35315805
has comment: http://stackoverflow.com/comment/35316209
has comment: http://stackoverflow.com/comment/35316117
score: 0
accepted answer: http://stackoverflow.com/a/23104353
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/35316137
has comment: http://stackoverflow.com/comment/35318289
has comment: http://stackoverflow.com/comment/35315938
has comment: http://stackoverflow.com/comment/35315842
has comment: http://stackoverflow.com/comment/35317697
has comment: http://stackoverflow.com/comment/35315747
has comment: http://stackoverflow.com/comment/35315968
answer count: 4
has answer: http://stackoverflow.com/a/23104049
has title: NullPointerException when accessing 2D array
has comment: http://stackoverflow.com/comment/35316610
has comment: http://stackoverflow.com/comment/35317634
has comment: http://stackoverflow.com/comment/35316267
possible better answer: http://stackoverflow.com/a/23104049
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35316539
has answer: http://stackoverflow.com/a/23104353
tagged with: java
has comment: http://stackoverflow.com/comment/35316012
has body: First, here is my function "setProduct" : public void setProduct(String code, int qty,double price,int nbrProduct){ System.out.println("Code = "+code); System.out.println("qty = "+qty); System.out.println("price = "+price); System.out.println("nbrProduct = "+nbrProduct); this.Produit[nbrProduct][0] = code; this.Produit[nbrProduct][1] = Integer.toString(qty); this.Produit[nbrProduct][2] = price+" €"; And now where I call : Commande_Final Commande = new Commande_Final(); Commande = Cmd; String name = Commande.getName(); double prixUnit = Function.GetMagPrice(radar,Qtyradar)/Qtyradar; System.out.println("j'affiche le radar : "+name); System.out.println("j'affiche le Qtyradar : "+Qtyradar); System.out.println("j'affiche le prix du radar : "+prixUnit+" €"); System.out.println("nbr de produit = "+nbr_de_Produit); Commande.setProduit(name,Qtyradar,prixUnit,nbr_de_Produit); My problem : I get an error when I do in "setProduct" => this.Produit[nbrProduct][0] = code; The error says "java.lang.NullPointerException", I guess its trying to put an empty value in "this.Produit[nbrProduct][0]" but the thing is when I do the "System.out.println("Code = "+code);" its show me the correct code and the same for all others attributs :/ EDIT : Here is how I create my Produit attribut : public String[][] Produit = new String[99][3]; EDIT 2 : stack trace : Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Commande_Final.setProduit(Commande_Final.java:33) at ZDialogInfo.Confirmer(ZDialogInfo.java:449) at ZDialogV2$29.actionPerformed(ZDialogV2.java:1037) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponen…
has answer: http://stackoverflow.com/a/23104058
has comment: http://stackoverflow.com/comment/35315981
has comment: http://stackoverflow.com/comment/35316016

http://stackoverflow.com/comment/35151259
score: 0
type: AnswerComment
type: Comment
has text: "&#x" is used to display unicode characters and it showuld be followed by a semicolon... here 'x' means hexadecimal dont forget to accept the answer if it helped
comment on: http://stackoverflow.com/a/23009782

http://stackoverflow.com/q/22999058
has comment: http://stackoverflow.com/comment/35126903
accepted answer: http://stackoverflow.com/a/22999402
has title: java Runtime.getRuntime().exec cannot get output for some commands
tagged with: bash
answer count: 1
downvote count: 0
score: 1
tagged with: macos
favorite count: 0
tagged with: terminal
tagged with: linux
has body: I am on OSX 10.8.5 and trying to run terminal commands from Java. So with the code below, I can read the output of Runtime.getRuntime().exec for some commands but not others. You will see that some commands return their output just fine like ls and ifconfig, but then trying to get openssl to return its output either returns nothing or hangs depending on the implementation. I have also used two different methods of reading the output but same results with both. What is preventing certain commands from returning any output? theCommand = "ls"; //this command works OK and returns its output //theCommand = "ifconfig"; //this command works OK and returns its output //theCommand = "openssl rand"; //this command does not return any output //theCommand = "/bin/sh openssl rand"; //this command does not return any output //theCommand = "/bin/sh -c openssl rand"; //this command hangs try { System.out.println("trying..."); Process extProc=Runtime.getRuntime().exec(theCommand); extProc.waitFor(); //READ ouput attempt #1 - this works okay for ls and ifconfig command //BufferedReader readProc=new BufferedReader(new InputStreamReader(extProc.getInputStream())); //while(readProc.ready()) { // theReadBuffer = readProc.readLine(); // System.out.println(theReadBuffer); //} //READ output attempt #2 - this works okay for ls and ifconfig command InputStream theInputStream = extProc.getInputStream(); java.util.Scanner theScanner = new java.util.Scanner(theInputStream).useDelimiter("\\A"); if (theScanner.hasNext()) { theReadBuffer = theScanner.next(); System.out.println(theReadBuffer); } } catch( IOException e) { System.out.println(e.getMessage()); } catch(InterruptedException e) { System.out.println(e.getMessage()); } I am ultimately trying to generate random characters from this command (which works in terminal): openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//' Thanks
has comment: http://stackoverflow.com/comment/35127261
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22999402

http://stackoverflow.com/comment/35197315
has text: It won't work at all without more setup, unless it's meant to be part of a webapp rather than a standalone program. You would need to define. An initial context factory and a context URL for a start. See the Oracle JBDI Tutorial for examples.
comment on: http://stackoverflow.com/q/23037845
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23079680
tagged with: svn
tagged with: java
tagged with: eclipse
has body: I use Eclipse + svn plugin. Also I have tortoise svn. I faced with unbelievable issue. I see that my eclipse plugin see that my version of project different by repository. I try to make commit and see following: then I go to file system and see that this files really exist, I delete it, then make refresh from eclipse and see that these files appear again. I tryed make: refresh project clean project team->Cleanup reconnect project restart eclipse remove project from Eclipse and filesystem. then download it again. and import to eclipse. I have not success. What the hell? How can I fix it? P.S. If I make update from tortoise svn - these files don't appear on my filesystem. Thus I think that this files stores in Eclipse cash. how to clean it?
score: 0
has title: Eclipse addes strange files to project. How to stop it?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35298579
has comment: http://stackoverflow.com/comment/35285365
type: Question

http://stackoverflow.com/q/22982734
score: 0
answer count: 2
tagged with: program-entry-point
tagged with: constructor
tagged with: jframe
possible better answer: http://stackoverflow.com/a/22982829
has answer: http://stackoverflow.com/a/22982829
has comment: http://stackoverflow.com/comment/35096657
has answer: http://stackoverflow.com/a/22982941
tagged with: java
has comment: http://stackoverflow.com/comment/35096642
tagged with: swing
has body: I have looked up a few different solutions, but I keep either getting a "Illegal Start of Expression" error or a "class, interface or enum expected" error. So I just want to make my JFrame class my main class, because currently my project has no main class. This is what the start of the code looks like: public class HotelGuiForm extends javax.swing.JFrame { public HotelGuiForm() { initComponents(); } and when I insert the Main class code, it just gets errors all over. Anyone able to help me out? EDIT: public class HotelGuiForm extends javax.swing.JFrame { public static void main(String[] args); { public HotelGuiForm() { initComponents(); } //Rest of Code } This gives me a illegal start of expression on the public HotelGuiForm(), and if I put the public static void main above the public class I get a missing class enum or interface.
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22982941
has comment: http://stackoverflow.com/comment/35096827
has title: How do I make my JFrame class my main class?

http://stackoverflow.com/a/23087716
has body: Searching over the internet, I found a way to test this feature. I figured out that I could test my AbstractJExcelView class implementation, based on this link. It basicaly creates the workbook created at the view, through the view's render method.
answers question: http://stackoverflow.com/q/23066803
accepted answer of: http://stackoverflow.com/q/23066803
type: AcceptedAnswer
type: Answer
score: 0

http://stackoverflow.com/comment/35111487
comment on: http://stackoverflow.com/q/22990750
type: Comment
has text: Looking at the code, the first thing I would do is declare this in BaseLine class `public synchronized void accumulate()`
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35328149
comment on: http://stackoverflow.com/a/23105606
type: Comment
has text: The bean is correctly created on each conversation, and correctly stays instanciated until the conversation is over. This I've observed by debugging the constructor and a @PostConstruct method.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23110615
score: 0
has comment: http://stackoverflow.com/comment/35327216
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35327377
has comment: http://stackoverflow.com/comment/35485019
has comment: http://stackoverflow.com/comment/35373789
type: Answer
has comment: http://stackoverflow.com/comment/35327537
has comment: http://stackoverflow.com/comment/35445242
accepted answer of: http://stackoverflow.com/q/23110211
has body: It sounds like you should be using remote chunking instead.
answers question: http://stackoverflow.com/q/23110211

http://stackoverflow.com/comment/35164514
comment on: http://stackoverflow.com/q/23019806
has text: What is Street = k.readString("Type in the Street: ");? street should be in lower case.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40759685
score: 0
type: Comment
type: QuestionComment
has text: If you actually look at the JSON, "genres" is an array of strings.
comment on: http://stackoverflow.com/q/23031999

http://stackoverflow.com/a/22989891
has body: You can make a HashMap&lt;String,Integer&gt;. If the String already appears in the map, increment its key by one, otherwise, add it to the map. For example: put("someValue", 1); Then, assume it's "someValue" again, you can do: put("someValue", get("someValue") + 1); Since the key of "someValue" is 1, now when you put it, the key will be 2. After that you can easily go through the map and extract the key that has the highest value. I didn't write a full solution, try to construct one, if you have problems post it in another question. Best practice is to learn by yourself.
has comment: http://stackoverflow.com/comment/120217929
upvote count: 7
type: Answer
answers question: http://stackoverflow.com/q/22989806
score: 6
downvote count: 1

http://stackoverflow.com/comment/35100347
type: Comment
comment on: http://stackoverflow.com/q/22984851
score: 0
type: QuestionComment
has text: You are using plain jdbc?. Kindly brief DAO Code.

http://stackoverflow.com/a/23036431
has comment: http://stackoverflow.com/comment/35196182
has comment: http://stackoverflow.com/comment/35195292
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35200165
type: Answer
accepted answer of: http://stackoverflow.com/q/23036395
has body: You can't know just by reading this code. But, the program will know at runtime which implementation to call : the object returned by AuthServiceApp.getInstance().getContext() will have a type, which one will have a single implementation of the method getService, and this implementation will be called. As a programmer, you don't need to know more. The programming by contract paradigm allows you not to bother about which implementation will be called. All you need to know is that given a certain environment, you will get an instance of a context on which you can call getService(), AND it will provide you with a service. The rest is details, you don't have to worry about it. Of course, when you are debugging, that's a different story : you want to know which implementation is executed as it might be buggy. In that case, just follow the debugger to see which code is really executed, but otherwise, you should not care, that's all what polymorphism is about : gaining abstraction.
has comment: http://stackoverflow.com/comment/35195247
score: 3
answers question: http://stackoverflow.com/q/23036395
upvote count: 3

http://stackoverflow.com/comment/35257098
has text: @DwB I didn't mean to suggest it was better than a loop, just an alternative.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23070341

http://stackoverflow.com/q/23094016
has title: Drawing mountains using 1px swing rectangles
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/23094064
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm trying to draw mountains background using 1-width rectangles (something like integrals). I randomize the first point to the very left of the screen, randomize binary number and draw the first rectangle. If binary number is 0, the next rectangle will be 1px lower. Else higher. And so on in the for loop. There's a 95% chance that in the next loop the direction won't change and it will keep going higher/lower. And 5% chance the direction will change. For this I'm using randomized number from 1 to 1000. public Landscape(Graphics g) { Graphics2D g2d = (Graphics2D)g; Random rand = new Random(); int first = rand.nextInt((800 - 200) + 1) + 200; g2d.fillRect(0, 800 - first, 1, first); int d = first % 2; for(int i = 1; i &lt;= 800; i++) { int choose = rand.nextInt((1000 - 1) + 1) + 1; if(choose &gt; 950) { d = -(d); } if(d == -1) { first += 1; } else { first -= 1; } g2d.fillRect(i, 800 - first, 1, first); } } That's the effect I get in like half cases. Sometimes however I get something like this: How is this possible? What's wrong here?
tagged with: swing
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/23094064
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/35338771
comment on: http://stackoverflow.com/a/23103450
has text: One difficulty with this approach is that it provides no indication to the caller as to whether the returned object may be persisted as a means of persisting its state.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35315571
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23102454
score: 0
has text: I strongly suggest using something like maven, even for a simple app, saves you a lot of headaches finding dependencies and jars on the internet.

http://stackoverflow.com/q/23118540
downvote count: 0
tagged with: java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/23118709
answer count: 1
favorite count: 0
has title: java.net.SocketException: Socket is closed
type: UnansweredQuestion
tagged with: sockets
has body: When a user connects to my server, I'm accepting the connection, storing the connected clients details in an arraylist then im trying to send that list to the client to create an asynchronous list. However, when I try to send the list it breaks the connection and causes the error; java.net.SocketException: Socket is closed My server class; while (true) { Socket clientSocket = serverSocket.accept(); ServerClientComs clientThread = new ServerClientComs(clientSocket); getUsername(clientSocket, clientThread); updateList(); try { clientThread.sendList(connections); clientThread.initialiseCommunication(); clientThread.start(); } catch (IOException error) { System.out.println("Server: Unable to initialise client thread! - " + error); } } ServerClientComs Class; public ServerClientComs(Socket clientSocket) { super(); this.client = client; this.clientSocket = clientSocket; } public void initialiseCommunication() throws IOException { output = new PrintWriter(this.clientSocket.getOutputStream(), true); input = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); } public void sendList(ArrayList connections) throws IOException { oos = new ObjectOutputStream(this.clientSocket.getOutputStream()); oos.writeObject(connections); oos.close(); } Been playing about with this for a good hour, getting annoying now. any help is greatly appreciated!
score: 2

http://stackoverflow.com/q/22970015
has answer: http://stackoverflow.com/a/23576561
has answer: http://stackoverflow.com/a/41861340
tagged with: maven-plugin
favorite count: 0
has answer: http://stackoverflow.com/a/29452262
type: UnansweredQuestion
answer count: 4
tagged with: build
has answer: http://stackoverflow.com/a/38745593
tagged with: java
tagged with: gradle
type: Question
score: 5
has body: Is there a gradle plugin to package Java Webstart (JWS) applications, similar to what Maven webstart plugin does? I need to automate at least the following tasks: jnlp descriptor generation based on an existing template, automatic adding project dependencies; jar signing based on the files described on jnlp file or project dependencies;
upvote count: 5
downvote count: 0
tagged with: java-web-start
has title: Is there a gradle plugin to package Java Webstart applications?

http://stackoverflow.com/q/23077326
tagged with: android
has body: I want to make a app to count the number of mobile devices under the current Wifi Access Point. But it seems there is no API for that.
has title: How to know the number of devices connecting to current Wifi AP (Android & iOS)
linked to: http://stackoverflow.com/q/11083369
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/23077841
has comment: http://stackoverflow.com/comment/35269387
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35269029
upvote count: 0
score: -2
tagged with: ios
favorite count: 0
has answer: http://stackoverflow.com/a/23079425

http://stackoverflow.com/q/23106936
has title: Java - Changing A JLabel With Texts Stored in An Array
downvote count: 0
linked to: http://stackoverflow.com/q/2432839
favorite count: 0
accepted answer: http://stackoverflow.com/a/23107479
tagged with: jlabel
has comment: http://stackoverflow.com/comment/35322160
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35321825
score: 1
tagged with: java
upvote count: 1
type: Question
has body: Hello World, Am kinda new to java and i am trying to create a method that changes a JLabel's text to some text stored in an array when an action happens, somthing like this : JLabel one = new JLabel("Hello World"); JButton b1 = new JButton("Next"); JButton b2 = new JButton("Prev"); String[] main = ["LoveLace","Dynamics","Creed","Main"]; b1.addActionListsner(new ActionListener() { actionPerformed(ActionEvent e) { //In here it will load the first indexed string which is "Lovelace" //This is where i need help //Think of it like a jQuery slider //When the next button is clicked, it loads a new word to the element //When the prev button is clicked it load the last indexed string of the array Please This is actually a manual word slider that is changes the text when the next button is clicked and loads the last indexed string of the array when the prev button is clicked, Please i dont hava any idea on how to do this, please help
has answer: http://stackoverflow.com/a/23107479
tagged with: arrays
possible better answer: http://stackoverflow.com/a/23108061
has answer: http://stackoverflow.com/a/23108061
answer count: 2

http://stackoverflow.com/q/23050556
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35220131
linked to: http://stackoverflow.com/q/6343166
has title: Whats wrong with this code? Whenever i try to click the button my application just stops responding? this is a post request code
has comment: http://stackoverflow.com/comment/35220120
score: 0
has answer: http://stackoverflow.com/a/23050655
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/9671546
has comment: http://stackoverflow.com/comment/35220140
tagged with: java
has body: Here is the my post request code. please help me debug this one. thanks. i can run my application but it doesnt give out errors. public void ibutton4Click() { { HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost("10.0.0.1/cgi-bin/ForwardPress.cgi"); try { HttpResponse response = client.execute(post); BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); String line = ""; while ((line = rd.readLine()) != null) { System.out.println(line); } } catch (IOException e) { startActivity(new Intent(this,MainActivity.class)); } } }
tagged with: post

http://stackoverflow.com/comment/35310922
comment on: http://stackoverflow.com/q/23101133
has text: why dont you use request scope?
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/comment/35091870
comment on: http://stackoverflow.com/q/22970921
type: QuestionComment
has text: You can use JWindow and provide your own controls
score: 0
type: Comment

http://stackoverflow.com/comment/35264952
has text: Sorry, the whole point of my unit test is to verify that the Spring Batch job does actually process all the items it receives into emails, and that those emails actually get sent using Amazon SES. The fact that this test is failing is a serious issue, because I need to ensure that SES can be used to send these emails.
comment on: http://stackoverflow.com/a/23074950
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23020493
has comment: http://stackoverflow.com/comment/35165893
has comment: http://stackoverflow.com/comment/35166202
linked to: http://stackoverflow.com/q/30130720
has title: Why is this method overloading ambiguous?
has comment: http://stackoverflow.com/comment/35167126
tagged with: java-6
tagged with: wrapper
has comment: http://stackoverflow.com/comment/35168771
answer count: 1
upvote count: 23
favorite count: 0
has comment: http://stackoverflow.com/comment/35166137
has comment: http://stackoverflow.com/comment/35166009
has body: public class Primitive { void m(Number b, Number ... a) {} // widening, autoboxing-&gt;widening-&gt;varargs void m(byte b, Number ... a) {} // unboxing, autoboxing-&gt;widening-&gt;varargs public static void main(String[] args) { Byte b = 12; Primitive obj = new Primitive(); obj.m(b, 23); } } I have already searched and found that widening priority is higher than unboxing, so in above method invocation, first method should have been called because second parameter is same for both. But this does not happen. Can u plz explain?
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35166155
score: 23
has answer: http://stackoverflow.com/a/23030789
tagged with: primitive
accepted answer: http://stackoverflow.com/a/23030789
has comment: http://stackoverflow.com/comment/35166101
has comment: http://stackoverflow.com/comment/35165896
type: Question
has comment: http://stackoverflow.com/comment/35165993
tagged with: overloading
linked to: http://stackoverflow.com/q/25768619

svn
tags question: http://stackoverflow.com/q/23103928
tags question: http://stackoverflow.com/q/23027175
type: Tag
tags question: http://stackoverflow.com/q/23077916
tags question: http://stackoverflow.com/q/23079892
tags question: http://stackoverflow.com/q/22999865
tags question: http://stackoverflow.com/q/22997636
tag name: svn
tags question: http://stackoverflow.com/q/23000068
tags question: http://stackoverflow.com/q/23078793
tags question: http://stackoverflow.com/q/23079680
tags question: http://stackoverflow.com/q/22986973

http://stackoverflow.com/comment/35195430
type: QuestionComment
has text: When you say 'read' do you mean 'put'?
comment on: http://stackoverflow.com/q/23036271
score: 0
type: Comment

http://stackoverflow.com/comment/56573283
score: 0
has text: This was really for the eclipse based IDE, but I suppose you can go to module settings and then look at the dependencies.
type: Comment
comment on: http://stackoverflow.com/a/26151468
type: AnswerComment

http://stackoverflow.com/q/23066864
tagged with: jsp
type: UnansweredQuestion
tagged with: spring
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35250154
type: Question
has body: I am looking for effective approach to put values from spring to jsp array. Right now, I have this working code var data = google.visualization.arrayToDataTable([ ['Date', '${campaign.answer1}', '${campaign.answer2}', '${campaign.answer3}'], &lt;c:forEach var="campaignsPerDay" items="${campaignsPerDay}"&gt; ['${campaignsPerDay.date}', ${campaignsPerDay.votes1}, ${campaignsPerDay.votes2}, ${campaignsPerDay.votes3}], &lt;/c:forEach&gt; ['Date', '10', '20', '30'] ]); But there is a problem, and it is the , at the end of this line ...{campaign.answer3}'], If I remove that hardcoded ['Date', '10', '20', '30'], it is not functionable, because it looks like this : var data = google.visualization.arrayToDataTable([ ['Date', 'No', 'Neutral', 'Yes'], ['Sun Apr 06 00:00:00 CEST 2014', 4, 1, 2], ['Mon Apr 07 00:00:00 CEST 2014', 3, 30, 15], ['Tue Apr 08 00:00:00 CEST 2014', 19, 5, 7], ]); The , on the last line ruins the well-formated code. I need this : var data = google.visualization.arrayToDataTable([ ['Date', 'No', 'Neutral', 'Yes'], ['Sun Apr 06 00:00:00 CEST 2014', 4, 1, 2], ['Mon Apr 07 00:00:00 CEST 2014', 3, 30, 15], ['Tue Apr 08 00:00:00 CEST 2014', 19, 5, 7] ]); I am able to solve this issue, but not in "nice" or "effective" way. What should be the best approach? I can pre-parse this in controller class if needed.
has comment: http://stackoverflow.com/comment/35250634
has comment: http://stackoverflow.com/comment/35250806
score: 0
has comment: http://stackoverflow.com/comment/35251223
has title: Effective way to parse list from spring to jsp array

jvm
tags question: http://stackoverflow.com/q/23093934
type: Tag
tags question: http://stackoverflow.com/q/23089700
tags question: http://stackoverflow.com/q/22971774
tags question: http://stackoverflow.com/q/23010505
tags question: http://stackoverflow.com/q/23021768
tags question: http://stackoverflow.com/q/23015219
tags question: http://stackoverflow.com/q/23106123
tag name: jvm
tags question: http://stackoverflow.com/q/23021894
tags question: http://stackoverflow.com/q/23083398
tags question: http://stackoverflow.com/q/23005455
tags question: http://stackoverflow.com/q/23086595
tags question: http://stackoverflow.com/q/23052155

http://stackoverflow.com/q/23068536
has title: Web cilent and server communication throught firewall
type: Question
tagged with: client-server
has body: I want to create a web application, which is divided into two part one is client and another is server. Client: Client part is on the shared server. Client is the GWT Application which only use to display data (containing only ui elements and ui events). Client application is used by server to view and present it's own data. Server: The server is the simple java web service (restlet). The server is reside behind the firewall. The server contains actual data. There are N number of servers. Server does not contains any view if server wants ro view data it will use the gwt client application. Every server uses same gwt application to view it's own data. Note : Client does not contains any address of the server. server will send the request to view it's data. There is no firewall inbound exception on server firewall to access server data from out side client I need to communicate client and server through firewall, Is there any architecture or design pattern to implement this type of application?
has answer: http://stackoverflow.com/a/23262552
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: firewall
tagged with: web-services
tagged with: gwt
tagged with: java

http://stackoverflow.com/q/23070905
answer count: 1
score: 1
tagged with: android
has answer: http://stackoverflow.com/a/23070953
has title: Nullpointerexception pointing to setonseekbarchangelistener
favorite count: 0
upvote count: 2
tagged with: android-seekbar
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23070953
has body: I am working on a senior capstone project in which I need to write an android app with no previous java experience. I spent the last week trying to figure this out myself but I'm stumped and need help. My MainActivity.java private static final String TAG = "Multispeaker"; private static final String DEVICE_ADDRESS = "&gt;&gt;ADDRESS HERE&lt;&lt;"; final int DELAY = 150; SeekBar SB1; SeekBar SB2; SeekBar SB3; SeekBar SB4; TextView sbv1; TextView sbv2; TextView sbv3; TextView sbv4; int vol1, vol2, vol3, vol4; long lastChange; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Amarino.connect(this, DEVICE_ADDRESS); SB1 = (SeekBar) findViewById(R.id.seekBar1); SB2 = (SeekBar) findViewById(R.id.seekBar2); SB3 = (SeekBar) findViewById(R.id.seekBar3); SB4 = (SeekBar) findViewById(R.id.seekBar4); sbv1 = (TextView) findViewById(R.id.textview1); sbv2 = (TextView) findViewById(R.id.textview2); sbv3 = (TextView) findViewById(R.id.textview3); sbv4 = (TextView) findViewById(R.id.textview4); SB1.setOnSeekBarChangeListener(this); SB2.setOnSeekBarChangeListener(this); SB3.setOnSeekBarChangeListener(this); SB4.setOnSeekBarChangeListener(this); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } protected void onStart() { super.onStart(); vol1 = 0; vol2 = 0; vol3 = 0; vol4 = 0; SB1.setProgress(vol1); SB2.setProgress(vol2); SB3.setProgress(vol3); SB4.setProgress(vol4); new Thread(){ public void run(){ try { Thread.sleep(6000); } catch (InterruptedException e) {} Log.d(TAG, "update colors"); updateAllColors(); } }.start(); } @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 h…
tagged with: java
type: Question

http://stackoverflow.com/comment/35356273
type: Comment
has text: It's a magic!=) Anyway i think, you do not need to reload shader on each frame. The basic of opengl is that all resource save it's state as long as you doesn't change it. If you no need to change some uniforms in program you need only bind it and draw.
type: AnswerComment
comment on: http://stackoverflow.com/a/23079234
score: 0

http://stackoverflow.com/a/23102615
type: Answer
has body: You can use FrameLayout: &lt;FrameLayout...&gt; &lt;com.ex.paper.HackyViewPager/&gt; &lt;Button/&gt; &lt;FrameLayout/&gt; In onCreate: setContentView(your.layout.with.frameLayout); mViewPager = (HackyViewPager) findViewById(R.id.view_pager); mButton = (Button) findViewById(R.id.button); mButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { wallpaper.setResource(sDrawables[mViewPager.getCurrentItem()]); } }); }
answers question: http://stackoverflow.com/q/23101612
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35313606
has comment: http://stackoverflow.com/comment/35313938
has comment: http://stackoverflow.com/comment/35313913
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35314015
accepted answer of: http://stackoverflow.com/q/23101612

http://stackoverflow.com/a/23000785
answers question: http://stackoverflow.com/q/22998260
upvote count: 8
type: Answer
has body: Groovy Solution: import java.text.NumberFormat def currencyAmount = 9876543.21 //Default is BigDecimal def currencyFormatter = NumberFormat.getInstance( Locale.US ) assert currencyFormatter.format( currencyAmount ) == "9,876,543.21" Don't need getCurrencyInstance() if currency is not requried.
downvote count: 2
score: 6
accepted answer of: http://stackoverflow.com/q/22998260
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/85087529

http://stackoverflow.com/a/49746227
type: Answer
has body: //done is button name=findViewById(R.id.txt_name); final String Name = name.getText().toString(); done.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(TextUtils.isEmpty(Name)) { name.setError("Field is req"); return; } }
answers question: http://stackoverflow.com/q/23054364
score: 0

opencv
type: Tag
tags question: http://stackoverflow.com/q/23107123
tags question: http://stackoverflow.com/q/23016194
tags question: http://stackoverflow.com/q/23029306
tags question: http://stackoverflow.com/q/22975965
tags question: http://stackoverflow.com/q/23032235
tags question: http://stackoverflow.com/q/22969179
tags question: http://stackoverflow.com/q/23110577
tags question: http://stackoverflow.com/q/23109389
tags question: http://stackoverflow.com/q/23114492
tags question: http://stackoverflow.com/q/23028037
tags question: http://stackoverflow.com/q/23055589
tag name: opencv
tags question: http://stackoverflow.com/q/23123336
tags question: http://stackoverflow.com/q/22970149
tags question: http://stackoverflow.com/q/23086596
tags question: http://stackoverflow.com/q/23079977
tags question: http://stackoverflow.com/q/22996192
tags question: http://stackoverflow.com/q/22971779
tags question: http://stackoverflow.com/q/23097339
tags question: http://stackoverflow.com/q/23095620
tags question: http://stackoverflow.com/q/23015475
tags question: http://stackoverflow.com/q/23080968
tags question: http://stackoverflow.com/q/23077978
tags question: http://stackoverflow.com/q/23054054
tags question: http://stackoverflow.com/q/22984465
tags question: http://stackoverflow.com/q/23086772

http://stackoverflow.com/comment/35187827
score: 1
comment on: http://stackoverflow.com/a/23032602
type: AnswerComment
has text: I suggest you DO NOT pass in the contact from the activity, and store it in the thread. This means that all the memory with the activity that started the thread (and it's entire View Hierarchy) cannot be garbage collected until the thread dies and is itself garbage collected. A better solution is to use a reference to the Application context - as it won't have the View hierarchy attached to it - and will continue to be alive anyway.
type: Comment

http://stackoverflow.com/q/23046017
tagged with: java
has comment: http://stackoverflow.com/comment/35401761
has comment: http://stackoverflow.com/comment/35211802
has title: doFilter method on java - null pointer exception on filterchain when session is invalidate
type: Question
upvote count: 4
has body: this is my java filter (doFilter method): public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; String uri = req.getRequestURI(); // context.log("Requested Resource::"+uri); if ((!req.isRequestedSessionIdValid() &amp;&amp; (uri.endsWith("Login.jsp") || uri.endsWith("LoginServlet")) || req.isRequestedSessionIdValid())) { // pass the request along the filter chain try { filterChain.doFilter(req, res); }catch (Exception e) { // TODO: handle exception e.printStackTrace(); res.sendRedirect("Logout"); } } else { res.sendRedirect("Logout"); // context.log("Unauthorized access request"); } } public void destroy() { } } I use this filter because i need to controll if the session is valid or not; this is useful in case of , after logout, if the back button of browser is pressed, automaticly it redirect the client on Login.jsp. The problem is on try catch module: infact without it, when i try to press back button the JVM give me the follow error: org.apache.jasper.JasperException: java.lang.NullPointerException at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:534) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:457) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at com.connection.filter.ServletFilter.doFilter(ServletFilter.java:41) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.Applicatio…
has answer: http://stackoverflow.com/a/23171109
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35233887
accepted answer: http://stackoverflow.com/a/23171109
tagged with: servlet-filters
downvote count: 1
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/35978056
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23072568
has text: can you please do session.setDebug(true); and post the protocol trace?
score: 0

http://stackoverflow.com/q/23103189
has comment: http://stackoverflow.com/comment/35314356
type: Question
has comment: http://stackoverflow.com/comment/35316925
answer count: 2
has comment: http://stackoverflow.com/comment/35316661
tagged with: android
tagged with: menu
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/23104982
has comment: http://stackoverflow.com/comment/35316378
has title: When launching settings from menu my app chrashes
has answer: http://stackoverflow.com/a/23105244
tagged with: settings
has body: I sat with this problem for about a day, I'm trying to add a menu where I should be able to launch settings I'm trying to create an Android application which should work as a controller for a RC car. I managed to create the menu but everytime I click on settings it chrashes. I have a lot of other code for the bluetooth connection and the controller itself, I don't know if it's relevant so I didn't post it but ask and I can post it :) xml/preferences.xml <?xml version="1.0" encoding="utf-8"?> <CheckBoxPreference android:key="@string/pref_key_antispin" android:summary="@string/pref_summary_antispin" android:title="@string/pref_title_antispin" android:defaultValue="true"/> <CheckBoxPreference android:key="@string/pref_key_speedlimit" android:summary="@string/pref_summary_speedlimit" android:title="@string/pref_title_speedlimit" android:defaultValue="false"/> <CheckBoxPreference android:key="@string/pref_key_lysstyring" android:summary="@string/pref_summary_lysstyring" android:title="@string/pref_title_lysstyring" android:defaultValue="true"/> <CheckBoxPreference android:key="@string/pref_key_kollisionssikring" android:summary="@string/pref_summary_kollisionssikring" android:title="@string/pref_title_kollisionssikring"/> Main_Activity.java @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()){ case R.id.menu_settings: Intent options1 = new Intent(this, SettingsFragment.class); startActivity(options1); return true; default: return super.onOptionsItemSelected(item); } } public static class SettingsFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Load the preferences from an XML resource addPreferencesFromResource(R.xml.preferences); } } menu/main.xml <item android:id="@+id/menu_settings" android:title="@string/menu_settings" android:o…
possible better answer: http://stackoverflow.com/a/23104982
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23105244
score: 0
tagged with: java

http://stackoverflow.com/comment/35184179
type: AnswerComment
comment on: http://stackoverflow.com/a/23029618
type: Comment
score: 0
has text: you are more or less on the right path and thank you for your kindness and help unfortunatlely still not working grrr i think i might go to bed been on this for few days and many hours...

http://stackoverflow.com/comment/35294887
has text: The biggest problem with the indexed list properties is the writing costs.
type: AnswerComment
comment on: http://stackoverflow.com/a/23091081
type: Comment
score: 1

http://stackoverflow.com/comment/35325306
type: QuestionComment
comment on: http://stackoverflow.com/q/23102862
type: Comment
score: 0
has text: No sir, my url **var myurl='PropertyTaxRegistration.html?PrintReport&assid='+value;** will be hidden it will not get show to end user, throught which i can pass my url and retrive data

http://stackoverflow.com/comment/35196754
type: Comment
comment on: http://stackoverflow.com/q/23037518
score: 2
has text: Why should I avoid custom exceptions?
type: QuestionComment

http://stackoverflow.com/q/23022341
has comment: http://stackoverflow.com/comment/35170240
has answer: http://stackoverflow.com/a/23024095
has comment: http://stackoverflow.com/comment/35170567
has comment: http://stackoverflow.com/comment/35169957
tagged with: jframe
has comment: http://stackoverflow.com/comment/35170515
tagged with: swing
has comment: http://stackoverflow.com/comment/35170218
type: AnsweredQuestion
has title: JPanel not updating when using invalidate, validate and repaint
tagged with: java
has comment: http://stackoverflow.com/comment/35170002
tagged with: updates
type: Question
has body: I have a problem that one of my JPanels doesn't update itself according to the window when its supposed too. I shall try and briefly explain whats happening. A list of characters is fed into an arraylist (named lookReply) from another class (this works as I've tested this) it then uses 2 iterations to assign each one to a coordinate in a square table made from JLabels. These JLabels are in the lookReplyGUIPanel JPanel. After a button is pressed new characters get loaded into the arraylist and it repeats itself. However the window does not show this update. I know they are getting fed into the JLabels through some tests but its just the updating of the window doesn't seem to be working. I am using invalidate, validate and repaint but it still doesn't work. Please see my code below for the parts needed. The first method called - deals with the arraylist then calls the other method. private void look() { //clear arrayList then add new lookReply to it lookReply.clear(); while (HumanUser.lookReply==null) { } for(int n = 0; n&lt;HumanUser.lookReply.length(); n++) { lookReply.add(HumanUser.lookReply.charAt(n)); } lookReply(); //UP TO HERE WORKS FINE screen.invalidate(); screen.validate(); screen.repaint(); } The method which deals with the JPanel in question. /** * Made up of several smaller JPanels each relate to 1 map position from the lookReply command. */ private JPanel lookReply() { JPanel lookReplyGUIPanel = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); Border blackline = BorderFactory.createLineBorder(Color.black); //Create a square table dependent on the radius of view. //Then fill each cell with the block retrieved from the lookReply arrayList. for(int y = lookReplyY; y&gt;0; y--) { for(int x = lookReplyX; x&gt;0; x--) {wall... //Then assign it to a variable which is used in the JLabel. String item = null; if (lookReply.size()!=0) { item = lookReply.get(x*y-1) + ""; } //ADD TO CHECK WHAT EACH ITEM IS AND USE THE RELEVENT PICTURE…
linked to: http://stackoverflow.com/q/22849557
tagged with: jpanel
has answer: http://stackoverflow.com/a/23024911
has comment: http://stackoverflow.com/comment/35171139
linked to: http://stackoverflow.com/q/16316132
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/23024911
possible better answer: http://stackoverflow.com/a/23024095

http://stackoverflow.com/q/23052079
type: AnsweredQuestion
tagged with: java
has body: I need to connect the server which is having a URL like this: https://www.abc.xxx/ When I tried to connect it through default httpClient, its throwing me SSL certificate exception. And I dont want to bypass SSL certificate also. Can somebody please let me know whats is the procedure to connect to web server which have self signed SSL certificate.Do I need to get the certificate/key from the server. If I get the key/certificate how to use that key while making HTTP request.
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/3761737
has answer: http://stackoverflow.com/a/23052978
tagged with: ssl
has comment: http://stackoverflow.com/comment/35223241
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35223179
has title: How to connect to the SSL server in android
favorite count: 0
accepted answer: http://stackoverflow.com/a/23052978
duplicate of: http://stackoverflow.com/q/3761737
tagged with: android
upvote count: 1

http://stackoverflow.com/comment/35256726
comment on: http://stackoverflow.com/q/23040957
type: Comment
has text: You say you want to **attach** a TST to a signed PDF. Do you want to attach using *integrated PDF signatures / timestamps according to ISO 32000-1, PAdES part 4, or ISO 32000-2*? Or do you want to attach using *enveloping timestamps according to RFC 5544 and RFC 5955*? Your question header indicates the latter while your question body seems to point towards the former. Those mechanisms are completely different.
type: QuestionComment
score: 0

http://stackoverflow.com/q/23058309
favorite count: 0
score: 33
type: Question
tagged with: cryptography
tagged with: aes
has body: Oracle has this to say about Java 8 with regards to AES-NI: Hardware intrinsics were added to use Advanced Encryption Standard (AES). The UseAES and UseAESIntrinsics flags are available to enable the hardware-based AES intrinsics for Intel hardware. The hardware must be 2010 or newer Westmere hardware. For example, to enable hardware AES, use the following flags: -XX:+UseAES -XX:+UseAESIntrinsics To disable hardware AES use the following flags: -XX:-UseAES -XX:-UseAESIntrinsics But it does not indicate if AES intrinsics are enabled by default (for processors that support it). So the question is simple: if the processor supports AES-NI, are AES intrinsics used? Bonus question: is there any way to test if AES-NI is being used? I guess you can guess based on performance, but that's not an optimal or sure fire way of testing. For readerS that are not familiar with AES-NI intrinsics: it's replacing byte code with pre-compiled machine code, using the AES-NI instruction set. This happens by the JVM, so it does not show up in the API of the Java runtime or bytecode.
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/23387314
tagged with: cpu
has answer: http://stackoverflow.com/a/23522689
has answer: http://stackoverflow.com/a/23387314
upvote count: 33
has title: AES-NI intrinsics enabled by default?
tagged with: jvm-hotspot
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23522689
downvote count: 0

http://stackoverflow.com/a/23005983
answers question: http://stackoverflow.com/q/23005825
has body: Instead of returning input streams from the service tier, can you pass the output stream into the method and have the service tier handle the streaming? Something like this: public void getBlobs(OutputStream stream); That way the service itself can handle the output and correctly close connections once the data has been streamed, it also means the consumer of the service doesn't need to worry about buffering the data correctly.
accepted answer of: http://stackoverflow.com/q/23005825
type: Answer
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23023302
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23023177
type: Answer
answers question: http://stackoverflow.com/q/23023177
has body: When you installed public JRE, java.exe was put into C:\WINDOWS\system32. But javac is not a part of JRE, so it is can be found only in C:\Program Files\Java\jdk1.6.0_37\bin. The solution is to place C:\Program Files\Java\jdk1.6.0_37\bin before C:\WINDOWS\System32 in PATH environment variable.
score: 0

http://stackoverflow.com/q/23018836
has answer: http://stackoverflow.com/a/55038629
downvote count: 0
upvote count: 129
linked to: http://stackoverflow.com/q/35657292
has answer: http://stackoverflow.com/a/31975575
has answer: http://stackoverflow.com/a/23029128
favorite count: 0
has answer: http://stackoverflow.com/a/51541093
accepted answer: http://stackoverflow.com/a/23083900
type: Question
has comment: http://stackoverflow.com/comment/121601934
has answer: http://stackoverflow.com/a/53588561
has answer: http://stackoverflow.com/a/74141796
has answer: http://stackoverflow.com/a/47624917
has answer: http://stackoverflow.com/a/51836685
has answer: http://stackoverflow.com/a/53044289
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/52696716
has title: org.hibernate.hql.internal.ast.QuerySyntaxException: table is not mapped
tagged with: glassfish-4
possible better answer: http://stackoverflow.com/a/47624917
has answer: http://stackoverflow.com/a/64052595
has comment: http://stackoverflow.com/comment/121595613
has answer: http://stackoverflow.com/a/61013912
has answer: http://stackoverflow.com/a/58641470
has answer: http://stackoverflow.com/a/40764036
has answer: http://stackoverflow.com/a/60387064
has answer: http://stackoverflow.com/a/50440869
tagged with: derby
has answer: http://stackoverflow.com/a/52731603
score: 129
has answer: http://stackoverflow.com/a/40372441
has answer: http://stackoverflow.com/a/71179781
has body: I have example web application Hibernate 4.3.5 + Derby database 10.10.1.1+ Glassfish4.0 with IDE NetBeans 8.0Beta. I have the next exception: Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: CUSTOMERV is not mapped at org.hibernate.hql.internal.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:189) at org.hibernate.hql.internal.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:109) at org.hibernate.hql.internal.ast.tree.FromClause.addFromElement(FromClause.java:95) at org.hibernate.hql.internal.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:331) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3633) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3522) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:706) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:562) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:299) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:247) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:278) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:206) ... 72 more Form from index.xhtml <h:panelGrid id="panel1" columns="2" border="1" cellpadding="5" cellspacing="1"> <f:facet name="header"> <h:outputText value="Add Customer Information"/> </f:facet> <h:outputLabel value="First Name:"/> <h:inputText value="#{customer.firstName}" id="fn"/> <h:outputLabel value="Last Name:"/> <h:inputText value="#{customer.lastName}" id="ln"/> <h:outputLabel value="Email:"/> <h:inputText value="#{customer.email}" id="eml"/> <h:outputLabel value="Date of Birth:"/> <h:inputText value="#{customer.sd}" id="s"/> <f:facet name="footer"> <h:outputLabel value="#{customer.msg}" id="msg" styleClass="msg"/> <h:comma…
answer count: 22
has answer: http://stackoverflow.com/a/74856629
has answer: http://stackoverflow.com/a/23083900
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/55917370

jdesktop
tag name: jdesktop
tags question: http://stackoverflow.com/q/23066328
type: Tag

http://stackoverflow.com/q/23049790
has answer: http://stackoverflow.com/a/23049912
linked to: http://stackoverflow.com/q/11828246
tagged with: java
type: Question
has body: I'm trying to make an app in Android Studio which requires you to download a file to the sdcard/Download/ folder on the users device. The problem is that when I enter the URL to download from and click Download, the app says "Unfortunately, * has stopped". I have quite a few files so here they are. First, heres the Manifest... &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.NautGames.xecta.app" &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.NautGames.xecta.app.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;/application&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;!-- Permission: Writing to SDCard --&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.READ_PHONE_STATE"/&gt; &lt;/manifest&gt; Heres the MainActivity class... package com.NautGames.xecta.app; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; //Chat bot library import org.alicebot.ab.Chat; import org.alicebot.ab.Bot; import android.view.View; import android.widget.Button; import android.os.Environment; import android.widget.TextView; public class MainActivity extends ActionBarActivity { TextView input; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } //EditText mEdit = (EditText)findViewById(R.id.editText1); public void buttonO…
score: 0
has comment: http://stackoverflow.com/comment/35218823
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35218773
tagged with: download
tagged with: android
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has title: "Unfortunately, ... has stopped" when Downloading file in Android

http://stackoverflow.com/comment/35332459
score: 1
comment on: http://stackoverflow.com/a/23113411
type: AnswerComment
type: Comment
has text: I think OP was using `,c,` as an example, and really wants to get everything after the *3rd* `,`. That still should be doable in a similar fashion, and I may have been mistaken.

http://stackoverflow.com/comment/35086720
comment on: http://stackoverflow.com/q/22976752
type: Comment
score: 2
has text: @tbodt Eclipse has many more plugins and better android support so, respectfully, no..
type: QuestionComment

http://stackoverflow.com/comment/35284580
score: 0
has text: Sadly, but I can't find also that dexedLibs folder in bin
type: AnswerComment
comment on: http://stackoverflow.com/a/23086025
type: Comment

http://stackoverflow.com/q/23019625
has answer: http://stackoverflow.com/a/23020886
type: AnsweredQuestion
score: 1
linked to: http://stackoverflow.com/q/9621308
tagged with: java
upvote count: 1
has body: Good day everyone,I have Java application that use JPA (EclipseLink) for database access-some CRUD operation.How i can make synhronization in that case ? I mean if two users User1 and User2 start application on they machine and User1 change some records how to make User2 see it ? Is there some opportunity make User2 know that User1 change record and update only that record ?. The same problems has discussed here How to synchronize multiple clients with a shared database (JPA)?. Updated data (in Database) is not visible via JPA/Eclipselink But the only what there suggest is to update by timer. Is it common way to do such things ? Thank you for your help [EDIT] Monitor MySQL inserts from different application How to make a database listener with java? change notification on domain objects (Hibernate/Java) Show me direction in resolving my problem .Hope can help somebody.
linked to: http://stackoverflow.com/q/11458091
type: Question
tagged with: database
has title: Database synchronization techniques JPA / GUI
linked to: http://stackoverflow.com/q/22772980
linked to: http://stackoverflow.com/q/7175044
linked to: http://stackoverflow.com/q/4594955
tagged with: eclipselink
tagged with: jpa
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/1639020
tagged with: synchronization
accepted answer: http://stackoverflow.com/a/23020886
favorite count: 0

http://stackoverflow.com/comment/35074156
comment on: http://stackoverflow.com/a/22969907
score: 0
type: Comment
type: AnswerComment
has text: It does allow initialisation but the scoping rules of if statements override that. This all leads to better program stability.

http://stackoverflow.com/q/23004879
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: executing another program from a Java program
tagged with: java
has comment: http://stackoverflow.com/comment/35136969
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/35136857
favorite count: 0
score: 1
tagged with: exec
has body: Is there any way to execute the .class file of a program from another Java program. Earlier I used Runtime.getRuntime().exec("cmd.exe /c C:\\file.jar") where file.jar was created in eclipse using the export option and selecting "Runnable jar" in it. But whenever I try to execute the base program that is executing the above given command, it terminates immediately. the file.java program is working fine. But I don't know why getRuntime.exec() is terminating without calling it. Can there be some problem in the .jar file ?

apache-poi
tags question: http://stackoverflow.com/q/22992015
tags question: http://stackoverflow.com/q/22995544
tags question: http://stackoverflow.com/q/22994875
tags question: http://stackoverflow.com/q/22996089
type: Tag
tags question: http://stackoverflow.com/q/22992758
tags question: http://stackoverflow.com/q/22990348
tags question: http://stackoverflow.com/q/23013023
tags question: http://stackoverflow.com/q/22971855
tags question: http://stackoverflow.com/q/23088064
tags question: http://stackoverflow.com/q/22997430
tags question: http://stackoverflow.com/q/23020717
tags question: http://stackoverflow.com/q/23062963
tags question: http://stackoverflow.com/q/23004545
tag name: apache-poi
tags question: http://stackoverflow.com/q/23112924
tags question: http://stackoverflow.com/q/23080945
tags question: http://stackoverflow.com/q/23114397

http://stackoverflow.com/a/23088501
has body: You can use Recursion, It would be like this for example: public void sampleFunction(int size) { //Stop Condition if(size = 0) { System.out.println("END LOOP"); System.out.println(array[size]); } else { System.out.println(array[size]); sampleFunction(size-1); } }
score: 0
answers question: http://stackoverflow.com/q/23087889
type: Answer

http://stackoverflow.com/a/23123189
answers question: http://stackoverflow.com/q/23072353
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35384899
has comment: http://stackoverflow.com/comment/35384782
downvote count: 1
has body: I'm gonna answer my own question. If I've made any errors or misinterpreted or misinformed, I hope to find out from someone. Question in advance: Did I mess anything up below? Key bindings provide the only way to do some things. For instance... I needed a keypress to cause the bottom line of a textarea to be displayed regardless of which component has the focus and to then select the contents of the 'main' textbox. The statements below link the physical F2 keypress to a logical button on the form, whose action will be defined in a class (named JumpToEndOfOutput) that extends AbstractAction, as required by getActionMap. txaOutput.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(getKeyStroke("F2"), "jumpToEndOfOutput"); txaOutput.getActionMap().put("jumpToEndOfOutput", jumpToEndOfOutput); (note use of WHEN_IN_FOCUSED_WINDOW, without which F2 can't always do what's needed): // in constructor for form... make action listener for button btnJumpToEndOfOutput.addActionListener( new ButtonListener() ); ... // inner class avoids anonymous inner class, for clarity class ButtonListener implements ActionListener // simulates click of logical form button { public void actionPerformed( ActionEvent bp ) { txaOutput.selectAll(); txtPattern.grabFocus(); txtPattern.select(0, 99); } } ... // back to constructor... make action object to listen for F2 keystroke JumpToEndOfOutput jumpToEndOfOutput = new JumpToEndOfOutput(); ... // class required for getActionMap class JumpToEndOfOutput extends AbstractAction // catches physical F2 keystroke { public void actionPerformed(ActionEvent e) { btnJumpToEndOfOutput.doClick(); } } Is there a shorter way to accomplish this?
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/23072353

http://stackoverflow.com/comment/113917113
comment on: http://stackoverflow.com/a/64422241
type: Comment
score: 3
type: AnswerComment
has text: Although this code might solve the problem, a good answer should also explain **what** the code does and **how** it helps. You can use the edit link below your answer to improve the post.

http://stackoverflow.com/q/22981137
tagged with: google-maps
has comment: http://stackoverflow.com/comment/35108995
downvote count: 0
score: 1
favorite count: 0
tagged with: android
has title: Does google maps API support real time navigation
has comment: http://stackoverflow.com/comment/35153255
answer count: 0
type: UnansweredQuestion
upvote count: 1
has body: I'm doing a MobilePhone APP which could simplified as: Dynamically add some map Markers (POI) based on client's location. Client can click one of the POI to start a navigation During the way to the POI, the Markers could changes, like colors or sth. Adding/changing the markers is quite simple for current API, but regarding the navigation, I searched a lot and even didn't have a firm answer if it supported, anyone help to give some hint?
has comment: http://stackoverflow.com/comment/35130940
tagged with: java
tagged with: google-maps-api-3
type: Question

http://stackoverflow.com/comment/35138788
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23005558
has text: Try using `<%@page contentType="text/xml;application/json"%>`. I haven't tried it. But, still. Give it a try :)

http://stackoverflow.com/comment/35231147
has text: Which BS implementation are you talking about ?
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23056755

http://stackoverflow.com/q/22979514
type: Question
has body: MainActivity.java package com.example.myfirstapp; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.EditText; import android.content.Intent; public class MainActivity extends Activity { public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @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; } /** Called when the user clicks the Send button */ public void sendMessage(View view) { Intent intent = new Intent(this, DisplayMessageActivity.class); EditText editText = (EditText) findViewById(R.id.edit_message); String message = editText.getText().toString(); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent); } } activitymain.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" &gt; &lt;EditText android:id="@+id/edit_message" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content" android:hint="@string/edit_message"/&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_send" android:onClick="sendMessage" /&gt; &lt;/LinearLayout&gt; DisplayMessageActivity.java import android.support.v7.app.ActionBarActivity; import android.support.v4.app.Fragment; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; public class DisplayMessageActivity extend…
has answer: http://stackoverflow.com/a/22979582
tagged with: java
tagged with: sendmessage
tagged with: illegalstateexception
answer count: 3
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/34623095
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/42731626
has title: Could not find a method sendMessage(View) in the activity class
tagged with: android-activity
downvote count: 0
score: 1
tagged with: methods

http://stackoverflow.com/comment/35318759
comment on: http://stackoverflow.com/a/23105768
type: Comment
has text: If you get more than 100 primes, this fails. You're not supposed to know in advance how many primes you will find, IMHO.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35417631
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23111322
has text: Here is the related discussion in Restlet mailing list: http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3076621

http://stackoverflow.com/q/23031837
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23031912
has comment: http://stackoverflow.com/comment/35186434
tagged with: android
has comment: http://stackoverflow.com/comment/35186322
possible better answer: http://stackoverflow.com/a/68328111
type: AnsweredQuestion
has body: I'm trying to make a login with PHP and MySQLi for Android. What I don't understand is how to keep the user logged in? I saw a simple tutorial where someone used SQLite to safe information but I'm not aware if that is really secure way. How should I save the user information to keep the users logged in? Thank you.
has answer: http://stackoverflow.com/a/68328111
score: 7
tagged with: java
upvote count: 7
has title: Android - Keep user logged in
type: Question
has answer: http://stackoverflow.com/a/23031912

http://stackoverflow.com/comment/35213845
type: Comment
has text: But why assign `byte` values to `float` array elements?
comment on: http://stackoverflow.com/a/23046873
type: AnswerComment
score: 0

http://stackoverflow.com/comment/57897456
score: 0
type: AnswerComment
has text: Yes, Date.parse() is deprecated, so it's better to use something like http://stackoverflow.com/a/12042621/2914140.
type: Comment
comment on: http://stackoverflow.com/a/22990132

http://stackoverflow.com/q/23047881
answer count: 2
has comment: http://stackoverflow.com/comment/35215311
accepted answer: http://stackoverflow.com/a/23047945
score: 2
downvote count: 0
tagged with: integer
favorite count: 0
has title: How do I take only integer inputs (with only scanner class and if and else statement or while loops if possible - no booleans)?
upvote count: 2
has comment: http://stackoverflow.com/comment/35215304
possible better answer: http://stackoverflow.com/a/23048053
has answer: http://stackoverflow.com/a/23048053
has answer: http://stackoverflow.com/a/23047945
type: AnsweredQuestion
has body: Here is my code that I have so far: import java.util.Scanner; public class Whatever{ public static void main(String[] args) { Scanner keyboard = new Scanner (System.in); System.out.println("How many pigs are there?"); int number = Integer.parseInt( keyboard.nextLine() ); int continueProgram = 0 while(continueProgram == 0) { if (number&gt;= 0 &amp;&amp; number &lt;= 32767) { do this; continueProgram++; }else{ do this; } I have to use integer.parseInt for the rest of my code to work so I can't change that. Any ways to take only integers rather than letters? My code produces errors because if I input a letter, parseInt will produce red errors rather than output a string like "try again. input numbers please" or something like that.
tagged with: java
tagged with: loops
type: Question

http://stackoverflow.com/q/23050922
type: Question
tagged with: java
has title: Java array help (fixed)
score: 0
has body: I posted a question earlier without trying it out because I was so lost. I tried it out and got some of it done using Google. Here are the questions: -- Write a method sumWithoutSmallest that computes the sum of an array of values, except for the smallest one, in a single loop, update the sum and the smallest value. After the loop, return the difference. Add a method removeMin to the previous question that removes the minimum score. Prompt the user to enter the size of your array, and then use a random number generator to generate different integer numbers to initialize your array. -- Here's what I have: -- public class Test { public static void main(String[] args) { sumWithoutSmallest(); } public static int sumWithoutSmallest() { int numbers[] = {1,2,3,4,5,6,7,8,9,10}; int smallestNum = Integer.MAX_VALUE; int sum = 0; for (int i : numbers) { if(smallestNum &gt; i) smallestNum = i; sum=sum+i; } sum=sum-smallestNum; System.out.println(sum); return sum - smallestNum; } } -- I'm stuck on the 2nd question. How I understand it, it's asking me to remove the element with the lowest value, but is it even possible to do so? Thanks
tagged with: random
answer count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/23050988
accepted answer: http://stackoverflow.com/a/23050988
type: AnsweredQuestion
tagged with: loops

http://stackoverflow.com/comment/35225342
comment on: http://stackoverflow.com/a/23053403
type: Comment
has text: You can remove that there is no harm in it and this above program is working fine..
score: 0
type: AnswerComment

http://stackoverflow.com/a/39626427
has body: I use the SQLite Integer type and convert like so: BigDecimal bd = new BigDecimal("1234.5678"); int packedInt = bd.scaleByPowerOfTen(4).intValue(); // packedInt now = 12345678 Now save packedInt to SQLite Integer field. To go back to BigDecimal: BigDecimal bd = new BigDecimal(packedInt); // bd = 12345678 bd = bd.scaleByPowerOfTen(-4); // now bd = 1234.5678
score: 3
downvote count: 1
upvote count: 4
answers question: http://stackoverflow.com/q/23023706
type: Answer

http://stackoverflow.com/comment/35188782
comment on: http://stackoverflow.com/q/23033072
score: 0
type: Comment
has text: m, when app started, viewpager loads all fragments in background, but not only first (or selected).
type: QuestionComment

http://stackoverflow.com/comment/35219152
type: AnswerComment
comment on: http://stackoverflow.com/a/23049345
type: Comment
has text: @Salauyou: indeed -- so inefficient! 1+
score: 0

http://stackoverflow.com/comment/35315812
comment on: http://stackoverflow.com/q/23103088
type: Comment
type: QuestionComment
score: 1
has text: Hm... you might be mixing up two different ways of using Jetty. One is for web applications and one is for defining single servlet based applications. Would be nice to see complete bootstrap code. I have not that many experience with Jetty, but looking at the JavaDoc you should not be working with `ServletContext` if you are creating `WebAppContext` (http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/servlet/ServletContextHandler.html#addServlet%28java.lang.Class,%20java.lang.String%29).

http://stackoverflow.com/a/23064248
has comment: http://stackoverflow.com/comment/35258191
score: 0
answers question: http://stackoverflow.com/q/23064017
type: Answer
has comment: http://stackoverflow.com/comment/35296056
has body: I believe the @ variables are used in stored procedures only... Either you define a stored procedure or you can use the second option : final String dbQuerry = "INSERT INTO test_table (TID, CREATED, OWNER, TITLE)\n" + "VALUES (?,?,?,?)\n" + "ON DUPLICATE KEY UPDATE\n" + "CREATED=?, OWNER=?, TITLE=?"; PreparedStatement st = mDBConnection.prepareStatement(dbQuerry); st.setInt(1, Integer.valueOf(t.getParam("ID"))); st.setString(2, t.getParam("Date")); st.setString(5, t.getParam("Date")); st.setString(3, t.getParam("User")); st.setString(6, t.getParam("User")); st.setString(4, t.getParam("Title")); st.setString(7, t.getParam("Title"));

http://stackoverflow.com/comment/35372672
has text: This makes sense, but the point is if getJoinPart is null its OK that is the last item in the list, if getJoinPart is Not NUll then there should be another item on the list. Otherwise it is considered as invalid.
comment on: http://stackoverflow.com/a/23127224
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35364627
score: 0
has text: possible duplicate of [How is driver class located in JDBC4](http://stackoverflow.com/questions/18288058/how-is-driver-class-located-in-jdbc4)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23127915

http://stackoverflow.com/comment/35229401
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23055713
has text: what's your root path.

http://stackoverflow.com/q/23099950
tagged with: java
has answer: http://stackoverflow.com/a/23104268
has title: java get next few words in string
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/23100598
possible better answer: http://stackoverflow.com/a/23100000
has answer: http://stackoverflow.com/a/23100000
tagged with: search
accepted answer: http://stackoverflow.com/a/23099998
has comment: http://stackoverflow.com/comment/35309006
score: 2
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/35309012
favorite count: 0
upvote count: 2
has body: I am trying to search a .txt file that contains HTML in it. I need to search the file for specific HTML tags, then grab the following next few characters of code. I am new to java, but am willing to learn what I need to. For example: Say I have the code: Apr 13 and all I need is the date(Apr 13). How do I go about doing this? Thanks a lot!
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23099998

http://stackoverflow.com/q/23060856
score: 1
tagged with: java
tagged with: xslt
type: Question
tagged with: eclipse
has body: Lets say, we have a input XML, which needs to be transformed into output XML(for the sake of discussion, let consider it as output HTML) using some XSL file, this transformation is triggered from java code using javax.xml.transform.Transformer and invoking its Transformer.transform(Source xmlSource, Result outputTarget) method. My question is, In this situation is there any way to debug the XSL tranformation(I mean any facility where I can set break-point in XSL file as well as in Java class). I know XSLT debugging is available in eclipse but that doesn't suffice above situation,I guess(since it only talk about input xml and xsl file, Anyway you can correct me If I am wrong)
upvote count: 1
favorite count: 0
has title: debugging xslt transformation which is invoked from java using eclipse
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35320232
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/35320750

http://stackoverflow.com/comment/35313767
score: 0
type: Comment
type: QuestionComment
has text: @user3413705 I don't see how it will be easier in your case. If the first line is different from the others, then you'll probably access it differently anyway.
comment on: http://stackoverflow.com/q/23096698

http://stackoverflow.com/comment/35348552
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23120628
has text: i just cant call them from actionPreformed

http://stackoverflow.com/comment/35281304
type: AnswerComment
has text: 1.9 is certainly not dependent on 1.8. Are you depending on another package that depends on 1.8? Maybe you are missing an exclusion @GirlyGirl.
score: 0
comment on: http://stackoverflow.com/a/23047186
type: Comment

http://stackoverflow.com/comment/35146443
type: Comment
has text: @kubagruszka in that case: Why the heck are you still using Eclipse when Intellij seems to be available?
comment on: http://stackoverflow.com/a/23007232
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35214711
type: AnswerComment
type: Comment
score: 0
has text: @user3529614 that is separate question. If this answer helps accept the same by clicking on the tick next to it. Post a new question and i will be happy to answer. Comment section is not for asking or posting codes
comment on: http://stackoverflow.com/a/23046848

http://stackoverflow.com/comment/35254978
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23069397
has text: @user2864740 Sorry, I'm really new to Java so I am not always sure what I need to post for people to help. I said what the code on line 615 is, but here is the code again `cTeams[t].name = listConf.getSelectedValue().toString();`

http://stackoverflow.com/comment/35163098
has text: because `[]` is more common than `...` and sometimes a bit easier to explain...but of course both work
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23019064
score: 0

http://stackoverflow.com/comment/35094771
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22980193
has text: FYI: `Persistence.createEntityManagerFactory("dieselPriceMapPU").createEntityManager();` works fine

http://stackoverflow.com/comment/35281250
type: QuestionComment
has text: @corsair992: you have actually tested and confirmed this?
score: 0
comment on: http://stackoverflow.com/q/23005656
type: Comment

web-services
type: Tag
tags question: http://stackoverflow.com/q/23059803
tags question: http://stackoverflow.com/q/23015985
tags question: http://stackoverflow.com/q/23124360
tags question: http://stackoverflow.com/q/23080384
tags question: http://stackoverflow.com/q/23113463
tags question: http://stackoverflow.com/q/23068260
tags question: http://stackoverflow.com/q/23064750
tags question: http://stackoverflow.com/q/23126615
tags question: http://stackoverflow.com/q/23010399
tags question: http://stackoverflow.com/q/23071463
tags question: http://stackoverflow.com/q/23022867
tags question: http://stackoverflow.com/q/22991830
tags question: http://stackoverflow.com/q/23071106
tags question: http://stackoverflow.com/q/23068536
tags question: http://stackoverflow.com/q/23128951
tags question: http://stackoverflow.com/q/23077649
tags question: http://stackoverflow.com/q/23125068
tags question: http://stackoverflow.com/q/23076478
tags question: http://stackoverflow.com/q/22984450
tags question: http://stackoverflow.com/q/23067383
tags question: http://stackoverflow.com/q/23104740
tags question: http://stackoverflow.com/q/22990290
tags question: http://stackoverflow.com/q/22987962
tags question: http://stackoverflow.com/q/23077456
tags question: http://stackoverflow.com/q/22972418
tags question: http://stackoverflow.com/q/23127529
tags question: http://stackoverflow.com/q/23118422
tags question: http://stackoverflow.com/q/22994690
tags question: http://stackoverflow.com/q/23122601
tags question: http://stackoverflow.com/q/23070572
tags question: http://stackoverflow.com/q/23057548
tags question: http://stackoverflow.com/q/23078310
tags question: http://stackoverflow.com/q/22983034
tags question: http://stackoverflow.com/q/23103706
tags question: http://stackoverflow.com/q/23043324
tags question: http://stackoverflow.com/q/23003505
tags question: http://stackoverflow.com/q/23105706
tags question: http://stackoverflow.com/q/23102599
tags question: http://stackoverflow.com/q/22972170
tags question: http://stackoverflow.com/q/22974969
tags question: http://stackoverflow.com/q/22971613
tags question: http://stackoverflow.com/q/23055355
tags question: http://stackoverflow.com/q/22971871
tags question: http://stackoverflow.com/q/22997318
tags question: http://stackoverflow.com/q/23005458
tags question: http://stackoverflow.com/q/23108223
tags question: http://stackoverflow.com/q/23092890
tag name: web-services
tags question: http://stackoverflow.com/q/23005805
tags question: http://stackoverflow.com/q/22987980
tags question: http://stackoverflow.com/q/23025147
tags question: http://stackoverflow.com/q/23023611
tags question: http://stackoverflow.com/q/23089286
tags question: http://stackoverflow.com/q/23117879
tags question: http://stackoverflow.com/q/23101727
tags question: http://stackoverflow.com/q/23092288
tags question: http://stackoverflow.com/q/23098794
tags question: http://stackoverflow.com/q/22979551
tags question: http://stackoverflow.com/q/23113144
tags question: http://stackoverflow.com/q/22990874
tags question: http://stackoverflow.com/q/22968539
tags question: http://stackoverflow.com/q/23059455

http://stackoverflow.com/comment/35355341
has text: @Tarlune you can also look at the source. http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.2_r1/android/app/Activity.java/. There is no constructor. But i don't see anything wrong other than that.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23125418

http://stackoverflow.com/a/23117605
score: 3
upvote count: 3
has body: The default behavior for a JPA EntityManager is to flush and commit in the end of any transaction it participates - being it a normal PersistenceContext (your case) or an extended one. Also, the default behavior for an EJB is to be transactional on all public methods (with propagation REQUIRED), meaning it will create a transaction if one does not exists. Your property changes are committed every time because there's a transaction every time on your BannerService (it's an EJB). I would suggest annotating the buscarBanners() method on BannerService with @TransactionAttribute(TransactionAttributeType.SUPPORTS)
accepted answer of: http://stackoverflow.com/q/23108597
answers question: http://stackoverflow.com/q/23108597
has comment: http://stackoverflow.com/comment/35341094
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35345207
has text: I don't even see where randomization comes in. Alternate != randomize.
score: 1
comment on: http://stackoverflow.com/q/23120039
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35279432
type: AnswerComment
comment on: http://stackoverflow.com/a/23083276
has text: I agree with you Deepak, but still we need to move the cursor to the last and then do the getRow to get the count in case of a scrollable result set. May be what you are saying is correct, "it may decide to optimize the fetch and only return say the first X rows", still it should return that X count.
type: Comment
score: 0

http://stackoverflow.com/q/23090201
has title: Watching a Directory for Changes Java.nio.file
tagged with: java
tagged with: watchservice
tagged with: file
has answer: http://stackoverflow.com/a/23090424
type: Question
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/35291771
has comment: http://stackoverflow.com/comment/35291980
has body: I know java.nio.file could provide ways to watch file's change like new file ,modify and delete . but now I wonder if there's a way to watch if the directory is being entered or one file being opened by some app like a editor. I've read the API docs, and could find no way to achieve this. Can anyone give a clue about this, maybe other API doc rather than java.nio.file which could provide a way to work around this.
type: UnansweredQuestion

http://stackoverflow.com/comment/35396142
type: Comment
comment on: http://stackoverflow.com/a/23129369
has text: stil getting error on equalizeHist of `invalid argument` on this line `equalizeHist(sChannels[i], sChannels[i]);` using the last part of program
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35257313
score: 1
has text: OP's assignment is to use an array. Although your suggestion is the better solution for an actual program, it might not be acceptable for OP to hand in (probably has not covered `Maps`, among other things).
type: AnswerComment
comment on: http://stackoverflow.com/a/23070837
type: Comment

http://stackoverflow.com/comment/35328880
comment on: http://stackoverflow.com/a/23111226
type: AnswerComment
has text: Sorry it was not my attention to argue against what you wrote. I would just underline that you can never be sure to hide any secret within your android apps, or iOS for that matter.
score: 0
type: Comment

http://stackoverflow.com/q/23119612
has comment: http://stackoverflow.com/comment/35344389
score: -1
has answer: http://stackoverflow.com/a/23120016
upvote count: 0
has comment: http://stackoverflow.com/comment/35344319
answer count: 1
accepted answer: http://stackoverflow.com/a/23120016
linked to: http://stackoverflow.com/q/11093326
favorite count: 0
has comment: http://stackoverflow.com/comment/35344240
has comment: http://stackoverflow.com/comment/35344282
tagged with: swing
type: AnsweredQuestion
tagged with: joptionpane
tagged with: java
has title: JOptionPane InputMismatchException
downvote count: 1
type: Question
has body: i am building a simple chat application and i'm thinking to set the server address and port through JOptionPane, what i want to do is to check that the user is not entering letters in when setting up the port number, int port=Integer.parseInt(JOptionPane.showInputDialog("Please insert the default port!"); i tried to handle it with a try/catch block but it didn't worked, any suggestions?

http://stackoverflow.com/q/23090043
tagged with: java
has comment: http://stackoverflow.com/comment/35291357
type: Question
upvote count: 0
has title: For loop through an Array in Java
tagged with: arrays
possible better answer: http://stackoverflow.com/a/23090067
has comment: http://stackoverflow.com/comment/35291435
favorite count: 0
has comment: http://stackoverflow.com/comment/35291390
has answer: http://stackoverflow.com/a/23090067
has answer: http://stackoverflow.com/a/23090066
has body: I am trying to write a for loop to iterate from a specific index range. So if a I have an array called data[] with length 10, and I only want to iterate from the 3rd position (index 2) to the 9th position (index 8), how could I go about writing that loop structure? The sample code is below: //Trying to iterate from index 2 - 9 for(int i=0; i&lt;data.length &amp;&amp; i&gt;2 &amp;&amp; i&lt;9; i++) { System.out.println(data[i]); } Thanks in advance
score: -3
has comment: http://stackoverflow.com/comment/35291407
answer count: 4
downvote count: 3
has answer: http://stackoverflow.com/a/23090072
tagged with: indexing
accepted answer: http://stackoverflow.com/a/23090066
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23090145

http://stackoverflow.com/comment/35121896
has text: value/2 i.e 2/2=1 right ?!
comment on: http://stackoverflow.com/q/22996323
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22989999
has title: casting with Soap Web service return Map getting error
tagged with: soap
answer count: 0
has comment: http://stackoverflow.com/comment/35109796
tagged with: java
type: Question
has body: java.lang.ClassCastException: org.apache.xml.xml_soap.Map cannot be cast to java.util.Map at com.client.nsf.PatientNoShowAlert.displayAlert(PatientNoShowAlert.java:46) at com.main.InitExecuter$3.run(InitExecuter.java:84) at com.sun.javafx.application.PlatformImpl$4$1.run(Unknown Source) at com.sun.javafx.application.PlatformImpl$4$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl$4.run(Unknown Source) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source) at com.sun.glass.ui.win.WinApplication$3$1.run(Unknown Source) at java.lang.Thread.run(Thread.java:674)
score: 0
has comment: http://stackoverflow.com/comment/35110690
type: UnansweredQuestion

http://stackoverflow.com/comment/35324719
type: AnswerComment
comment on: http://stackoverflow.com/a/23109053
type: Comment
has text: Hi Jay, but this is exactly what I've already done (look into my UserAccount object). That is really strange.
score: 0

http://stackoverflow.com/a/22995155
answers question: http://stackoverflow.com/q/22995045
type: Answer
has comment: http://stackoverflow.com/comment/35119471
has body: How about using a regex? Like for example: if (currentLine.matches(".*[a-zA-Z].*")) { //letters contained. } else { //no letters contained. } see regex demo: http://regex101.com/r/rQ6oR1
has comment: http://stackoverflow.com/comment/35119565
score: 0

http://stackoverflow.com/comment/35299364
type: QuestionComment
comment on: http://stackoverflow.com/q/23093381
score: 0
type: Comment
has text: Do you know of any examples of the checking whether strings match (a link or video would be wonderful)? I struggling to write this on my own

http://stackoverflow.com/q/23118385
type: Question
tagged with: open-with
has comment: http://stackoverflow.com/comment/35343562
tagged with: windows-8
has comment: http://stackoverflow.com/comment/57958655
score: 0
tagged with: file-association
tagged with: rundll32
type: UnansweredQuestion
has body: What is the Windows 8 version of the "rundll32.exe shell32.dll,OpenAs_RunDLL {path}" command? I am trying to get the open with dialog in Java, which works in Windows 7, but does nothing on Windows 8 ... ProcessBuilder pb = new ProcessBuilder("rundll32", "shell32.dll,OpenAs_RunDLL", file.getAbsolutePath() ); pb.start(); ... My Googling for the command, or information that could help me put it together myself has so far been fruitless...
answer count: 0
has title: Windows 8 command line for Open With dialog
tagged with: java
has comment: http://stackoverflow.com/comment/35351677

http://stackoverflow.com/comment/35298307
has text: I think what you're asking is how to get `firstSet.await()` to throw an `InterruptedException` when you're testing. Is that correct?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23093448

http://stackoverflow.com/comment/35228464
comment on: http://stackoverflow.com/q/23055284
score: 0
type: QuestionComment
has text: Yes HTTP error 500: Internal Server Error
type: Comment

http://stackoverflow.com/a/23105606
has comment: http://stackoverflow.com/comment/35367003
has body: I think that you don't have long-running conversation. You could read more information on this site: http://docs.oracle.com/javaee/6/api/javax/enterprise/context/ConversationScoped.html If you have transient conversation this bean is recreated after every request
has comment: http://stackoverflow.com/comment/35328187
score: 0
has comment: http://stackoverflow.com/comment/35328304
has comment: http://stackoverflow.com/comment/35328149
type: Answer
answers question: http://stackoverflow.com/q/23103952

http://stackoverflow.com/a/23122206
score: 0
has body: String doesn't have an insert() method.
type: Answer
answers question: http://stackoverflow.com/q/23122191

http://stackoverflow.com/comment/35079559
type: AnswerComment
type: Comment
has text: I tried to load it now with: ContextWrapper cw = new ContextWrapper(mContext); File directory = cw.getFilesDir(); File file = new File(directory, "profile.jpg"); I have to say i really don't know why this contextWrapper is there.
comment on: http://stackoverflow.com/a/22972628
score: 0

http://stackoverflow.com/comment/35188575
has text: in the code where are you calling ajaxpage.jsp,show me the code
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23032772

http://stackoverflow.com/q/23019806
downvote count: 1
has answer: http://stackoverflow.com/a/23019958
favorite count: 0
has title: Method for changing values
has answer: http://stackoverflow.com/a/23019865
has comment: http://stackoverflow.com/comment/35164646
type: AnsweredQuestion
upvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/23019865
type: Question
has answer: http://stackoverflow.com/a/23019882
score: -1
accepted answer: http://stackoverflow.com/a/23019958
has comment: http://stackoverflow.com/comment/35164514
answer count: 3
has body: I have the class "Buyer" and the class "Address", i have a constructor in Address where i can type in the information, and I also have a method to CHANGE the info. So in my class Buyer i have a constructor where i can give the buyer a name and also create an Address object, but then i tried to create a method in "Buyer" to change the value of the object from class Address, but it isn't working as it is meant to. Thank's for the help. Essencial part of the class Address public class Address{ private String street; public Address(){ Keyboard k = new Keyboard(); Street = k.readString("Type in the Street: "); } public void change(){ Keyboard k = new Keyboard(); String str; System.out.println("If you do not wish to change the street, please just press enter."); str = k.readString("type in the Street: "); if (log.equals("")) str = str; else street = str; } THEN i tried doing the same thing in Buyer public class Buyer{ private String name; private Address address; public buyer(String nm){ name = nm; this.address = new Address(); } public void changeAdress(){ new Address().change(); }

http://stackoverflow.com/comment/35368079
comment on: http://stackoverflow.com/q/23116081
score: 0
has text: The JPA 2.1 spec (4.4.9) states: "The use of the TREAT operator is supported for downcasting within path expressions in the FROM and WHERE clauses. Use of the TREAT operator allows access to subclass-specific state." So may not be available in the ORDER BY clause.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22987082
tagged with: jquery
linked to: http://stackoverflow.com/q/17093862
tagged with: ajax
type: Question
has title: Struts 2 action response on jsp
has comment: http://stackoverflow.com/comment/35104811
has answer: http://stackoverflow.com/a/22987535
score: 0
tagged with: java
has body: I would like to get a HTTPServletResponse of an Action on a jsp page, but i don't know how... My ajax call on the jsp: jQuery.ajax({ url : 'actionURL', type: "POST", data : {input: "example"}, dataType: "html", success: function(response) { alert(response); if (response == 1) { jQuery("#message").html("done!"); } } }); My Action class: public class MyAction implements ServletResponseAware { public final String execute() throws IOException { String return_code = "1"; try { something... } catch (Exception e) { return_code = "0"; } response.setContentType("text/html;charset=UTF-8"); response.getWriter().write(return_code); return "success"; } } How can i access only the return_code variable on jsp? Because now in the script alerts the whole page HTML code as response... Thanks!
answer count: 1
type: UnansweredQuestion
tagged with: struts2
tagged with: action

http://stackoverflow.com/q/22977635
has answer: http://stackoverflow.com/a/28628278
score: 0
tagged with: batch-file
answer count: 3
tagged with: windows
has body: i have tried opening .bat files in PHP using many syntax and they are working fine. It runs the file and stores the output. But im having a new problem in hand where i need to initiate a server program from PHP. Lets say i have a the server program "server.java" and a client program "client.java". The server needs to be run first and then the client. I have created a batch file to run this server program as "server.bat". Is it possible to initiate this server.bat file from the PHP side and make it run in the background until the client finish its process?
has title: How to run a batch file using PHP?
has answer: http://stackoverflow.com/a/22977664
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35088029
tagged with: php
tagged with: java
has answer: http://stackoverflow.com/a/22977682
type: Question

http://stackoverflow.com/comment/35231732
has text: No you cannot, those properties are loaded at deploy time and are not changeable. Do you need to change those properties?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23055850

http://stackoverflow.com/a/23019205
type: Answer
accepted answer of: http://stackoverflow.com/q/23019150
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: This is because you are swapping references, which are passed by value (I know, this sounds confusing, but that is what Java does). When you do this assignment rowA = rowB; the effect of the change is visible inside your function, not outside it. In order for the effects to be visible by the caller, you need to operate on the array object. Here is how: first, change the API to take indexes rather than the actual rows. Then change the code to use these indexes into the 2D array, like this: public static void swapRows(int[][] array, int rowA, int rowB) { int[] tempRow = array[rowA]; array[rowA] = array[rowB]; array[rowB] = tempRow; }
answers question: http://stackoverflow.com/q/23019150

http://stackoverflow.com/comment/35191141
type: Comment
comment on: http://stackoverflow.com/q/23034375
score: 0
has text: yes, I totally agree that there is a risk that my parsing rules will be broken, but what's another way to do such app? What about sending and receiving http responses? @piotrpo i'm java dev, but it's my first attempts with Android, so if you'll give me some idea for app to practice, i'll appreciate:) my idea was with this kind of app for myself.
type: QuestionComment

http://stackoverflow.com/q/23115739
tagged with: geometry
linked to: http://stackoverflow.com/q/3684269
has answer: http://stackoverflow.com/a/23128874
accepted answer: http://stackoverflow.com/a/23128874
has comment: http://stackoverflow.com/comment/35359795
has comment: http://stackoverflow.com/comment/35359736
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23121093
downvote count: 0
score: 1
tagged with: quaternions
tagged with: java
has answer: http://stackoverflow.com/a/23121093
has body: I am really struggeling to find the correct way to get the rotation angle around a single axis from an arbitrary quaternion. So other words I want to find the portion of the expressed rotation around a specified axis (in my case the Z-axis of the coordinate system, but an arbitrary solution would be nice) in terms of the angle. Can anyone point out to achieve this? Ideally some java fragment would be nice. I tried the solution proposed in 1 for attitude, which is: asin(2*qx*qy + 2*qz*qw) However, this fails in some cases, e.g. a single rotation around the Z-axis with more than 0.6 * PI.
has title: Java code to get rotation angle around an axis from quaternion
type: Question
has comment: http://stackoverflow.com/comment/35338800
has comment: http://stackoverflow.com/comment/35337423
tagged with: math
has comment: http://stackoverflow.com/comment/35373345
answer count: 2
has comment: http://stackoverflow.com/comment/35342276
upvote count: 1
favorite count: 0

http://stackoverflow.com/a/23012604
answers question: http://stackoverflow.com/q/23012524
has comment: http://stackoverflow.com/comment/35150819
has comment: http://stackoverflow.com/comment/35150813
has comment: http://stackoverflow.com/comment/35150871
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35150795
upvote count: 1
has body: Use BigDecimal.intvalue: int i = new BigDecimal(ids.length).multiply(new BigDecimal(price)).intValue(); ... or you can just cast the whole operation as int: int totalSum = (int)(ids.length() * price); Edit As implied in comments, I'm making this explicit: casting as int or getting the int value will incur in a loss of precision. Use Deepak's answer if you were just not sure about which type to pick (and accept his answer).
score: 1

http://stackoverflow.com/comment/35315332
type: AnswerComment
type: Comment
has text: then can you just call your interrupt() directly?
comment on: http://stackoverflow.com/a/23102730
score: 0

http://stackoverflow.com/comment/35092552
type: AnswerComment
comment on: http://stackoverflow.com/a/22980021
has text: @UmarFarooq what is `dots`? I mean, what does it represent in the program?
type: Comment
score: 0

http://stackoverflow.com/comment/35276994
has text: Read the intro and you'll notice that you're asking for something that is *not done*. That explains why you won't find an answer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23081116
score: 0

http://stackoverflow.com/q/23039714
has title: Netbeans "illegal start of type" error
score: 0
answer count: 1
tagged with: netbeans
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23039757
accepted answer: http://stackoverflow.com/a/23039757
tagged with: java
has body: I am following the Netbeans CRUD Application tutorial (modified to use my own database) and I am getting this error that I can't figure out at all. The error says "illegal start of type ';' expected, cannot find symbol This is my code: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.photo.viewer; import demo.Photos; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.Persistence; import javax.persistence.Query; import org.netbeans.api.settings.ConvertAsProperties; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.util.NbBundle.Messages; import org.openide.windows.TopComponent; /** * Top component which displays something. */ @ConvertAsProperties( dtd = "-//com.photo.viewer//photoViewer//EN", autostore = false ) @TopComponent.Description( preferredID = "photoViewerTopComponent", //iconBase="SET/PATH/TO/ICON/HERE", persistenceType = TopComponent.PERSISTENCE_ALWAYS ) @TopComponent.Registration(mode = "explorer", openAtStartup = true) @ActionID(category = "Window", id = "com.photo.viewer.photoViewerTopComponent") @ActionReference(path = "Menu/Window" /*, position = 333 */) @TopComponent.OpenActionRegistration( displayName = "#CTL_photoViewerAction", preferredID = "photoViewerTopComponent" ) @Messages({ "CTL_photoViewerAction=photoViewer", "CTL_photoViewerTopComponent=photoViewer Window", "HINT_photoViewerTopComponent=This is a photoViewer window" }) public final class photoViewerTopComponent extends TopComponent { public photoViewerTopComponent() { initComponents(); setName(Bundle.CTL_photoViewerTopComponent()); setToolTipText(Bundle.HINT_photoViewerTopComponent()); } /** * 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.…
type: Question

http://stackoverflow.com/comment/35084345
type: Comment
type: QuestionComment
has text: What does your `toString()` method look like now?
score: 0
comment on: http://stackoverflow.com/q/22975445

http://stackoverflow.com/a/23031612
downvote count: 0
score: 3
has body: 1 / 4 and 10 / 4 are integer divisions. Their result is an int, that is then widened to a double. What you want is a double division: double w1 = 1.0 / 4 or double w1 = 1 / 4.0
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23031587
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23031587
type: Answer

http://stackoverflow.com/comment/35095282
comment on: http://stackoverflow.com/a/22981950
has text: If someone wrote code like this, I would ask him to explain his actions. But yes, this is an example where the synchronization would actually happen.
score: 5
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35167811
has text: Do you actually need to invoke the `init()` method to test your Servlet? If not, I'd recommend you just instantiate your Servlet and _inject_ its dependencies manually instead of relying on `SpringBeanAutowiringSupport` in your test.
comment on: http://stackoverflow.com/q/22986109
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23037899
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23037856
answers question: http://stackoverflow.com/q/23037856
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35197568
upvote count: 1
has body: Put your layout definitions in the PlaceholderFragment class. For the findViewById, use rootView.findViewById. For the context, use getActivity(). Why does this work? There are actually 2 independent layouts shown as one in your screen. The master one shows everything, including a fragment. A Fragment is basically a self-contained mini activity, very useful in Tablet development, and mildly useful even just for a phone type device. Your layouts are in the fragment_quiz xml file, which is only inflated inside the fragment, in the onCreateView statement. So long as you use the findViewById after it's been inflated, you'll be fine.
has comment: http://stackoverflow.com/comment/35197502
has comment: http://stackoverflow.com/comment/35197545
type: AcceptedAnswer

http://stackoverflow.com/q/22968443
has answer: http://stackoverflow.com/a/22968579
has title: How to force constructor is only called once without singleton pattern?
has answer: http://stackoverflow.com/a/22968793
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22968579
has answer: http://stackoverflow.com/a/22969021
downvote count: 0
favorite count: 0
type: Question
tagged with: singleton
score: 3
has comment: http://stackoverflow.com/comment/35071887
has comment: http://stackoverflow.com/comment/35071602
has body: I always read singleton pattern is an anti pattern etc. But I spent nearly a day to find out, that a class had something like a cyclic dependency in construction leading to more than one object, where only one was allowed for the application. That's why I want to verify this never happens again and don't know how to do that without the singleton pattern. public class Application { private SingletonModule module; public void getModule() { if(module == null) { module = new SingletonModule(getDependency()); } return module; } private Dependency getDependency() { return new Dependency(getModule()); } } public class Dependency { public Dependency(SingletonModule module) { System.out.println(module.getAttribute()); // is more complex of course... } } public class SingletonModule { public Dependency dep; public String attribute; public SingletonModule(Dependency dep) { this.dep=dep; } public String getAttribute() { return attribute; } } No the problem is getModule() is called from outside, i.e. public class Runner { public Runner() { Application app = new Application(); app.getModule().getAttribute(); } }
accepted answer: http://stackoverflow.com/a/22968793
upvote count: 3
answer count: 3
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/35071095
tagged with: java

http://stackoverflow.com/q/22985492
upvote count: 3
has answer: http://stackoverflow.com/a/22985729
has title: OutOfMemoryError when parsing large xml file using xstream
tagged with: marshalling
type: Question
tagged with: xstream
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/22985774
has answer: http://stackoverflow.com/a/22985881
tagged with: unmarshalling
downvote count: 0
has answer: http://stackoverflow.com/a/22985744
favorite count: 0
has body: I'm facing a problem while reading large XML files "100 MB" and parsing it using xstream always the below error occurs java.lang.OutOfMemoryError: Java heap space error occurs, here is the code that parses the XML XStream xstream = new XStream(); xstream.processAnnotations(Class.forName((String)ClassName)); ClassName is a normal class that have the fields with xml annotations. then use Object resultDto = xstream.fromXML((String)fileString); fileString: is the xml file after reading it as inputstream and put it in string buffer. the above code works fine with small files but didn't work with the big one, any ideas please?
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35101764
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/22985658

http://stackoverflow.com/comment/35207166
comment on: http://stackoverflow.com/q/23042450
has text: What other action do I need in the <intent-filter> to accomplish this?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23093494
score: 0
has body: To achieve that, you have to traverse map's entrySet() and check each key()'s hashCode() against some value you want to check presense, 65 in your example: Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); public boolean hashCodePresent(int hashCode) { for (Map.Entry&lt;String, String&gt; mapEntry : map.entrySet()) { if (mapEntry.getKey().hashCode() == hashCode) { return true; } } return false; }
answers question: http://stackoverflow.com/q/23093381
type: Answer

http://stackoverflow.com/q/23128997
score: 1
upvote count: 1
tagged with: java
has title: Technical reason for static java.net design
has body: Is there any technical reason that java.net.Authenticator uses a static setDefault(), has no getDefault() (so you can, worst case, wrap it) and can not be overriden on a per-instance method when used by say http? Same question for other classes like java.net.CookieHandler: why a static default? Why no per-instance settings? I can understand that perhaps it was designed in version 1.0 when application servers weren't a thing, but why hasn't the per-instance functionality been added to the appropriate classes? Currently I always have to use other libraries to do basic things like HTTP. This question is not meant as flamebait, I'm genuinely curious if there are some technical limitations that my google-fu can't find.
downvote count: 0
answer count: 0
type: UnansweredQuestion
favorite count: 0
type: Question

http://stackoverflow.com/comment/35291899
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23090263
has text: It didn't show anything, or it had the wrong symbols? The second one is an encoding issue.
score: 0

http://stackoverflow.com/q/22990182
tagged with: internet-explorer
has comment: http://stackoverflow.com/comment/35113509
has title: Struts2 Upload File ie
tagged with: struts2
score: 0
has comment: http://stackoverflow.com/comment/35112971
tagged with: jsp
has comment: http://stackoverflow.com/comment/35110261
has comment: http://stackoverflow.com/comment/35143800
has comment: http://stackoverflow.com/comment/35125148
type: UnansweredQuestion
answer count: 0
has body: In my struts2 application I am using “File Upload Interceptor” but internet explorer does not work. In firefox itself, and also chrome <s:file name="upload" id="upload" /> text/plain, application/pdf, application/word, application/msword, application/vnd.ms-excel, application/msexcel, application/x-msexcel, application/x-ms-excel, application/x-excel, application/x-dos_ms_excel, application/xls, application/x-xls, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.openxmlformats-officedocument.wordprocessingml.document 2000000 pdf,xls,doc,docx,xlsx,txt adjuntos.jsp adjuntos.jsp ArchivosAdjuntos_ /contratos/plantilla Why not work on internet explorer? Any solution?
tagged with: java
type: Question

http://stackoverflow.com/comment/40642674
type: Comment
comment on: http://stackoverflow.com/a/25958826
has text: "i think" please give facts
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35092309
type: QuestionComment
has text: make it a string..isnt that obvious...or else much better load it from a txt file within your server..
score: 1
comment on: http://stackoverflow.com/q/22980147
type: Comment

http://stackoverflow.com/comment/35209527
score: 0
type: Comment
has text: How would I print out the random word in the console?
comment on: http://stackoverflow.com/a/23033370
type: AnswerComment

http://stackoverflow.com/q/22976637
tagged with: java
score: 0
answer count: 1
has title: Need help parsing out a file into two key fields per line
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22977825
accepted answer: http://stackoverflow.com/a/22977825
type: Question
has body: I am trying to write a Java method that will parse out a text file one line at a time. In the following example I want to take the number at the front of the line and use that as one key value and the the FFM number as the next key field up until the alpha numeric characters which in the following cases is CH which is not part of the key sequence. 107458982 FFM00000000000713432CH Once the keys are separated then I want to take them and make one key field. so in the end each line will have a key field that is actually 19 bytes long. This is what the key field looks like at the end of each line. I want to push these key fields on to an ArrayList so that I can compare them to another txt file that has similar type structures. I thought that this would be easy but it is turning out a lot harder than I thought that it might be. Key Filed --&gt; 107458982FFM00000000000713432 My text file, in this case, has a blank line on every other line so I need to just skip a blank line which is not in my code below. Question: How would I parse this file out as simple and quickly as possible into my key fields which will make my single key? Code: private ArrayList&lt;String&gt; scannerRead4(String inFileUsed) { ArrayList&lt;String&gt; tempList = null; try { BufferedReader in = new BufferedReader(new FileReader(inFileUsed)); try { String line; while ((line = in.readLine()) != null) { String[] s = line.split(" "); for (int index=0;index&lt;line.length()-1; index++) { System.out.println("s: " + s[index]); } //tempList = new ArrayList&lt;String&gt;(Arrays.asList(line.split(" "))); } } catch (IOException e) { e.printStackTrace(); } } catch (FileNotFoundException e) { e.printStackTrace(); } return tempList; } File context that needs to be parsed 107458982 FFM00000000000713432CH 107462291 FFM00000000001835472T 107462291 FFM00000000002200570T 107462291 FFM00000000002432274T 108018296 FFM00000000001431509T 108018296 FFM00000000001553064T 108122386 FFM00000000001211063T 108122386 FFM00000000001…

multithreading
tags question: http://stackoverflow.com/q/23086873
tags question: http://stackoverflow.com/q/23050962
tags question: http://stackoverflow.com/q/23069460
tags question: http://stackoverflow.com/q/23104012
tags question: http://stackoverflow.com/q/23040139
type: Tag
tags question: http://stackoverflow.com/q/23085526
tags question: http://stackoverflow.com/q/23012639
tags question: http://stackoverflow.com/q/23051604
tags question: http://stackoverflow.com/q/23000946
tags question: http://stackoverflow.com/q/23117861
tags question: http://stackoverflow.com/q/22986006
tags question: http://stackoverflow.com/q/22973032
tags question: http://stackoverflow.com/q/23022242
tags question: http://stackoverflow.com/q/23002090
tags question: http://stackoverflow.com/q/23051028
tags question: http://stackoverflow.com/q/23078443
tags question: http://stackoverflow.com/q/23054690
tags question: http://stackoverflow.com/q/23095144
tags question: http://stackoverflow.com/q/23010330
tags question: http://stackoverflow.com/q/22974274
tags question: http://stackoverflow.com/q/23089495
tags question: http://stackoverflow.com/q/23096163
tags question: http://stackoverflow.com/q/23102611
tags question: http://stackoverflow.com/q/23044965
tags question: http://stackoverflow.com/q/23047363
tags question: http://stackoverflow.com/q/23034926
tags question: http://stackoverflow.com/q/23010505
tags question: http://stackoverflow.com/q/23007381
tags question: http://stackoverflow.com/q/22971222
tags question: http://stackoverflow.com/q/23094605
tags question: http://stackoverflow.com/q/23073496
tags question: http://stackoverflow.com/q/23047252
tags question: http://stackoverflow.com/q/23121390
tags question: http://stackoverflow.com/q/23023389
tags question: http://stackoverflow.com/q/23104709
tags question: http://stackoverflow.com/q/22981673
tags question: http://stackoverflow.com/q/23118747
tags question: http://stackoverflow.com/q/22994526
tags question: http://stackoverflow.com/q/23036552
tags question: http://stackoverflow.com/q/22992046
tags question: http://stackoverflow.com/q/22978245
tags question: http://stackoverflow.com/q/23006531
tags question: http://stackoverflow.com/q/22996274
tags question: http://stackoverflow.com/q/23046110
tags question: http://stackoverflow.com/q/22998153
tags question: http://stackoverflow.com/q/23016255
tags question: http://stackoverflow.com/q/23093581
tags question: http://stackoverflow.com/q/23040550
tags question: http://stackoverflow.com/q/23102429
tags question: http://stackoverflow.com/q/23033296
tags question: http://stackoverflow.com/q/23030723
tags question: http://stackoverflow.com/q/23077657
tags question: http://stackoverflow.com/q/23111402
tags question: http://stackoverflow.com/q/23056659
tags question: http://stackoverflow.com/q/23017332
tags question: http://stackoverflow.com/q/23017275
tags question: http://stackoverflow.com/q/22981569
tags question: http://stackoverflow.com/q/22974230
tags question: http://stackoverflow.com/q/22992458
tags question: http://stackoverflow.com/q/22983899
tags question: http://stackoverflow.com/q/23084616
tags question: http://stackoverflow.com/q/23053462
tags question: http://stackoverflow.com/q/23049023
tags question: http://stackoverflow.com/q/23038682
tags question: http://stackoverflow.com/q/23054728
tags question: http://stackoverflow.com/q/22983099
tags question: http://stackoverflow.com/q/23086236
tags question: http://stackoverflow.com/q/23065490
tags question: http://stackoverflow.com/q/23011189
tags question: http://stackoverflow.com/q/23005929
tags question: http://stackoverflow.com/q/22971890
tags question: http://stackoverflow.com/q/22978198
tags question: http://stackoverflow.com/q/23090346
tags question: http://stackoverflow.com/q/23061119
tags question: http://stackoverflow.com/q/23040120
tags question: http://stackoverflow.com/q/23060994
tags question: http://stackoverflow.com/q/23120811
tags question: http://stackoverflow.com/q/23049842
tags question: http://stackoverflow.com/q/22989633

http://stackoverflow.com/comment/35357664
type: AnswerComment
has text: What exactly did you try? Show us your code and the stack trace!
type: Comment
comment on: http://stackoverflow.com/a/23103159
score: 0

http://stackoverflow.com/a/23025410
answers question: http://stackoverflow.com/q/23025265
downvote count: 0
score: 1
upvote count: 1
has body: You need to instantiate your SimpleDateFormat object with the pattern it will use to parse the date String. In your case: DateFormat format = new SimpleDateFormat("d MMM yyyy HH:mm:ss"); A table of the acceptable pattern symbols can be found in the docs for SimpleDateFormat
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23025265
type: Answer

http://stackoverflow.com/q/23072184
type: Question
has body: How can I make a code that makes it so that each letter in the alphabet is assigned to a Scrabble Score? For example a= 1 point, b= 3 point, c= 3 points. Then if I have String "abc" the value of the String would be 7 points. The idea I have so far is these two arrays: private int[] Points= {1,3,3,2,1,4,2,4,1,8,5,1,3,1,1,3,10,1,1,1,1,4,4,8,4,10}; private String Letters[] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
has answer: http://stackoverflow.com/a/23072310
tagged with: arrays
downvote count: 0
favorite count: 0
has title: Scrabble Sort Of
has answer: http://stackoverflow.com/a/23072239
answer count: 5
has answer: http://stackoverflow.com/a/23072257
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23072262
upvote count: 1
has answer: http://stackoverflow.com/a/41070447
tagged with: loops

http://stackoverflow.com/a/23061220
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/23060916
answers question: http://stackoverflow.com/q/23060916
has body: I hope , you can use SimpleDateFormat for accomplishing this. Code: SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String date = sdf.format(jDateChooserDeadline.getDate()); t1.setDate(date);

http://stackoverflow.com/q/23022495
answer count: 2
has comment: http://stackoverflow.com/comment/35170130
has comment: http://stackoverflow.com/comment/35170210
accepted answer: http://stackoverflow.com/a/23022525
has comment: http://stackoverflow.com/comment/35170169
tagged with: inheritance
possible better answer: http://stackoverflow.com/a/23022554
favorite count: 0
has answer: http://stackoverflow.com/a/23022554
score: 0
linked to: http://stackoverflow.com/q/215497
tagged with: exception
tagged with: custom-exceptions
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/23022525
linked to: http://stackoverflow.com/q/2336692
type: AnsweredQuestion
has body: ok, here's my problem. I want to create my own custom exceptions such as 'UsernameAlreadyTakenException'. I can create a single class in a file which extends Exception. My problem is, I'd rather not have 3 - 5 different files for each 'subclass' that do almost nothing. I'd like to stick them all in the same file. Is this possible and if so how??
tagged with: java
has title: How do I create n-number exceptions in the same class?
type: Question

http://stackoverflow.com/comment/35170396
has text: thanks for pointing that out. Is the rest OK as it is? I am not very strong with Regex, I just like the idea of *"parsing it yourself"*
comment on: http://stackoverflow.com/a/23022659
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23111045
has body: In this case you should implement these methods of activity onSaveInstanceState(Bundle pInstanceState) onRestoreInstanceState(Bundle pInstanceState) Make your adapter Serializable (or Parcelable). In onSaveInstanceState pass it to Bundle as Extra. After that in Activity's onResume call onRestoreInstanceState where you'll retrieve and set the adapter from extras. In the Activity's onPause call onSaveInstanceState. Hope this helps :)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23108887

http://stackoverflow.com/comment/35337523
type: AnswerComment
comment on: http://stackoverflow.com/a/23061531
score: 0
type: Comment
has text: Thanks! AccessType.FIELD is useful and I've now been playing around with that to achieve what I'm trying to do

http://stackoverflow.com/a/23094219
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/23094209
type: Answer
has body: You need to create a Scanner object before you can use it. In the very top of the method (I assume main method here), write: Scanner sc = new Scanner(System.in); You'll also need to add an import to the very top of the file: import java.util.Scanner;
score: 5

http://stackoverflow.com/a/23009374
answers question: http://stackoverflow.com/q/22978542
type: Answer
score: 1
upvote count: 1
has body: I found the answer by hit and try and its the connection string. If one wants to connect as sysdba/sysoper the connection string should be like: public static void test_script () { String fileName = "@t.sql"; String sqlPath = "D:\\"; String sqlCmd = "sqlplus"; // IP_address,portid and sid are variables to be entered and t.sql is the file to be read .It contains show user command String arg3 = "sys/oracle123@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=IP_address)(Port=portid))(CONNECT_DATA=(SID=sid))) as sysdba"; String arg4= fileName; try { String line; ProcessBuilder pb = new ProcessBuilder(sqlCmd,arg3,arg4); Map&lt;String, String&gt; env = pb.environment(); env.put("VAR3", arg3); env.put("VAR4", arg4); pb.directory(new File(sqlPath)); pb.redirectErrorStream(true); Process p = pb.start(); BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader bre = new BufferedReader(new InputStreamReader(p.getErrorStream())); while ((line = bri.readLine()) != null) { System.out.println(line); } bri.close(); while ((line = bre.readLine()) != null) { System.out.println(line); } bre.close(); System.out.println("\n\n\n"); System.out.println("Done."); } catch (Exception err) { err.printStackTrace(); } }
downvote count: 0

http://stackoverflow.com/a/40254090
type: Answer
upvote count: 3
score: 3
has body: A better solution could be this.. public class ApiResponse&lt;T&gt; { public T data; public String status; public String reason; } Then, define your service like this.. Observable&lt;ApiResponse&lt;YourClass&gt;&gt; updateDevice(..);
downvote count: 0
answers question: http://stackoverflow.com/q/23070298

http://stackoverflow.com/a/22975428
has body: I just went through the hell of how resourceasstream can behave differently under different circumstances. I ended up changing over to basically mocking the source and the mock really just returned the JSON or HTML we wanted to use in the tests in question. Can't recommend this enough. The code is cleaner and you are not trying to figure out whether a file ended up in the classpath or where off the classpath it is. If your file is large, it might be less appealing, but you could even create modular versions of those assembled files, e.g.: new MockResponse.Builder().addHeader(headerJSON).body(forecastTable).build(); Of course, those elements will be strings somewhere, but you could do a lot of organizing that frankly your sample test files don't have. I rethought this because I spent a bunch of time looking at tests that ran under gradle at the command line but not inside IntelliJ. But then I was thinking about how Karma works in Angular: when you are writing tests against expected responses, you are literally saying things like: .when("/forecasts").respond("{ forecasts: [ { "mon", 75º }, { "tue", "78º" } ... ]") So the idea that responses would be mocked as literal snippets is deemed acceptable there.
type: Answer
answers question: http://stackoverflow.com/q/22975171
score: 0
has comment: http://stackoverflow.com/comment/35086077

http://stackoverflow.com/a/23068251
answers question: http://stackoverflow.com/q/23068223
has body: You're missing break; after each of your cases. case 1: { out.println("In GBP"); result=amount1*100.70; out.println(result); break; } case 2: { result=amount1*0.59; break; } case 3: { result=amount1*0.043; break; } case 4: { result=amount1*56.64; break; } case 5: { result=amount1*54.91; break; } case 6: { result=amount1*60.17; break; } case 7: { result=amount1*52.15; break; } Otherwise program flow will continue and all cases below the matching case will be executed.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35413090
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23068223

http://stackoverflow.com/q/23052155
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/35222907
answer count: 1
downvote count: 1
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/23052264
has comment: http://stackoverflow.com/comment/35222973
accepted answer: http://stackoverflow.com/a/23052264
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has body: My problem is as follows. In my spring configuration, I would like to read a JVM property. Now based on the JVM property I want to pick a username value defined in some runtime property. For example, I have a JVM property defined instanceId. It can have primary or secondary string values. Also, I have two runtime properties. PrimaryAccount=123 SecondaryAccount=456 Now based on the jvm property value. // pseudo code if instanceId = primary Bean ABC should be passed 123 in its constructor argument if instanceId = secondary Bean ABC should be passed 456 in its constructor argument I am trying this &lt;constructor-arg&gt; &lt;value&gt;#{ systemProperties['newsAppIndexDataNode'].equals('primary') ? ${instance_primary} : ${instance_secondary} }&lt;/value&gt; &lt;/constructor-arg&gt; but I am getting error Field or property '123' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'
has title: Spring xml ...loading variable conditionally
type: Question
has comment: http://stackoverflow.com/comment/35223146
tagged with: java
has comment: http://stackoverflow.com/comment/35222955

http://stackoverflow.com/a/23053385
has comment: http://stackoverflow.com/comment/35225633
downvote count: 0
has comment: http://stackoverflow.com/comment/35225881
has comment: http://stackoverflow.com/comment/35225912
has comment: http://stackoverflow.com/comment/35226061
type: Answer
has comment: http://stackoverflow.com/comment/35225042
has comment: http://stackoverflow.com/comment/35226130
score: 2
answers question: http://stackoverflow.com/q/23053292
upvote count: 2
has comment: http://stackoverflow.com/comment/35226478
has comment: http://stackoverflow.com/comment/35225561
has comment: http://stackoverflow.com/comment/35226287
has comment: http://stackoverflow.com/comment/35225107
has body: Your first problem is that Transcriber.class.getClass() returns the Class object for the Class class. What you wanted was Transcriber.class The second problem is that, assuming your config.xml resource is in the same package as the Transcriber class, then you need to either provide the fully qualified path to the resource or get it relative to the Transcriber class' package. So either URL configURL = Transcriber.class.getResource("config.xml"); or URL configURL = Transcriber.class.getResource("/com/example/config.xml");

http://stackoverflow.com/comment/35213795
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23047099
has text: Please have a look at `The method getCalculator2Port() is undefined for the type Calculator2Service`.

http://stackoverflow.com/a/23012143
downvote count: 0
has body: i have searched for the very same question that maybe others have the exact problem, and i found an accepted answer over here. Java:how to pass value from class/bean to servlet and for the passing parameters and/or arrays is done via that line: request.setAttribute("areas", areas); similar to ("key": value) sets of request you are about to do. regards..
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23011833

hibernate-search
tags question: http://stackoverflow.com/q/23056329
type: Tag
tag name: hibernate-search
tags question: http://stackoverflow.com/q/23077222
tags question: http://stackoverflow.com/q/23109952
tags question: http://stackoverflow.com/q/23003796
tags question: http://stackoverflow.com/q/23083694
tags question: http://stackoverflow.com/q/23063561

http://stackoverflow.com/a/23124834
has body: Before calling displayPattern, you have to fill quilt somewhere. i.e. displayPattern(myBlock); fillQuilt(myQuilt); displayPattern(myQuilt);
accepted answer of: http://stackoverflow.com/q/23124798
answers question: http://stackoverflow.com/q/23124798
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/a/23022700
score: 0
has body: You're mising '' around the 2: //Project/Layer[@idLayer='2']
has comment: http://stackoverflow.com/comment/35170430
type: Answer
answers question: http://stackoverflow.com/q/23022273

http://stackoverflow.com/comment/35319543
type: AnswerComment
comment on: http://stackoverflow.com/a/23095378
score: 0
type: Comment
has text: Thank you! I will definitely look into more datastructures.

http://stackoverflow.com/comment/35193266
comment on: http://stackoverflow.com/q/23029588
type: Comment
type: QuestionComment
has text: This is on the desktop only, right? You may be able to use an LWGJL API to set a window as 'maximized' .. see http://stackoverflow.com/questions/15274707/creating-a-maximized-lwjgl-window
score: 0

http://stackoverflow.com/comment/44499150
score: 0
type: Comment
has text: This worked for me. Pretty disappointing that Java's official tool can't successfully detect I actually don't have any older versions. Among other things.
comment on: http://stackoverflow.com/a/24824341
type: AnswerComment

http://stackoverflow.com/comment/35196416
comment on: http://stackoverflow.com/a/23036854
type: AnswerComment
has text: Adding the missing case would reduce the number of calls surely? Don't recurse any more than you really need to.
score: 0
type: Comment

http://stackoverflow.com/a/22978032
has body: Hope the following helps : import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.PrintStream; import java.util.HashSet; import java.util.Iterator; import java.util.Scanner; public class Test { public static void main (String args[]) throws IOException{ Scanner sc2 = null; HashSet withoutDuplicatesHashSet = new HashSet(); try { sc2 = new Scanner(new File("sample.txt")); } catch (FileNotFoundException e) { e.printStackTrace(); } while (sc2.hasNextLine()) { Scanner s2 = new Scanner(sc2.nextLine()); boolean b; while (b = s2.hasNext()) { String s = s2.next(); withoutDuplicatesHashSet.add(s); System.out.println(s); } } System.out.println(withoutDuplicatesHashSet); PrintStream out = new PrintStream(new FileOutputStream("WithoutDuplicates.txt")); Iterator hashSetIterator = withoutDuplicatesHashSet.iterator(); while(hashSetIterator.hasNext()){ out.println(hashSetIterator.next()); } } }
has comment: http://stackoverflow.com/comment/35089028
has comment: http://stackoverflow.com/comment/35094310
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35089295
has comment: http://stackoverflow.com/comment/35097720
has comment: http://stackoverflow.com/comment/35098128
has comment: http://stackoverflow.com/comment/35098840
has comment: http://stackoverflow.com/comment/35097639
answers question: http://stackoverflow.com/q/22977876
has comment: http://stackoverflow.com/comment/35089353
has comment: http://stackoverflow.com/comment/35088721
has comment: http://stackoverflow.com/comment/35097689
type: Answer
has comment: http://stackoverflow.com/comment/35090642
has comment: http://stackoverflow.com/comment/35097674
accepted answer of: http://stackoverflow.com/q/22977876
has comment: http://stackoverflow.com/comment/35091104
has comment: http://stackoverflow.com/comment/35090626

http://stackoverflow.com/comment/95100264
type: Comment
comment on: http://stackoverflow.com/a/54132244
score: 0
has text: Changed names to help Olivier's abstract thinking.
type: AnswerComment

http://stackoverflow.com/a/23127766
answers question: http://stackoverflow.com/q/23127593
type: Answer
score: 0
has body: What you are describing has nothing to do with jQuery. ${departmentList } in your jsp is processed on the server side, not the client side. What the engine that processes jsp does in this case is perfectly logical, it calls toString just like System.out.println() would if you passed it departmentList When however you use ${departmentList.name } the engine that processes the jsp page will automatically can the getName method on the object

http://stackoverflow.com/a/22996294
answers question: http://stackoverflow.com/q/22995982
downvote count: 0
type: Answer
has body: you did a mistake there in initJList() function, you already have passed value of listModel before itself, and again you have passed this value here in this function , so commenting this line will solve the problem. the modified function will look like this here: private void initJList() { selectedItems.setVisibleRowCount(8); selectedItems.setFixedCellWidth(300); selectedItems.setFixedCellHeight(40); selectedItems.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); selectedItems.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); //selectedItems = new JList&lt;String&gt;(listModel); scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); } Otherwise : Declaring the JList like this public JList&lt;String&gt; selectedItems; and keeping the function as it is will run fine.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35125410
accepted answer of: http://stackoverflow.com/q/22995982
type: AcceptedAnswer

http://stackoverflow.com/a/22975542
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35084971
answers question: http://stackoverflow.com/q/22975394
type: Answer
has body: Here is an example FXML: https://github.com/SnakeDoc/superD/blob/master/src/com/vanomaly/superd/view/MainWindow.fxml Here is an example controller class: https://github.com/SnakeDoc/superD/blob/master/src/com/vanomaly/superd/controller/MainWindowController.java As you will notice, in your FXML you can specify a Controller. Or, like in this example: https://github.com/SnakeDoc/superD/blob/master/src/com/vanomaly/superd/Main.java You can specify your controller in java code during the start up of your JavaFX application. It doesn't matter which, but don't do both (you will get an error). Then, in your controller, you can use the @FXML annotation to link that variable to the correct GUI control in your FXML that has the same fx:id as the variable name (see examples again). Then you can just use that variable like any other GUI control. :) Example: @FXML private Label targetLabel; Is defined in the controller. And in the FXML, there is: &lt;Label fx:id="targetLabel" layoutX="26.0" layoutY="16.0" styleClass="contrast-label" text="Target(s) :" /&gt; Notice how the fx:id is the same as the variable name? This tells JavaFX to link them (they are the same).
accepted answer of: http://stackoverflow.com/q/22975394
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/35085689

http://stackoverflow.com/q/22990270
downvote count: 0
has answer: http://stackoverflow.com/a/22990411
answer count: 3
tagged with: exception
has answer: http://stackoverflow.com/a/22990542
favorite count: 0
has title: Java Hibernate, a way to track native exceptions
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22990556
accepted answer: http://stackoverflow.com/a/22990556
type: AnsweredQuestion
score: 1
possible better answer: http://stackoverflow.com/a/22990542
tagged with: java
tagged with: hibernate
tagged with: try-catch
has body: String nativeSql = "Some random non-sql stuff"; Session sess = sessionFactory.openSession(); List &lt;?&gt; result = sess.createSQLQuery(nativeSql).list(); In case, if nativeSql request isn't a valid one, how do I catch a native exception (ex: PSQLException)?

http://stackoverflow.com/comment/35114115
score: 0
comment on: http://stackoverflow.com/a/22992254
type: AnswerComment
has text: When You create javascript file You Can specificate The package White you create It
type: Comment

http://stackoverflow.com/comment/35264197
type: QuestionComment
has text: Why are you using Document.toString() at all? It isn't obliged to have any specific behaviour. Try use the Document interface correctly.
comment on: http://stackoverflow.com/q/23073304
score: 0
type: Comment

http://stackoverflow.com/comment/35075256
comment on: http://stackoverflow.com/a/22969148
has text: Looks pretty explanatory. In case of OOM, the finally block __will be executed__.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23053240
score: 0
has answer: http://stackoverflow.com/a/23055098
has answer: http://stackoverflow.com/a/23053927
has body: i am trying to install java and hadoop in Cantos BUT when I logging to 'vi .bashrc` and i had enter these commands export JAVA_HOME=/usr/lib/jdk1.7.0_51 export PATH=$PATH:$JAVA_HOME/bin export HADOOP_HOME=/usr/lib/hadoop-0.20.2-cdh3u export PATH=$PATH:$HADOOP_HOME/bin after that i want to check the java version by writing this command $ java -version this message show to me bash: java: java command not found what i do ??????????? help please ^_^
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23054028
tagged with: java
has comment: http://stackoverflow.com/comment/35259522
type: Question
has title: hadoop and java installing
tagged with: hadoop
answer count: 3
tagged with: centos

http://stackoverflow.com/comment/35296213
type: Comment
type: QuestionComment
score: 2
has text: You _reuse_ the builder; it is "normal" although I can't make up the logical output of your result. You can't reuse builders, unless you have a way to "reset" them
comment on: http://stackoverflow.com/q/23092390

http://stackoverflow.com/comment/35146577
has text: Why not? Sure you can.
score: 0
comment on: http://stackoverflow.com/a/23008599
type: Comment
type: AnswerComment

http://stackoverflow.com/q/23128751
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35360719
has comment: http://stackoverflow.com/comment/35361465
tagged with: quicksort
tagged with: linked-list
answer count: 0
tagged with: java
has body: note: this is related to a homework question I'm trying to sort a LinkedList type WordPair (WordPair contains string wordA, and wordB) of a variable size, smaller ones work fine, but when I try to sort a list with thousands of words, if freezes every time without fail, and this is the second sort method I've tried. I've heard of garbage collecting but have no idea how to use it or if it would even help. Does anyone know how to make this method more efficient without changing the data types? also if you run this you'll notice the descending method does not work, i thought all i'd have to do is copy the ascending and swap the two greater that or less than symbols in the partition functions, but i guess not. so if you could point me in the right direction to fix that as well, it'd be greatly appreciated. this is my Quicksort class... import java.util.LinkedList; public class Quicksort{ private Partition p = new Partition(); public void sortAscending(LinkedList&lt;WordPair&gt; dictionary, int min, int max){ int pivot; if(min &lt; max){ pivot = p.partitionAscending(dictionary, min, max); sortAscending(dictionary, min, pivot-1); sortAscending(dictionary, pivot+1, max); System.gc(); } } public void sortDescending(LinkedList&lt;WordPair&gt; dictionary, int min, int max){ int pivot; if(min &lt; max){ pivot = p.partitionDescending(dictionary, min, max); sortAscending(dictionary, min, pivot-1); sortAscending(dictionary, pivot+1, max); System.gc(); } } public static void main(String[] args){ } } and my partition class... import java.util.LinkedList; public class Partition{ public static int partitionAscending(LinkedList&lt;WordPair&gt; dictionary, int min, int max){ WordPair pivotpoint = dictionary.get(min); int left = min; int right = max; while(left &lt; right){ while (dictionary.get(left).getWordA().compareToIgnoreCase(pivotpoint.getWordA()) &lt;= 0 &amp;&amp; left &lt; right) left++; while (dictionary.get(right).getWordA().compareToIgnoreCase(pivotpoint.getWordA()) &gt; 0) …
type: Question
has comment: http://stackoverflow.com/comment/35360469
has comment: http://stackoverflow.com/comment/35360752
tagged with: sorting
has comment: http://stackoverflow.com/comment/35360917
score: 0
has comment: http://stackoverflow.com/comment/35360751
has comment: http://stackoverflow.com/comment/35360295
has title: QuickSort not quick enough

canvas
tags question: http://stackoverflow.com/q/23074139
tags question: http://stackoverflow.com/q/22977438
tag name: canvas
type: Tag

http://stackoverflow.com/q/23123885
score: -3
has comment: http://stackoverflow.com/comment/35351967
has comment: http://stackoverflow.com/comment/35352357
linked to: http://stackoverflow.com/q/6812543
tagged with: java
downvote count: 3
type: Question
has body: I am attempting to locate a specific number within an array and then print out how many times it is IN the array. public static int favorite(int[] digit, int fave) { for (int x = 0; x &lt;digit.length; x++) { if ( digit[x] == fave) {return x;} } return -1; } Would something like that work? And What would I do to print it out? favorite(int[]digit, fave); doesn't seem to make sense to me.
has comment: http://stackoverflow.com/comment/35351794
upvote count: 0
tagged with: arrays
answer count: 1
tagged with: int
has title: I need assistance with printing something out within an array
favorite count: 0
has answer: http://stackoverflow.com/a/23123922
type: UnansweredQuestion

http://stackoverflow.com/comment/35154935
type: Comment
type: QuestionComment
score: 0
has text: I get no error... Could you provide the input string that makes this error get thrown?
comment on: http://stackoverflow.com/q/23014823

http://stackoverflow.com/a/23129134
type: Answer
upvote count: 53
downvote count: 0
answers question: http://stackoverflow.com/q/23128952
accepted answer of: http://stackoverflow.com/q/23128952
score: 53
has body: I found how to do this ! Use the 'Project and Libraries' Custom Scope.
type: AcceptedAnswer

http://stackoverflow.com/q/23017003
tagged with: java
type: UnansweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: exception
has title: How to check if a string is in the correct input when entered?
tagged with: character
tagged with: joptionpane
has body: I have a problem where i'm using a joptionpane to get the postal code of a user. I'm trying to check if the format is in L#L#L#L where L is a letter and # is a number. I'm trying to provide error checks to see if the postal code is in that format. I keep getting out of bounds errors if i look for a string that doesn't exist i.e. string.charAt(5) but I don't know how to fix it. this is the current code that i'm erroring at String postalCode = JOptionPane.showInputDialog("Enter customer(s) " + (count + 1) + " postal code"); if (Character.isLetter(postalCode.charAt(0)) &amp;&amp; Character.isDigit(postalCode.charAt(1)) &amp;&amp; Character.isLetter(postalCode.charAt(2)) &amp;&amp; Character.isDigit(postalCode.charAt(3)) &amp;&amp; Character.isLetter(postalCode.charAt(4)) &amp;&amp; Character.isDigit(postalCode.charAt(5))) { } else { }
has answer: http://stackoverflow.com/a/23017039
upvote count: 1
answer count: 1

http://stackoverflow.com/a/22986981
score: 3
downvote count: 0
has body: toString() method in Object is public String toString() { return getClass().getName() + "@" + Integer.toHexString(hashCode()); } which is exactly what will get printed. You need to override it in Node class to show your output of toString().
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/22986918

e4
tags question: http://stackoverflow.com/q/23107835
type: Tag
tag name: e4

http://stackoverflow.com/comment/35074171
type: AnswerComment
comment on: http://stackoverflow.com/a/22969907
score: 0
type: Comment
has text: So because a block specifies the scope in Java the buffer is going out of scope after the if block and is not available for the rest of code.

http://stackoverflow.com/a/22978378
has comment: http://stackoverflow.com/comment/35089628
type: Answer
has comment: http://stackoverflow.com/comment/35089772
downvote count: 0
has comment: http://stackoverflow.com/comment/35089422
score: 1
has comment: http://stackoverflow.com/comment/35089888
has comment: http://stackoverflow.com/comment/35089686
upvote count: 1
has comment: http://stackoverflow.com/comment/35089812
accepted answer of: http://stackoverflow.com/q/22977938
answers question: http://stackoverflow.com/q/22977938
has body: If you're worried about performance, definitely do not use any list or collection classes. They are notorious for re-allocating arrays frequently as they need more capacity, which is a very slow operation. Unfortunately, I don't know how you create/fill the set of indices. If it is possible for you to have your set in an array as well and generate it in such a way that its entries are sorted, you can optimize your code significantly. If set is fairly long compared to oldArray, do this (this assumes no duplicate entries in set!): int l = oldArray.length; // Cache length (some compilers might do this for you) for (int i=0, j=0, k=0; i&lt;l; i++) { if (set[k]==i) { k++; } else { newArr[j++] = oldArray[i]; } } If set is fairly short, do this (this can handle duplicate entries, but set still needs to be sorted): int o1=0; int o2=0; for (int p:set) { System.arraycopy(oldArray, o1, newArr, o2, p-o1); o1+=p+1; o2+=p; } System.arraycopy(oldArray, o1, newArray, o2, oldArray.length-o1); The former avoids function calls and the latter banks on the optimized memory-copy implementation of System.arraycopy(...) (and set can be any sorted Iterable, although an array will be faster). Which one is faster will depend on the exact sizes of your arrays and which system (CPU, JVM) you use. If set is not sorted, you can either use your approach (debugged, of course) or you can sort it first and then use one of the approaches here. Again, which one will give you better performance will depend on the size of set and your system.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35089941
has comment: http://stackoverflow.com/comment/35089564

http://stackoverflow.com/q/22974985
accepted answer: http://stackoverflow.com/a/22975672
favorite count: 0
tagged with: android
tagged with: junit3
type: AnsweredQuestion
has title: Unable to run espresso tests for android
score: 1
tagged with: java
upvote count: 1
has body: I am having some issues setting up/running espresso tests for android. My TestClass looks like below:- import static com.google.android.apps.common.testing.ui.espresso.Espresso.onView; import static com.google.android.apps.common.testing.ui.espresso.action.ViewActions.click; import static com.google.android.apps.common.testing.ui.espresso.assertion.ViewAssertions.matches; import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withId; import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withText; import android.test.ActivityInstrumentationTestCase2; import android.util.Log; import com.sample.rasmus.MainActivity; public class BasicTest extends ActivityInstrumentationTestCase2&lt;MainActivity&gt; { public BasicTest(String name) { super(MainActivity.class); Log.v("amtesting","2"); } @Override public void setUp() throws Exception { Log.v("amtesting","5"); super.setUp(); Log.v("amtesting","4"); // Espresso will not launch our activity for us, we must launch it via getActivity(). getActivity(); } public void testSimpleClickAndCheckText(){ Log.v("amtesting","1"); onView(withId(com.sample.rasmus.R.id.thebutton)).perform(click()); onView(withId(com.sample.rasmus.R.id.helloworld)).check(matches(withText("awesome"))); } protected void tearDown() throws Exception { Log.v("amtesting","3"); super.tearDown(); } } AndroidManifest.xml looks like this:- &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sample.rasmus.test" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="14" /&gt; &lt;instrumentation android:name="com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner" android:targetPackage="com.sample.rasmus" /&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" &gt; &lt;uses-library android:name="android.test.runner" /&gt; &lt;/applicati…
tagged with: android-espresso
type: Question
answer count: 1
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/22975672

http://stackoverflow.com/comment/35249887
type: AnswerComment
type: Comment
has text: No that's not what I want. I know what I want... The reason I want this is to be able to export my program as a jar file as easy as I can press the play button in eclipse without any extra programs. Automatically exporting when I run the program would also work. In the end I want to build the jar, upload it to my server through scp and then execute it. Editing an ant script for every little program is not a good solution. This is no big enterprise solution project. Just small java programs with 1-3 classes
comment on: http://stackoverflow.com/a/23064264
score: 0

http://stackoverflow.com/comment/35077940
comment on: http://stackoverflow.com/a/22972044
has text: The sellerCodeList is a map containing a database Key, value pair. I need both of them. Also, could you please advise the way to use sellerCodeListJs..Thanks
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35092531
has text: Thank you for the suggestion, but I am getting the same error. Is there any other java code that will help me to get the soap request xml.
comment on: http://stackoverflow.com/a/22979793
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/100475711
type: QuestionComment
score: 0
has text: See also [Convert Iterable to Stream using Java 8 JDK](https://stackoverflow.com/questions/23932061/convert-iterable-to-stream-using-java-8-jdk) for practical workarounds.
comment on: http://stackoverflow.com/q/23114015
type: Comment

http://stackoverflow.com/a/23097342
has body: I actually figured it out. Here is my way of doing it: private static JButton[][] b = {{new JButton(), new JButton() , new JButton() , new JButton() , new JButton() , new JButton() }, {new JButton(), new JButton() , new JButton() , new JButton() , new JButton()}, {new JButton(), new JButton() , new JButton() , new JButton() , new JButton()}, {new JButton(), new JButton() , new JButton() , new JButton() , new JButton()}, {new JButton(), new JButton() , new JButton() , new JButton() , new JButton()}}; and then I just add them to a panel for (int i = 0; i &lt; b.length; i++) { for (int j = 0; j &lt;b[i].length; j++) { panel.add(b[i][j]); } }
score: 0
has comment: http://stackoverflow.com/comment/35313163
answers question: http://stackoverflow.com/q/23096698
type: Answer

http://stackoverflow.com/comment/35306153
has text: error stack trace.. that tells u which symbol
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23097890

http://stackoverflow.com/a/27301641
upvote count: 1
type: Answer
has body: By following the advice in the deprecation warning, I have found it possible to overcome this problem with a relatively tidy Spring bean creation of the Entity Manager Factory. Starting here: WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead. We can see the path to obtain a class compatible with javax.persistence.EntityManagerFactory from the HibernatePersistenceProvider javadocs. First you need an instance of the HibernatePersistenceProvider, then the createEntityManagerFactory method is called. Here is the Spring Bean wiring which avoids the deprecation warning: There is a Stackoverflow thread here showing the maven dependencies.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23041964

http://stackoverflow.com/a/23017335
type: Answer
upvote count: 5
has body: You need to seperate the number incrementation from the if/else statements. It should happen at each iteration no matter what... int j = 1; int number = 100; while (number &lt; 1001) { if (number % 6 == 0 || number % 5 == 0) { System.out.print(number + ", "); j++; } if (j % 10 == 0) { System.out.println(); } number++; }
has comment: http://stackoverflow.com/comment/35159757
answers question: http://stackoverflow.com/q/23017206
downvote count: 0
score: 5
has comment: http://stackoverflow.com/comment/35160648
has comment: http://stackoverflow.com/comment/35160173
has comment: http://stackoverflow.com/comment/35160483

http://stackoverflow.com/a/51437655
answers question: http://stackoverflow.com/q/22979389
has body: Using the Java VM argumet -d64 -Xmx6G its posible to increase up to 6GB in a 64 bits config IOUtils.toString((InputStream) new FileInputStream("C://exocerebro//userrecord.sql"), "UTF-8");
score: 0
type: Answer

http://stackoverflow.com/comment/35295347
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23091608
has text: @Pshemo In this case, the possessive quantifiers shouldn't change the language right?

http://stackoverflow.com/a/22984736
answers question: http://stackoverflow.com/q/22981849
has body: I was having a project coded in pl/sql that comes across the case like yours. My variable is stored in a String and I have to check if the number was already in the String variable. I did it from using IF instr('2,3,6,8,9,' '2,') &lt;= 0 THEN ' Code to append the '2,' End If For JAVA there is something similar to instr method, String.indexOf() http://www.tutorialspoint.com/java/java_string_indexof.htm However note that it will return 0 if it's the first character, so probably it will be &lt; 0 String a = "2,3,6,8,9,"; If a.indexOf(ID + ",") &lt; 0 { // -1 equivalent to NOT FOUND // code to append ID + ","; } Note I need to check on ID + "," reason is e.g. ID = "2"; a = "20,3,6,8,9,"; It will return me 0 due to the 20. Therefore I'm using comma as a delimiter for every number found. So after I finish append variable a, I would remove the last comma by a = a.substring(0, a.length()-1); // this will remove the last "," System.out.println(a); // the output should be - 2,3,6,8,9 This is using Java if your variable is stored in Java.
score: 0
type: Answer

http://stackoverflow.com/q/23022532
tagged with: combobox
accepted answer: http://stackoverflow.com/a/23022668
score: 2
has comment: http://stackoverflow.com/comment/35188413
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35188548
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35188366
answer count: 2
tagged with: null
has comment: http://stackoverflow.com/comment/35188412
has comment: http://stackoverflow.com/comment/35188651
has title: How to check if a selected item from an editable Combobox is empty
has comment: http://stackoverflow.com/comment/35188309
has answer: http://stackoverflow.com/a/23022668
has comment: http://stackoverflow.com/comment/35188682
has comment: http://stackoverflow.com/comment/35188617
has comment: http://stackoverflow.com/comment/35169977
downvote count: 0
tagged with: string
possible better answer: http://stackoverflow.com/a/23022682
has comment: http://stackoverflow.com/comment/35188356
has comment: http://stackoverflow.com/comment/35169999
favorite count: 0
has answer: http://stackoverflow.com/a/23022682
has comment: http://stackoverflow.com/comment/35188697
upvote count: 2
has body: I have an editable ComboBox where the user can select a database or type the name of a new one and press Enter or the button Create to create it. What I have found is a strange behavior of the Editable ComboBox, if say there was something selected in the combobox like this: and then the user deletes it like this: and presses the Enter key or the Create button, then this code is not enough to check if there is no selected item in the ComboBox: if (jDatabaseComboBox.getSelectedItem() == null) { return; } So I opted to check it like this: if (jDatabaseComboBox.getSelectedItem() == null || jDatabaseComboBox.getSelectedItem().toString().isEmpty()) { return; } My question is: is my way of checking the selected item cheap and is there a more elegant way? Here is how I did it in the end: ComboBox and Create button private void jDatabaseComboBoxActionPerformed(java.awt.event.ActionEvent evt) { final String selectedDatabaseName = jDatabaseComboBox.getSelectedItem(). toString().trim(); if (selectedDatabaseName.isEmpty()) { return; } if (databaseAlreadyExistsInServer(selectedDatabaseName)) { _currentDatabase = new SQLDatabase(selectedDatabaseName); updateTableComboBoxes(); } else { createANewDatabase(selectedDatabaseName); updateDatabaseComboBoxes(); } System.out.println(); } Delete Button private void jDeleteDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) { final String selectedDatabaseName = jDatabaseComboBox.getSelectedItem(). toString().trim(); if (selectedDatabaseName.isEmpty()) { return; } if (!databaseAlreadyExistsInServer(selectedDatabaseName)) { return; } deleteDatabase(selectedDatabaseName); updateDatabaseComboBoxes(); System.out.println(); } I don't check for null anymore because I have it so that if the comboBoxes are empty then they will be grayed out.
tagged with: swing

http://stackoverflow.com/comment/35209443
type: AnswerComment
type: Comment
has text: Is this true for any vaiant of: MyClass.class.getResourceAsStream(...), this.getClass().getResourceAsStream(...), MyClass.class.getClassLoader().getResourceAsStream(...)?
comment on: http://stackoverflow.com/a/23041578
score: 0

http://stackoverflow.com/comment/35096780
score: 1
type: Comment
comment on: http://stackoverflow.com/a/22981950
has text: @Evgeniy Dorofeev **blocks A and B cannot run simultaneously** Can you write example with **Thread.sleep** when A will wait B or B will wait A ?
type: AnswerComment

http://stackoverflow.com/comment/35309469
type: QuestionComment
type: Comment
has text: I request you to change subject of question to 'Get extract host name/domain name from url string' please do needfull
score: 0
comment on: http://stackoverflow.com/q/23079197

http://stackoverflow.com/q/23033245
tagged with: applet
has answer: http://stackoverflow.com/a/23053883
favorite count: 0
has comment: http://stackoverflow.com/comment/38478150
upvote count: 3
type: UnansweredQuestion
type: Question
has body: I've made a cool processing project that I would like to embed on the web; however, it uses 3rd party Java libraries to access an sqlite database. For this reason, the normal export-to-javascript which has worked well for me in the past is just not capable enough here. How can I make my Processing project into a Java applet that will allow it to be run remotely?
tagged with: processing
score: 3
has title: Export Processing Project as aWeb App
tagged with: java
downvote count: 0
answer count: 1

data-structures
tags question: http://stackoverflow.com/q/23117151
tag name: data-structures
tags question: http://stackoverflow.com/q/23078251
tags question: http://stackoverflow.com/q/23112846
tags question: http://stackoverflow.com/q/23106952
tags question: http://stackoverflow.com/q/23006647
tags question: http://stackoverflow.com/q/23117581
tags question: http://stackoverflow.com/q/23036650
tags question: http://stackoverflow.com/q/23015477
tags question: http://stackoverflow.com/q/23050238
tags question: http://stackoverflow.com/q/22977276
type: Tag
tags question: http://stackoverflow.com/q/23047589
tags question: http://stackoverflow.com/q/23093381

http://stackoverflow.com/q/23045869
favorite count: 0
has comment: http://stackoverflow.com/comment/35211467
downvote count: 0
has answer: http://stackoverflow.com/a/23046055
type: UnansweredQuestion
tagged with: fileutils
has title: Java FileUtils: remove specific line from file
score: 1
tagged with: java
type: Question
answer count: 1
linked to: http://stackoverflow.com/q/1377279
has body: How can I delete a specific line (by index) from a text file with the class org.apache.commons.io.FileUtils? The index of the line to be deleted already know him, so I need some method that I delete a specific line from a file.
upvote count: 1
has comment: http://stackoverflow.com/comment/35211577

http://stackoverflow.com/q/23035080
has body: I have the following bean definition as below, Class A{ int id Date date; } Class B{ int id Date date; } I have array List as following List&lt;A&gt; l1 = new ArrayList&lt;A&gt;() l1.add(new A(1, 2014-12-12)); l1.add(new A(2, 2014-12-14)); List&lt;B&gt; l2 = new ArrayList&lt;B&gt;() l2.add(new B(1, 2014-12-13)); l2.add(new B(2, 2014-12-15)); Another List as follows List&lt;Object&gt; finalList = new ArrayList&lt;Object&gt;(); now is there anyway i can put object of l1 and l2 in the finalList according to the date e.g. The finalList should be as following A(1, 2014-12-12); B(1, 2014-12-13); A(2, 2014-12-14); B(2, 2014-12-15); how can I do this??
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23035289
tagged with: java
tagged with: collections
has comment: http://stackoverflow.com/comment/35192094
downvote count: 1
has answer: http://stackoverflow.com/a/23035192
possible better answer: http://stackoverflow.com/a/23036216
type: Question
has comment: http://stackoverflow.com/comment/35192180
has answer: http://stackoverflow.com/a/23036216
has comment: http://stackoverflow.com/comment/35192154
has comment: http://stackoverflow.com/comment/35192212
score: -1
has answer: http://stackoverflow.com/a/23035295
has comment: http://stackoverflow.com/comment/35192136
upvote count: 0
has comment: http://stackoverflow.com/comment/35192076
favorite count: 0
has comment: http://stackoverflow.com/comment/35192122
accepted answer: http://stackoverflow.com/a/23035295
has title: Sort list of Object order by date

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/22982570
tags question: http://stackoverflow.com/q/23080214
type: Tag
tags question: http://stackoverflow.com/q/23090458
tags question: http://stackoverflow.com/q/23120860
tags question: http://stackoverflow.com/q/23092741
tags question: http://stackoverflow.com/q/23042889

http://stackoverflow.com/a/22977104
has comment: http://stackoverflow.com/comment/35087085
answers question: http://stackoverflow.com/q/22976998
has body: I would use a while loop to get back to the top of you if/else blocks: while (1) { incrd = gus.nextDouble(); if (incrd == 1) { hot += 2.5; cold = cold - 2.5; } else if (incrd == 2) { hot = hot - 2.5; cold += 2.5; } else if (incrd == 3){ hot += 2.5; cold += 2.5; } else if (incrd == 4){ hot = hot - 2.5; cold = cold - 2.5; } else { // 3 &amp; 4 are valid options also ! System.out.println ("invalid Number please enter either 1 or 2"); } System.out.println(hot); System.out.println(cold); } // end of INFINITE while loop
score: 0
type: Answer

http://stackoverflow.com/comment/35223644
has text: What details you are expecting from a page? Can not you use graph apis??
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23052170
score: 1

http://stackoverflow.com/a/23001808
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23001712
downvote count: 0
has body: You don't call the actionPerformed methods in the addValues method, since these methods are called by events and are almost never called directly by you the coder. Instead simply query both JSlider values when the JCheckBox is checked. You've not clarified your class structure enough for me to guess what you mean by: Then I want to take this value and add it together in a separate class. Also you state that you don't know how to call a "private class" without explaining just what you mean by this, and I have a strong feeling that you're using incorrect terminology since the only private classes I know of are private inner classes, and I'm pretty sure that you didn't mean these. Again you need to post more clarification and code.
type: Answer

http://stackoverflow.com/comment/35268981
has text: What method are you using to determine that "It only takes 304"?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23077242
type: Comment

http://stackoverflow.com/q/23072055
has comment: http://stackoverflow.com/comment/35259577
score: 0
tagged with: java
tagged with: bukkit
tagged with: file
has title: Enter command with each line from a file
has body: I am trying to write a plugin that reads a file line by line and then enters a command in the console with each name as separate commands. This does contain code which relies on the Bukkit API, but it should be simple enough to figure out. I am currently using a Scanner, but is a BufferedReader would be better, let me know. Currently, the scanner prints fine without the extra Bukkit code. Current code: public class FixWhitelist extends JavaPlugin { public static void main(String[] args) { FixWhitelist scanner = new FixWhitelist(); scanner.readFile("white-list.txt"); } public void readFile(String path) { try { Scanner sc = new Scanner(new File(path)); while(sc.hasNextLine()) { String next = sc.nextLine(); //System.out.println(next); Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "whitelist add" + next); Bukkit.getServer().getConsoleSender().sendMessage(next + "added to the whitelist."); } sc.close(); } catch (FileNotFoundException ex) { Logger.getLogger(FixWhitelist.class.getName()).log(Level.SEVERE, null, ex); } } } So, the question is, how can I have a command entered for each line of code in a file?
type: Question
tagged with: minecraft
has comment: http://stackoverflow.com/comment/35259583
has comment: http://stackoverflow.com/comment/35259648
has answer: http://stackoverflow.com/a/23072086
has comment: http://stackoverflow.com/comment/35259676
answer count: 1
tagged with: java.util.scanner
type: UnansweredQuestion

matrix
tags question: http://stackoverflow.com/q/22978696
tag name: matrix
tags question: http://stackoverflow.com/q/23057891
tags question: http://stackoverflow.com/q/23002218
tags question: http://stackoverflow.com/q/23047192
tags question: http://stackoverflow.com/q/23038325
tags question: http://stackoverflow.com/q/22999298
tags question: http://stackoverflow.com/q/23053935
tags question: http://stackoverflow.com/q/22995146
tags question: http://stackoverflow.com/q/23016552
tags question: http://stackoverflow.com/q/23000032
tags question: http://stackoverflow.com/q/23092747
type: Tag

http://stackoverflow.com/a/23106139
accepted answer of: http://stackoverflow.com/q/23103844
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23103844
type: Answer
has body: There are two ways to implement a functional interface, that refers to this: Lambda expression: fot -&gt; reduceByThis(fot) Method reference: this::reduceByThis A lambda expression can access this in the same way as the enclosing scope. That means you can invoke the method reduceByThis both with and without qualification. For the method reference, that target object can be explicitly bound. The following example only shows the latter: public List&lt;FriendOfTarget&gt; reduce() { return completeListOfFriendOfTargets .stream() .filter(this::reduceByThis) .collect(toList()); } You can also use this explicitly in lambda expressions. As I have already mentioned, it refers to the this of the enclosing scope (in contrast to anonymous inner classes). For example: public List&lt;FriendOfTarget&gt; reduce() { return completeListOfFriendOfTargets .stream() .filter(fot -&gt; fot.reduceOtherDirection(this)) .collect(toList()); }
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35319227

http://stackoverflow.com/q/23074381
has answer: http://stackoverflow.com/a/57631651
has comment: http://stackoverflow.com/comment/35275244
possible better answer: http://stackoverflow.com/a/29424382
favorite count: 0
has comment: http://stackoverflow.com/comment/35278638
tagged with: buildpath
has comment: http://stackoverflow.com/comment/35264620
has comment: http://stackoverflow.com/comment/38151489
has answer: http://stackoverflow.com/a/26021477
has comment: http://stackoverflow.com/comment/42446749
accepted answer: http://stackoverflow.com/a/26151468
tagged with: android
tagged with: maven
has comment: http://stackoverflow.com/comment/35275944
linked to: http://stackoverflow.com/q/10866431
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27028985
tagged with: java
has answer: http://stackoverflow.com/a/30520620
has comment: http://stackoverflow.com/comment/35275825
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35268934
answer count: 8
has answer: http://stackoverflow.com/a/37527140
score: 18
downvote count: 0
has answer: http://stackoverflow.com/a/26151468
has title: Didn't find class on path: dexpathlist
upvote count: 18
has answer: http://stackoverflow.com/a/49993013
has answer: http://stackoverflow.com/a/29424382
has comment: http://stackoverflow.com/comment/38173599
has body: Seriously, i don't know what to do to solve this problem. My android project was working fine, until i needed to import a library with Maven. Since that, everything started to collapse. What is happening: When i start my application, the following error appears on LogCat and android tells that my app stopped working. I've searched for this similar error here AND on the rest of the internet, but everything people did haven't worked for me. Error: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.buscaserra/com.buscaserra.main.ActivitySplash}: java.lang.ClassNotFoundException: Didn't find class "com.buscaserra.main.ActivitySplash" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.example.buscaserra-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.buscaserra-2, /vendor/lib, /system/lib]] Manifest and packages: Build Path:

http://stackoverflow.com/comment/35162815
type: QuestionComment
has text: So basically I must override the species method in my parent class and ADD the private variable in my subclass to it
score: 0
comment on: http://stackoverflow.com/q/23018854
type: Comment

http://stackoverflow.com/q/23109549
has comment: http://stackoverflow.com/comment/35344018
type: Question
tagged with: gwt
has title: Embeded Google Doc Editor GWT when not logged in
tagged with: java
has comment: http://stackoverflow.com/comment/35362198
score: 0
has body: I'm using Google Drive in GWT based application. Basically I'm uploading files from my system to Google Drive and then based on the doc link I'm displaying uploaded document to edit it. I'm using Frame control to do this. However, when I'm synchronized with Google Drive but I'm not logged in to my Google Account, document isn't displayed and I'm not asked to login to my Google Account. When I paste URL into my browser I'm asked to login, as it should be. Is there any way to check if I'm logged in and ask user to do it otherwise?
has comment: http://stackoverflow.com/comment/35327171
tagged with: google-drive-api
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/40969762
type: AnswerComment
score: 0
type: Comment
has text: @AhmedMasud than go and make an application which does something simple and ask 100 people to use 'their language' to execute commands in the application...
comment on: http://stackoverflow.com/a/22984126

http://stackoverflow.com/comment/35094195
type: Comment
has text: @ifLoop If I had a purpose from my comment, I **WILL** be sure that you'll get exactly the message I want you to get, trust me.
type: QuestionComment
comment on: http://stackoverflow.com/q/22981210
score: 0

http://stackoverflow.com/q/22994479
has comment: http://stackoverflow.com/comment/35117946
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35118647
downvote count: 5
tagged with: http://stackoverflow.com/tag/c
has title: How many clock cycles for variable assignment in C?
has answer: http://stackoverflow.com/a/22994765
has comment: http://stackoverflow.com/comment/35118435
has comment: http://stackoverflow.com/comment/35118350
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35120372
score: -2
has comment: http://stackoverflow.com/comment/35118084
tagged with: performance
has body: Does anyone know how many clock cycles it takes for a variable assignment in C language on a x86 platform? It is generally considered to take less when compared to java, what is the reason behind it?
has comment: http://stackoverflow.com/comment/35117973
has answer: http://stackoverflow.com/a/22994858
upvote count: 3
tagged with: java

http://stackoverflow.com/a/23028856
type: Answer
downvote count: 0
score: 1
has body: Your JSON has escaped the backslash, which means it's the JSON representation of "backslash u 20ac". All you need to do is not escape the backslash, so that \u20ac is the JSON-escaped version of the Euro symbol: "symbol": "\u20ac" I'd also suggest using Guava to load your string, with a try-with-resources statement: String json; try (Reader reader = new InputStreamReader(context.getAssets().open("currencies.json"), Charsets.UTF_8)) { json = CharStreams.toString(reader); }
accepted answer of: http://stackoverflow.com/q/23028358
answers question: http://stackoverflow.com/q/23028358
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/23046413
accepted answer of: http://stackoverflow.com/q/23046048
type: Answer
answers question: http://stackoverflow.com/q/23046048
has body: If you have an array like ArrayList, you need not to unpack it and extract the string what you wanted and add it to another array just to input it to a listview. Just override the toString() method in your DiaryLogs class and return it with the strings of your choice (e.g. timeEntry &amp; entryEntered). like // class DiaryLogs class DiaryLogs { ... @Override public toString() { return dateTime + " - " + entryName; } ... } // in your activity ArrayList&lt;DiaryLogs&gt; diaryLogs = new ArrayList&lt;DiaryLogs&gt;(); diaryLogs.add(new DiaryLogs(1, "Apr. 14, 2014", "Entry 1")); diaryLogs.add(new DiaryLogs(1, "Apr. 14, 2014", "Entry 2")); diaryLogs.add(new DiaryLogs(1, "Apr. 14, 2014", "Entry 3")); yourListView.setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, diaryLogs)); yourListView is obviously the listview that you are using.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35214868
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/71238763
has comment: http://stackoverflow.com/comment/132993403
has comment: http://stackoverflow.com/comment/132993374
has comment: http://stackoverflow.com/comment/126088712
score: 0
answers question: http://stackoverflow.com/q/22997757
has body: None of the other answers worked for me very well (possibly because of changes to Gradle - I'm using v7.4). I ended up copying my persistence.xml (with &lt;exclude-unlisted-classes&gt;false&lt;/exclude-unlisted-classes&gt; in it) into my classes directory and then running the EclipseLink Weaver. I put it as part for doLast for the Java Compile which I think will allow Gradle to cache compilation in the normal way (although I'm not fully clear on this) - the alternative is before the Jar task but I want to make sure that local behaviour is identical to deployed behaviour for things like lazy loading. tasks.withType(JavaCompile) { doLast { def path = sourceSets.main.compileClasspath def listOfUrls = path.collect {f -&gt; f.toURI().toURL()} as URL[] def loader = new URLClassLoader(listOfUrls) //Finding classes only works from the root containing persistence.xml containing directory downwards def xmlContents = new File(sourceSets.main.resources.srcDirs.iterator().next(), 'META-INF/persistence.xml').text def tempDir = new File(sourceSets.main.output.classesDirs.singleFile, 'META-INF') tempDir.mkdirs() def tempFile = new File(tempDir, 'persistence.xml') tempFile.delete() tempFile &lt;&lt; xmlContents xmlContents = null def proc = new org.eclipse.persistence.tools.weaving.jpa.StaticWeaveProcessor( sourceSets.main.output.classesDirs.singleFile, sourceSets.main.output.classesDirs.singleFile ) proc.setLogLevel(5) proc.setClassLoader(loader) proc.setPersistenceInfo(sourceSets.main.output.classesDirs.singleFile) proc.performWeaving() tempFile.delete() tempDir.delete() } } You also have to have org.eclipse.persistence:org.eclipse.persistence.jpa as a script dependency - for me that meant adding it to buildSrc/build.gradle but for others it might mean adding a classpath entry to your buildscript dependencies like you do with Legacy plugins. I'm not happy with how I find the persistence.xml file - I'm sure there's a better way but it works for me for now and I've spent too long on…
type: Answer

http://stackoverflow.com/q/23035054
answer count: 4
has answer: http://stackoverflow.com/a/23035778
has body: import java.util.Random; public class Console { public static void main(String[] args) { while (3&gt;2) { Random rand1 = new Random(); Random rand2 = new Random(); Random rand3 = new Random(); Random rand4 = new Random(); Random rand5 = new Random(); Random rand6 = new Random(); Random rand7 = new Random(); Random rand8 = new Random(); int onenum = rand1.nextInt(2); int twonum = rand2.nextInt(2); int threenum = rand3.nextInt(2); int fournum = rand4.nextInt(2); int fivenum = rand5.nextInt(2); int sixnum = rand6.nextInt(2); int sevennum = rand7.nextInt(2); int eightnum = rand8.nextInt(2); int binary[] = {onenum, twonum, threenum, fournum, fivenum, sixnum, sevennum, eightnum}; System.out.println(java.util.Arrays.toString(binary)); How can I check if, say the first number of the binary array is one? Currently if I run, i get an output of like {1, 0, 1} ect
tagged with: java
has title: How to call if statements on arrays in java
has answer: http://stackoverflow.com/a/23035090
has comment: http://stackoverflow.com/comment/35192263
type: Question
has answer: http://stackoverflow.com/a/23035118
score: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/35193045
has answer: http://stackoverflow.com/a/23035099
type: UnansweredQuestion

http://stackoverflow.com/q/23096815
has comment: http://stackoverflow.com/comment/35304270
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/23096908
accepted answer: http://stackoverflow.com/a/23096908
tagged with: java
has comment: http://stackoverflow.com/comment/35458163
type: Question
has comment: http://stackoverflow.com/comment/35305238
has title: How to check when a key is pressed in Java
score: -2
has comment: http://stackoverflow.com/comment/35304249
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/35304281
has comment: http://stackoverflow.com/comment/35304343
favorite count: 0
has body: I want to know how to have java check if a key is pressed, for example when someone presses the "UP" key on their keyboard.

http://stackoverflow.com/a/23125575
has body: When using @Autowired directly, the injection method is byType. In other words, the container sees @Autowired private HelloWorld helloworld2; and tries to find a bean of type HelloWorld in the ApplicationContext to inject. The process of resolving the bean to be injected consists of getting all candidate beans which consists of creating the beans. So the beans being @Lazy doesn't change anything. They will still have to be created in order to be injected. To clarify M. Deinum's comment on the question, you've given your beans names. For example, @Bean(name="helloworld1") When the injection process takes place, Spring will find all candidate beans that can be injected. If there is more than one, it will filter through them and try to find the best candidate. If it can't, it will throw exceptions. One of the steps for finding a better candidate is comparing the bean name with the name of the target field. Since yours match, the bean named helloworld2 will be chosen. By removing @Autowired, the beans are never requested from the ApplicationContext and therefore never initialized.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23125397
answers question: http://stackoverflow.com/q/23125397
score: 10
upvote count: 10

http://stackoverflow.com/a/37553034
answers question: http://stackoverflow.com/q/23106952
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: C# is able to get around this with its built-in Lazy&lt;T&gt;. A Lazy is an object whose actual value has not yet been computed - when you construct a Lazy, you pass a factory function as a parameter. You can ask a Lazy for its value with the Value property. If the factory function has already run, then the already-constructed value is returned. If the factory function hasn't run, then it will run at this time. Whatever the case, the return of the Value property is always the same. Once a particular Lazy's value has been determined, it sticks. A lazy is an immutable reference to a possibly-not-yet constructed object. It uses mutability internally, but from the outside, it appears to be immutable. In your case, if you had a Java equivalent to Lazy, you would change your collections from, say, Collection&lt;Y&gt; to Collection&lt;Lazy&lt;Y&gt;&gt;. This would enable an instance of X to refer to some not-yet-constructed instances of Y. And the code which constructs the Xs, Ys, and Zs would not directly build those instances, but would instead build instances of Lazy. These instances would take factory functions as parameters; these factory functions, in turn, would need to reference to some of the Lazy values. This means that, within the context of the function that's constructing and wiring these things together, you'll need to have mutable references to Lazy instances. To see what I mean, if you try to create a cycle of two objects (I'm not completely up on Java 8, so I might have syntax errors): Lazy&lt;X&gt; a; Lazy&lt;Y&gt; b; a = new Lazy&lt;X&gt;(() -&gt; { List&lt;Y&gt; ys = new ArrayList&lt;Y&gt;(); ys.add(b.getValue()); return new X(ys); }); b = new Lazy&lt;Y&gt;(() -&gt; { List&lt;X&gt; xs = new ArrayList&lt;X&gt;(); xs.add(a.getValue()); return new Y(xs); }); In practice, I don't think that will work. I think closed-over variables need to be final in Java (this isn't the case in C#). So I think you'd need to actually do this: final Lazy&lt;X&gt;[] a = new L…
accepted answer of: http://stackoverflow.com/q/23106952

http://stackoverflow.com/comment/35303643
has text: No need to specify that. The `createALias` method works on root object.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23096051
type: Comment

http://stackoverflow.com/comment/35281036
comment on: http://stackoverflow.com/q/23077691
score: 0
type: Comment
type: QuestionComment
has text: Do you have ant.properties file for test project?

http://stackoverflow.com/comment/35308938
comment on: http://stackoverflow.com/q/23099912
type: Comment
type: QuestionComment
has text: I think gmail.com doesn't allow send mail without authentificantion
score: 1

http://stackoverflow.com/a/23101470
has body: There is no multiple inheritance in java as it is specified by the language specification. To prove it simply try to extend 2 unrelated classes: public class MyClass extends Number, AbstractList { } This will result in a compile error. You can do one thing however: Excerpt from java magic part 4: Unsafe Multiple Inheritance There is no multiple inheritance in java. Correct, except we can cast every type to every another one, if we want. long intClassAddress = normalize(getUnsafe().getInt(new Integer(0), 4L)); long strClassAddress = normalize(getUnsafe().getInt("", 4L)); getUnsafe().putAddress(intClassAddress + 36, strClassAddress); This snippet adds String class to Integer superclasses, so we can cast without runtime exception. (String) (Object) (new Integer(666)) I really do not recommend this. It is considered a "best practice" to implement multiple interfaces if you want something which resembles multiple inheritance or as others pointed out you can use composition and delegation as well.
answers question: http://stackoverflow.com/q/23101389
has comment: http://stackoverflow.com/comment/35312034
type: Answer
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/35160959
score: 0
type: Comment
has text: @LuiggiMendoza True enough, though I personally wouldn't do that. Then again, that's just me!
type: AnswerComment
comment on: http://stackoverflow.com/a/23017743

http://stackoverflow.com/q/23077820
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23078014
has answer: http://stackoverflow.com/a/23078014
has comment: http://stackoverflow.com/comment/35269971
answer count: 2
downvote count: 0
has body: I am making a project in which I want to draw a image on touch and I am able to draw the image on touch but I want to set the transparent background that I am unable to set, the code that I used is: In the manifest file: &lt;activity android:theme="@android:style/Theme.Translucent.NoTitleBar" android:name="com.trial.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; Code: public class MainActivity extends Activity implements OnTouchListener { MySurface oursurfaceview; float x, y; Bitmap goofy; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); oursurfaceview = new MySurface(this); oursurfaceview.setOnTouchListener(this); setContentView(oursurfaceview); x = 0; y = 0; goofy = BitmapFactory.decodeResource(getResources(), R.drawable.goofy); } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); oursurfaceview.pause(); } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); oursurfaceview.resume(); } @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 onTouch(View arg0, MotionEvent event) { // TODO Auto-generated method stub x = event.getX(); y = event.getY(); return false; } public class MySurface extends SurfaceView implements Runnable { SurfaceHolder ourHolder; Thread ourThread = null; boolean isRunning = false; public MySurface(Context context) { super(context); // TODO Auto-generated constructor stub ourHolder = getHolder(); } @Override public void run() { // TODO Auto-generated method stub while (isRunning) { if (!ourHolder.getSurface().isValid()) continue; Canvas canvas = ourHolder.lockCanvas(); i…
favorite count: 0
has comment: http://stackoverflow.com/comment/35269906
has answer: http://stackoverflow.com/a/23078069
tagged with: android
has comment: http://stackoverflow.com/comment/35270098
has title: How to set a transparent background?
upvote count: 1
accepted answer: http://stackoverflow.com/a/23078069

http://stackoverflow.com/a/23083276
type: Answer
answers question: http://stackoverflow.com/q/23083136
has comment: http://stackoverflow.com/comment/35279432
has body: What you get back when you execute a query is a result set that iterates over the rows. A database need not necessarily return information on how many rows a query fetches, since it may decide to optimize the fetch and only return say the first X rows. You can always get the count of the rows in the same transaction and obtain the information you want. Another option is to use a scrollable resultset and traverse to the last row and then get the row count. [EDIT] An FAQ from the Oracle tech network recommends what I just wrote in my answer, albeit they do not provide the internal technical reason behind it.
upvote count: 3
has comment: http://stackoverflow.com/comment/35279527
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23083136
score: 3

http://stackoverflow.com/comment/35095208
type: AnswerComment
score: 0
type: Comment
has text: problem is not with regex, it is with if logic, regex worked perfectly when there were no if logic
comment on: http://stackoverflow.com/a/22981962

http://stackoverflow.com/comment/35146807
type: Comment
comment on: http://stackoverflow.com/q/23009846
score: 0
type: QuestionComment
has text: Did you check that the values of aLen1 and aLen2 are reasonable? Everywhere where you do `&somearray` looks suspicious to me. It more than likely should be just `somearray`.

http://stackoverflow.com/a/23000709
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23000615
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23000615
upvote count: 2
has body: Try to use if (!myArray.isEmpty()) myArray.get(myArray.size() - 1); This will get the last value in the list, when the list isn't empty.
type: AcceptedAnswer

http://stackoverflow.com/comment/35127205
has text: i'm not sure about javax.inject for me i'm using spring autoware.you can check this maybe it will help sorry because the first method did't work for you http://docs.oracle.com/javaee/6/api/javax/inject/Inject.html
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22997707

http://stackoverflow.com/comment/35092345
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22980147
has text: Read [this](http://www.avajava.com/tutorials/lessons/how-do-i-import-another-web-page-into-my-jsp-and-display-its-source-code.html).

vorbis
tag name: vorbis
tags question: http://stackoverflow.com/q/23081911
type: Tag

http://stackoverflow.com/comment/35229282
type: Comment
has text: @JakubHr because there is spring and hibernate with JPA, so there is very likely maven as well, it was my personal guess
comment on: http://stackoverflow.com/a/23055526
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35191123
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23034174
score: 0
has text: Try jdk 7 at least. I just can't believe that nothing appears when you run that .exe.

http://stackoverflow.com/comment/35376884
comment on: http://stackoverflow.com/a/23056036
has text: Turns out to be probably an Eclipse problem. I tried to contigure dynamic webpage instead of maven project. I started with simple spring hello world. Application behaved like it should but still in the console tomcat was complaining about missing `appcontext.xml`
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23038578
has comment: http://stackoverflow.com/comment/35198703
has answer: http://stackoverflow.com/a/23038601
has comment: http://stackoverflow.com/comment/35198724
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23038703
tagged with: return-type
has answer: http://stackoverflow.com/a/35582004
has title: Return type of iterator() method in java
has answer: http://stackoverflow.com/a/23038679
has answer: http://stackoverflow.com/a/40604646
tagged with: methods
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/35198692
tagged with: java
answer count: 6
score: 4
linked to: http://stackoverflow.com/q/1992384
upvote count: 4
tagged with: iterator
downvote count: 0
has body: I am a new-comer in Java and in process of learning. I need a an answer of following question supported with valid theory. Consider the following line- Iterator itr = al.iterator(); where al is some collection object of ArrayList (class) type. I want to know what is here the return type of al.iterator() It is not definitely of a primitive data type, then it could be an object , but since every object belong to a class then it is of which class. Documentation and books etc says it has return type of Iterator. But Iterator is an interface. On other hand we say an interface could not have a direct object. Although interface variable could refer to an object of a class or classes that implements it. - So the above syntax is correct (as Iterator variable itr could be used to refer to an object of some class implementing it). But in realty it is object of which class? And can substituting itr with reference variable of that class will cause no error (I have tried substituting itr with ref. variable of ArrayList class in above line but that causes an error). I am using this syntax very often also in Generics form, but dont know the theory behind this. And I am supposing I am lacking a very basic concept here. Please rectify.
has answer: http://stackoverflow.com/a/23038602
favorite count: 0

http://stackoverflow.com/comment/35223808
has text: `Something` is an interface that has several implementations, I'm choosing the implementation in the xml file `file.xml`. When I'm doing so using `context.getBean()`, it works and I have the right implementation, but when using `@Reousrce` (`javax.annotation.Resource`) I'm getting null. Please let me know what else I can provide. Thanks!
comment on: http://stackoverflow.com/q/23052490
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35345385
score: 0
comment on: http://stackoverflow.com/q/23118478
type: Comment
type: QuestionComment
has text: u understand where is the problem?? i put the servlet configuration and the complete Controller Class in my question..

http://stackoverflow.com/q/23070763
tagged with: java
accepted answer: http://stackoverflow.com/a/23070829
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23070840
has answer: http://stackoverflow.com/a/23070840
score: 0
tagged with: android
has body: I am trying to create an application that sends a file to a server. The application consists of one button that when clicked, will upload a file to a server. Here is the code that I have so far: public class MainActivity extends Activity implements OnClickListener { final String TAG = "sendButton"; final String TAG2 = "messageButton"; TextView messageText; Button uploadButton; int serverResponseCode = 0; String result = null; String url = "http://192.168.1.18"; File file = new File("example.txt"); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // findViewById(R.id.button2).setOnClickListener(this); //findViewById(R.id.button2).setOnClickListener(this); setupsendMessage(); //setupmessageButton(); uploadButton = (Button)findViewById(R.id.button1); messageText = (TextView)findViewById(R.id.button2); } private void setupsendMessage() { // do something when the button is pressed // Button sendButton = (Button) findViewById(R.id.button1); sendButton.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { try { HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(url); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); FileBody fileBody = new FileBody(file); builder.addPart("file", fileBody); final HttpEntity yourEntity = builder.build(); post.setEntity(yourEntity); HttpResponse response = client.execute(post); HttpEntity httpEntity = response.getEntity(); result = EntityUtils.toString(httpEntity); Log.v("result", result); } catch(Exception e) { e.printStackTrace();} Log.i(TAG, "File Sent to Server"); Toast.makeText(MainActivity.this, "File Sent to Server", Toast.LENGTH_LONG).show(); } }); }; When I run the code the application everything appears fine, but when I press the button nothing happens and I get an error on the trace. The error is as follows: 04-14 17:2…
has answer: http://stackoverflow.com/a/23070829
type: AnsweredQuestion
has title: Error uploading file to server Java

http://stackoverflow.com/a/23022184
has body: You should use final Dialog dialog = new Dialog(context); dialog.setContentView(R.layout.info_dialog); dialog.setTitle(episode); TextView descrip = (TextView) dialog.findViewById(R.id.dialog_text); //change in this line descrip.setText(descript); dialog.show(); Since the textview is not in the layout of the activity but in the layout of the dialog. In your code, descrip is null, because it cannot be found.
answers question: http://stackoverflow.com/q/23022117
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23022117
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23099912
has body: I set following property to send a mail to gmail without authenticating but i am not able to send. please help me Properties props = new Properties(); props.put("mail.smtp.host", SMTPServer); //props.put("mail.smtp.ssl.enable", "true"); props.put("mail.smtp.auth", "false"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.debug", "true"); props.put("mail.smtp.port", SMTPPort);
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35308938
score: 0
has answer: http://stackoverflow.com/a/23100084
has comment: http://stackoverflow.com/comment/35309776
has comment: http://stackoverflow.com/comment/35308897
answer count: 1
has comment: http://stackoverflow.com/comment/35308970
has comment: http://stackoverflow.com/comment/35309004
has comment: http://stackoverflow.com/comment/35308932
has comment: http://stackoverflow.com/comment/35308887
has title: using java how to send a mail without authentication
tagged with: email
has comment: http://stackoverflow.com/comment/35308880
accepted answer: http://stackoverflow.com/a/23100084

http://stackoverflow.com/comment/35136012
type: Comment
has text: You need to use the latest nightlies. The latest stable version (0.9.9) does not have those.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22998987

http://stackoverflow.com/comment/35104356
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22986832
has text: Yes! sorry, here you can read my example code
score: 0

http://stackoverflow.com/comment/35339254
has text: Most likely `render() should *not* be `static`.
comment on: http://stackoverflow.com/q/23116845
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22997757
has answer: http://stackoverflow.com/a/77848576
answer count: 5
has answer: http://stackoverflow.com/a/26836080
has answer: http://stackoverflow.com/a/71493743
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/51211798
tagged with: java
tagged with: gradle
has title: How to enable Eclipselink's static weaving from Gradle
has answer: http://stackoverflow.com/a/71238763
type: Question
tagged with: ant
score: 4
has body: I'd like to enable Eclipselink's static weaving for my JPA classes from Gradle. The Eclipselink docs explain how to do this in an Ant task: <taskdef name="weave" classname="org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask"/> <pathelement path="c:\myjar-dependent.jar"/> Now I've got 2 questions: 1. How do I 'translate' this into a Gradle approach? I've tried this (based on the docs at http://www.gradle.org/docs/current/userguide/ant.html#N1143F): task eclipseWeave << { ant.taskdef(name: "weave", classname: "org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask", classpath: configurations.compile.asPath) ant.weave(source: relativePath(compileJava.destinationDir), target: relativePath(compileJava.destinationDir), persistenceinfo: relativePath(processResources.destinationDir) { } } but the problem is that the classpath doesn't seem to work within ant.weave(..). The weaving process is aborted after a bit with the message: Execution failed for task ':eclipseWeave'. > java.lang.NoClassDefFoundError: some/class/from/my/dependencies The classpath setting works for ant.taskdef(..) since the StaticWeaveAntTask is found in my dependencies. How can I make it apply to ant.weave(..) itself? 2. How do I integrate this into my build, so it is executed automatically after each compileJava step?
tagged with: eclipselink
downvote count: 1
favorite count: 0
upvote count: 5

http://stackoverflow.com/comment/35204072
has text: The `inputImage` variable should hold the object instance that is currently in `inputfile`. `inputfile` on the other hand should keep the `File` that was created when you read the command line. If you used a `String` directly to read the file, you need to use `new File(inputPath)`.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23041376

http://stackoverflow.com/a/23023081
answers question: http://stackoverflow.com/q/23022832
has comment: http://stackoverflow.com/comment/35171468
has body: Build a listener interface in the dialog. Have your calling frag or activity implement it. private OnFinishListener mOnFinishListener; // Container Fragment must implement this interface public interface OnFinishListener { public void OnFinish(); } public void onAttachFragment(Fragment fragment) { try { mOnFinishListener = (OnFinishListener) fragment; } catch (ClassCastException e) { throw new ClassCastException(fragment.toString() + " must implement OnFinishListener"); } } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Log.i(TAG, "onCreateDialog"); onAttachFragment(getParentFragment()); ... } Then put this wherever you want to let the calling activity or fragment know. if (mOnFinishListener != null) mOnFinishListener.OnFinish(); And your activity or fragment needs to implement it and call displayBets(); @Override public void OnFinish() { displayBets(); } http://developer.android.com/guide/topics/ui/dialogs.html#PassingEvents
type: Answer
score: 0

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/23113506
tags question: http://stackoverflow.com/q/23102340
type: Tag

http://stackoverflow.com/comment/35116003
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22988453
has text: Don't use a KeyListener!!! Swing was designed to be used with `Key Bindings`. All Swing components use Key Bindings to handle keyboard events.

http://stackoverflow.com/a/23105243
upvote count: 1
type: Answer
has body: It depends on operations, that you want to have. For example, if you need to have putIfAbsent at nested map, than you need to have nested ConcurrentSkipListMap. If you will get a nested map and work with it from multithreaded code it should be Concurrent&lt;...>Map also.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23105048

http://stackoverflow.com/comment/129072218
has text: copy is depracated
type: AnswerComment
comment on: http://stackoverflow.com/a/23013512
type: Comment
score: 0

http://stackoverflow.com/comment/35290265
type: QuestionComment
comment on: http://stackoverflow.com/q/23089348
has text: To verify the input was given properly, I want to first check to be sure it fits the proper format using regular expressions.
score: 0
type: Comment

http://stackoverflow.com/comment/35081362
type: QuestionComment
has text: How i miss the time i could write really fun programs! :-)
score: 1
comment on: http://stackoverflow.com/q/22973732
type: Comment

http://stackoverflow.com/comment/35072165
type: QuestionComment
comment on: http://stackoverflow.com/q/22968979
has text: Starting over: Project structure>Modules>Import module> Select google-play-services_lib in libproject folder inside google_play_Services And how to import? create module from existing sources or import module frome xternal model?
score: 0
type: Comment

http://stackoverflow.com/q/23034174
has comment: http://stackoverflow.com/comment/35190533
score: 0
has comment: http://stackoverflow.com/comment/35190840
answer count: 1
has comment: http://stackoverflow.com/comment/35190550
has comment: http://stackoverflow.com/comment/35191929
has comment: http://stackoverflow.com/comment/35191369
has answer: http://stackoverflow.com/a/23034229
has comment: http://stackoverflow.com/comment/35190631
type: UnansweredQuestion
has title: Why am I unable to install eclipse hat am I doing wrong?
has body: please help me with this problem, it is very frustrating. I downloaded adt bundle for 64x pc. My os is Windows 7 64x pc. First it gave me an error that it could not find jre. Okay I took jre from Program Files and copied that into the adt bundle directory then it will tell me FAILED TO LOAD JNI SHARED LIBRARY. I downloaded Java jre and jdk from Oracle.com for 64x and none of them will even run on click? Its crazy, everything is 64x what am I doing wrong? Please help
has comment: http://stackoverflow.com/comment/35191123
tagged with: java
has comment: http://stackoverflow.com/comment/35190779
type: Question
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35190608
has comment: http://stackoverflow.com/comment/35193072

http://stackoverflow.com/a/32723971
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23041164
has body: One thing I would like to add after struggling with this for a while - just creating a configuration object is not sufficient with Heroku, even with the spring cloud connectors. You also have to explicitly declare the cloud profile (-Dspring.profiles.active=cloud) in your application Procfile.
upvote count: 2
has comment: http://stackoverflow.com/comment/53456856

http://stackoverflow.com/q/23077985
has comment: http://stackoverflow.com/comment/35270069
has answer: http://stackoverflow.com/a/23078181
has answer: http://stackoverflow.com/a/23078051
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23078080
has comment: http://stackoverflow.com/comment/35270282
answer count: 4
has title: Syntax error with Forstatement
tagged with: java
score: 0
type: Question
has answer: http://stackoverflow.com/a/23078103
has body: Hi, I am having an error with line 58 of my code. I'm getting the error: Syntax error, insert "; ; ) Statement" to complete For Statement When I try to compile. I'm trying to make a program that writes a .txt file to a .dat file. Here is my code: import java.io.*; import java.util.Scanner; public class PA8 { public static void main(String[] args) { boolean a = false; while(a == false) { try { Scanner keyboard = new Scanner(System.in); System.out.println("Please enter the name of an input text file"); String text = keyboard.next(); BufferedReader inputStream = null; inputStream = new BufferedReader (new FileReader(text + ".txt")); String inString = inputStream.readLine(); while(inString != null) { System.out.println(inString); int x = Integer.valueOf(inString); inString = inputStream.readLine(); } inputStream.close(); } catch(FileNotFoundException e) { System.out.println("Entry invalid please enter a valid text file name"); } catch(IOException e) { System.out.println(e.getMessage()); } } PrintWriter outputStream = null; try { outputStream = new PrintWriter (new FileOutputStream("numbers.dat")); } catch(FileNotFoundException e) { System.out.println("I/O problem: " + e.getMessage()); System.exit(0); } while(a == false) { outputStream.writeInt(x); } for(IOException e) { System.out.println(e.getMessage()); } outputStream.close(); } }

http://stackoverflow.com/a/23121938
has body: It is problematic for several reasons to have a variable name like "Map" but that aside, the code you pasted there calls "Map.get()" where "Map" is a reference to an instance of TreeMap. There is no get() method in TreeMap which accepts no arguments so I don't expect that the code above even compiles.
has comment: http://stackoverflow.com/comment/35348420
answers question: http://stackoverflow.com/q/23121862
type: Answer
has comment: http://stackoverflow.com/comment/35348336
score: 0

lemmatization
type: Tag
tags question: http://stackoverflow.com/q/23086961
tag name: lemmatization

http://stackoverflow.com/comment/35314180
has text: you are welcome. If this post is useful to you then please accept the answer so that others can refer it as correct answer :)
comment on: http://stackoverflow.com/a/23057482
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35276824
has text: It is 24, sorry, calculation error
comment on: http://stackoverflow.com/q/23081798
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23081836
has title: Splash loading skipped transition animation
has body: I'm new in android programming, and here i try to create some splash screen with 3 different images showing up one after another using RunOnUIThread, here's the code Splash.java public class Splash extends Activity { int loading_count; int imgShowed = 1; ImageView img1, img2; ImageSwitcher imgSwitcher; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash); img1 = (ImageView)findViewById(R.id.img01); img2 = (ImageView)findViewById(R.id.img02); imgSwitcher = (ImageSwitcher)findViewById(R.id.splash_switcher); LoadingThread(); } private void LoadingThread(){ Thread loading = new Thread(){ @Override public void run(){ try{ //=================================// // Looping for splash loading // //=================================// while(loading_count &lt; 170){ sleep(50); runOnUiThread(new Runnable(){ @Override public void run() { if(loading_count &gt;=20){ if(imgShowed == 1){ imgSwitcher.showNext(); imgShowed = 2; } }if(loading_count &gt;= 70){ if(imgShowed == 2){ img1.setImageResource(R.drawable.two); imgSwitcher.showNext(); imgShowed = 3; } }if(loading_count &gt;= 120){ if(imgShowed == 3){ img2.setImageResource(R.drawable.three); imgSwitcher.showNext(); imgShowed = 4; } } loading_count += 1; } }); } }catch(InterruptedException e){ e.printStackTrace(); }finally{ StartMainMenu(); } } }; loading.start(); } private void StartMainMenu(){ Intent mainmenu = new Intent(this, MainMenu.class); finish(); startActivity(mainmenu); overridePendingTransition(R.anim.fade_in, R.anim.fade_out); } Layout.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#000000" &gt; &lt;ImageSwitcher android:id="@+id/splash_switcher" android:layout_centerInParent="true" android:layout_width="200dp" android:layout_height="200dp" android:background="#00000000" android:inAnimation="@anim/fade_in" android:outAn…
type: AnsweredQuestion
tagged with: java
tagged with: transition
type: Question
accepted answer: http://stackoverflow.com/a/23098460
score: 0
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/23098460

http://stackoverflow.com/comment/35143394
comment on: http://stackoverflow.com/q/23008529
score: 0
type: Comment
type: QuestionComment
has text: What is your question?

http://stackoverflow.com/comment/35348427
type: Comment
has text: I know, I just had a time restriction- btw, I'm getting the if statement evaluated inside each case before defining the ans variable, so it gives wrong immediatly when compiling and choosing a number, know how to fix that?
type: AnswerComment
comment on: http://stackoverflow.com/a/23098248
score: 0

http://stackoverflow.com/comment/35301868
type: AnswerComment
score: 0
type: Comment
has text: ACTION_DOWN and _UP refer to the finger touching and lifting from the surface, not the direction of motion on the surface. touch_slop is about 1/3 of a finger's width.. so a motion in the x direction (deltaX > slop) means they want to move the object. No motion (deltaX < slop) just means the finger stayed in the same place. You are always rotating by 45 degrees, so the slop is just telling you whether it's a touch in place or not
comment on: http://stackoverflow.com/a/23094734

http://stackoverflow.com/q/22996895
tagged with: merge
has comment: http://stackoverflow.com/comment/35126615
answer count: 0
tagged with: infinite
type: UnansweredQuestion
has body: I'm writing a merge sort in java. It sometimes sorts the array and sometimes goes into an infinitive loop.I can't find why. Thank you for help. // M - Main Array int Aindex = 0; int Bindex = 0; int A[] = new int[(int) (M.length + 1) / 2]; int B[] = new int[(int) M.length / 2]; while (!sakartotsAugosi(M)) { // While not sorted Look below for this function. Aindex = 0; Bindex = 0; for (int Mindex = 0; Mindex &lt; M.length; Mindex++) { if ((Mindex + 1) % 2 != 0) { A[Aindex] = M[Mindex]; Aindex++; } else { B[Bindex] = M[Mindex]; Bindex++; } } Aindex = 0; Bindex = 0; for (int Mindex = 0; Mindex &lt; M.length; Mindex++) { if (Aindex == A.length) { M[Mindex] = B[Bindex]; Bindex++; } else if (Bindex == B.length) { M[Mindex] = A[Aindex]; Aindex++; } else if (A[Aindex] &lt;= B[Bindex]) { M[Mindex] = A[Aindex]; Aindex++; } else if (B[Bindex] &lt;= A[Aindex]) { M[Mindex] = B[Bindex]; Bindex++; } } /////////////////////////////////////////////////////////////////////////////////////// public boolean sakartotsAugosi(int M[]) { for (int i = 1; i &lt; M.length; i++) { if (M[i - 1] &gt; M[i]) { return false; } } return true; }
has comment: http://stackoverflow.com/comment/35128800
has comment: http://stackoverflow.com/comment/35178573
tagged with: java
has comment: http://stackoverflow.com/comment/35122796
tagged with: loops
has comment: http://stackoverflow.com/comment/35123204
type: Question
has comment: http://stackoverflow.com/comment/35123311
has title: Merge sort in java. Sometimes sorts sometimes goes into an Infinite Loop
tagged with: sorting
has comment: http://stackoverflow.com/comment/35128172
score: 0
has comment: http://stackoverflow.com/comment/35123027

http://stackoverflow.com/q/23113855
upvote count: 1
has answer: http://stackoverflow.com/a/23113944
has comment: http://stackoverflow.com/comment/35333987
type: Question
accepted answer: http://stackoverflow.com/a/23113893
possible better answer: http://stackoverflow.com/a/23113933
tagged with: arraylist
has answer: http://stackoverflow.com/a/23113933
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/35333353
has comment: http://stackoverflow.com/comment/35333394
has answer: http://stackoverflow.com/a/23113977
downvote count: 0
has title: Java ArrayList java.lang.NullPointerException
favorite count: 0
tagged with: static
has comment: http://stackoverflow.com/comment/35333540
has answer: http://stackoverflow.com/a/23113893
has body: I'm sorry I am very new to programming and have encountered what I hope is a simple problem to solve. I'll put my code in here and explain what I am trying to do below. public class main { static ArrayList&lt;Interpreter&gt; ints1; static ArrayList&lt;Customer&gt; custs1; static MainFunctions mainF; static { //Static blocks execute first - and are great for initializing data! ArrayListPopulator ALP1 = new ArrayListPopulator(); ints1 = ALP1.populateALints1(); // error occurs on this method call. custs1 = ALP1.populateALcusts1(); mainF = new MainFunctions(ints1, custs1); } public static void main(String[] args) { mainF.findNearestInterp("Frank"); } } ArrayList Populator: import java.util.ArrayList; public class ArrayListPopulator { private ArrayList&lt;Interpreter&gt; ints1ToGo; private ArrayList&lt;Customer&gt; custs1ToGo; public ArrayList&lt;Interpreter&gt; populateALints1() { //Format is "String pName, int pAge, String PGender, // int pSignLevel, boolean pDeafBlindExp, double pLatitude, double pLongitude, String pTown" //Gender must be "Male"||"Female" //In future this could be done by scanning a local config text file. Wish that I knew that stuff :l Interpreter Elliott = new Interpreter("Elliott", 23, "Male", 6, true, 52.098049, 0.277860, "Linton"); ints1ToGo.add(Elliott); //error occurs here. Interpreter Sarah = new Interpreter("Sarah", 20, "Female", 3, true, 52.209950, 0.137774, "Cambridge"); ints1ToGo.add(Sarah); Interpreter Argibarge = new Interpreter("Argibarge", 42, "Male", 3, false, 52.599199, -0.264226, "Peterborough"); ints1ToGo.add(Argibarge); Interpreter Bruce = new Interpreter("Bruce", 30, "Male", 2, false, 50.717527, -3.540192, "Exeter"); ints1ToGo.add(Bruce); Interpreter Medusa = new Interpreter("Medusa", 1009, "Female", 4, false, 55.867795, -4.267566, "Glasgow"); ints1ToGo.add(Medusa); return ints1ToGo; } public ArrayList&lt;Customer&gt; populateALcusts1() { //Format is "String pName, int pAge, String PGender, //boolean pDeafBlind, double pLatitude,…
answer count: 4
has comment: http://stackoverflow.com/comment/35333805
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/35302071
has text: If still not working the remove `serverSocket.setSoTimeout(100000);` from your server side code.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23064989

http://stackoverflow.com/a/23073471
upvote count: 3
downvote count: 0
has body: The key to solving your problem is to not do what you're trying to do: to shoe-horn a console type program into a GUI. They use different programming philosophies with the latter being event-based, and the former being linear. Solution: learn to code with the Swing tutorials, and put your Scanner to the side. You don't need it, nor do you want it. Please check out: Swing Info Swing Tutorials
answers question: http://stackoverflow.com/q/23073460
type: Answer
score: 3

http://stackoverflow.com/q/23007356
score: 28
tagged with: java
tagged with: hibernate
has body: @org.hibernate.annotations.ForeignKey has been deprecated, but I cannot find any examples how the JPA 2.1 equivalent would have to look like? @ManyToOne @ForeignKey(name = "FK_USER") //@deprecated Prefer the JPA 2.1 introduced {@link javax.persistence.ForeignKey} instead. private User user; How is this to be implemented without the deprecated annotation?
accepted answer: http://stackoverflow.com/a/23007675
type: AnsweredQuestion
tagged with: jpa
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/57807828
upvote count: 28
type: Question
has answer: http://stackoverflow.com/a/23007675
has comment: http://stackoverflow.com/comment/35141289
answer count: 3
has title: How to name the foreign key constraint of ManyToOne references since JPA 2.1?
possible better answer: http://stackoverflow.com/a/23007562
has answer: http://stackoverflow.com/a/23007562

http://stackoverflow.com/comment/35233419
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23057912
has text: The answer depends on which form you're used to. That said this is _primarily opinion-based_.

http://stackoverflow.com/comment/35095111
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22981731
has text: Is this answer incorrect? I'll happily remove it if it is. (and actually it is a real touchstone that the -2 for downvotes simply does not compensate +10 for upvotes on an incorrect answer).
type: Comment

http://stackoverflow.com/a/23007232
has body: You didn't state a question so I assume the question: "Who is right, and how to make the code work?" I'd say Eclipse is right. The result of fromNullable has Type parameter ?, i.e. there exists a type T but we don't know it. The Optional returned by or must have the same type parameter as the Optional it is called on, which also means it takes the same unknown type T as a parameter. But Object might or might not be compatible to that type, so it is correct to fail. In order to fix it, I think the following change should work: Optional.fromNullable((Object)entry.getValue()).or(NO_VALUE); The cast binds the otherwise unknown type parameter to Object which obviously is compatible to Object in the call to or.
answers question: http://stackoverflow.com/q/23006777
downvote count: 0
has comment: http://stackoverflow.com/comment/35143025
type: Answer
has comment: http://stackoverflow.com/comment/35146443
score: 1
has comment: http://stackoverflow.com/comment/35141732
has comment: http://stackoverflow.com/comment/35140915
upvote count: 1
has comment: http://stackoverflow.com/comment/35141666

http://stackoverflow.com/comment/97134050
comment on: http://stackoverflow.com/a/23121897
score: 0
type: AnswerComment
has text: I couldn't make jar in IntelliJ because of external jars. But 4 solved problem easily. Thanks!
type: Comment

http://stackoverflow.com/comment/35232652
comment on: http://stackoverflow.com/a/23057354
score: 0
type: AnswerComment
type: Comment
has text: Hey, I tried this and the newCount and oldCount have the same value. The totalDataConsumption has 0 Bytes. And even with this i'm not able to measure the time that takes to receive the data. Any other suggestion?

http://stackoverflow.com/q/23102092
tagged with: velocity
tagged with: html-email
has answer: http://stackoverflow.com/a/23102596
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23102596
tagged with: jakarta-mail
has body: I am using Velocity Engine as template engine to send email. Email template is in .vm files and I set any variables that I want to set and send email using JavaMail api. For English, this is working all fine. But for Arabice, I don't get the letters correctly. Note that I have set content type utf-8 in html format and also set content type in the Java code also. &lt;html&gt; &lt;head&gt;&lt;meta charset="utf-8"&gt;&lt;/head&gt;... Also I don't have the luxory of using Spring, so VelocityEngineUtils cannot be used. VelocityEngine ve = new VelocityEngine(); ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath"); ve.setProperty("classpath.resource.loader.class",ClasspathResourceLoader.class.getName()); ve.init(); Template t = ve.getTemplate("email_template.vm"); VelocityContext context = new VelocityContext(); context.put("variable", "param"); StringWriter writer = new StringWriter(); t.merge(context, writer); Following is the mail sending code. You can see that I set UTF-8 character encoding when setting text MimeMessage message = new MimeMessage(session); message.setSender(new InternetAddress("senderEmail@gmail.com", "Test application")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("receipant@gmail.com")); message.setSubject("Testing Subject"); message.setText(writer.toString(),"UTF-8", "html");
has title: Send Forign Charcter like Arabic letters in Emails using JavaMail Api
tagged with: email
answer count: 1

http://stackoverflow.com/a/38997201
type: Answer
score: 5
answers question: http://stackoverflow.com/q/23017937
upvote count: 5
has body: I had the same problem, it was because of rights "root". Run hadoop or hdfs command with sudo as before: sudo hdfs namenode -format
downvote count: 0

http://stackoverflow.com/comment/35351698
comment on: http://stackoverflow.com/a/23123809
score: 0
type: AnswerComment
has text: @user3495562 I don't know the internals. That is just a `String` representation indicating the indices of the bits which are set.
type: Comment

http://stackoverflow.com/q/23030622
has comment: http://stackoverflow.com/comment/35184714
has answer: http://stackoverflow.com/a/23030696
has title: java sessions - when does a session actually gets created?
has body: my code, HttpSession session = request.getSession(false); // Details.l.info(" 1&gt;&gt;&gt;&gt;session ID is : " + session.getId()); Details.l.info("["+this.getClass()+"]"+"request from "+request.getRemoteHost()); if(session==null){ session = request.getSession(true); Details.l.info("["+this.getClass()+"]"+"Session Created!!!!!!!!!!!!!!!!!!!#####$@@@@"); Details.l.info(" 2&gt;&gt;&gt;&gt;&gt;session ID is : " + session.getId()); } Details.l.info(" 3&gt;&gt;&gt;&gt;&gt;session ID is : " + session.getId()); // System.out.println("session ID is : " + session.getId()); Details DTO = new Details(request); String loc = DTO.findMyLocation(); session.invalidate(); here, i am creating a session at the very beginning of the servlet with a logic that if the session already exists, then give hat session ID for that particular user or if a session does not exist for this particular user, please create a new session and then give the new session ID, here the new session is created inside the IF condition and i have tested in all possible ways (i have used two different systems and tried hitting to the servlet on one system too) but the control never gets into this loop where the session is getting created. but i see every time i hit to the servlet i get a new session ID!!! can someone please exlain this behavior of my servlet?? i am very new to sessions and servlets!! Thanks in Advance..
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35184120
possible better answer: http://stackoverflow.com/a/23030696
has comment: http://stackoverflow.com/comment/35184560
type: Question
has comment: http://stackoverflow.com/comment/35184289
tagged with: session
tagged with: servlets
has answer: http://stackoverflow.com/a/23031040
accepted answer: http://stackoverflow.com/a/23031040
score: 0
answer count: 2

http://stackoverflow.com/comment/35259027
type: QuestionComment
has text: A tip, unless the `switch` is required. Your `case` bodies are all the same minus one character different (which you have in the form of `letterGrade` so you could simple replace that entire `switch` with: `System.out.println(new StringBuilder().append(studentName).append(" gets an ").append(letterGrade).append("."));`
score: 1
comment on: http://stackoverflow.com/q/23071638
type: Comment

http://stackoverflow.com/comment/35352784
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23123983
has text: What does your createImage(dim.width, dim.height) method returns?

http://stackoverflow.com/comment/71150584
score: 0
has text: Shouldn't `jboss-deployment-structure.xml` be placed in `WEB-INF` instead of `META-INF`... not only RedHat documentation says that but in my SpringMVC application it only worked when I put it in `WEB-INF`.
type: AnswerComment
comment on: http://stackoverflow.com/a/23080264
type: Comment

http://stackoverflow.com/comment/35222376
type: AnswerComment
has text: @Makoto Agreed; the whole thing is a bit smelly in general. I am wondering why the OP needs to do this in the first place, there may be better higher level ways to organize this code.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23051803

http://stackoverflow.com/a/23094744
has comment: http://stackoverflow.com/comment/35301561
has comment: http://stackoverflow.com/comment/35301276
downvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/35319482
answers question: http://stackoverflow.com/q/23094602
has comment: http://stackoverflow.com/comment/35300783
upvote count: 4
has comment: http://stackoverflow.com/comment/35301785
has body: "I want to compare the names (the first elements in the arrays) of all ar[]'s and if there are doubles I need a sysout that gives the position (ar[]) of the doubles" It seems like your approach is wrong. Your RoomType could implement equalsand hashcode based on your requirements and then you can add them to a data structure that doesn't permit duplicates like java.util.Set. Trying to insert a duplicate element to a Set will return false and this could help you. Unless you are practicing/playing around with arrays in Java, standard data structures will solve these kind of problems for you.
has comment: http://stackoverflow.com/comment/35301944
type: Answer

http://stackoverflow.com/comment/35319217
score: 2
has text: Any object that can't be reached from a GC root will be collected, so in your case both the instance of `Foo` and `List` it references can be collected
comment on: http://stackoverflow.com/q/23106011
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23036291
tagged with: java
tagged with: vaadin
has body: How do I apply Vaadin7 server push to a Navigated View. Basically I want to up date MyView class table components. Since Its a navigated View its not working as explained in Vaadin. Is there Any other way to update data from MyView class? such as inserting the thread in it. UI class @Push public class MyUI extends UI{ Navigator navigator; @WebServlet(value = "/*", asyncSupported = true) @VaadinServletConfiguration(productionMode = false, ui = MyUI.class, widgetset = "com.example.myui.MyuiWidgetset") public static class Servlet extends VaadinServlet { } @Override protected void init(VaadinRequest request) { new Navigator(this, this); getNavigator().addView(MyView.MYVIEW, MyView.class); new InitializerThread().start(); } } class InitializerThread extends Thread { @Override public void run() { try { Thread.sleep(1000); } catch (InterruptedException e) { } access(new Runnable() { @Override public void run() { //update MyView's table from this event } }); } } } View Class public class MyView extends CustomComponent implements View { public MainView() { final Table table = new Table(); table.addContainerProperty("Date &amp; Time", String.class, null); table.setSelectable(true); table.setSizeFull(); table.setImmediate(true); while(){ table.addItem(new Object[]{new Date()}, new String("")); } }
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23053492
favorite count: 0
has title: How to apply Vaadin 7 server push to a Navigated View
upvote count: 2
type: UnansweredQuestion
tagged with: vaadin7
tagged with: gwt
score: 2

http://stackoverflow.com/a/23082702
score: 0
type: Answer
has body: try { Class.forName("org.apache.derby.jdbc.ClientDriver"); Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/contact","nbuser", "nbuser"); String query = "delete from product where id = " + n +""; Statement stmt=con.createStatement(); int i = stmt.executeUpdate(query); if (i &gt; 0) { response.sendRedirect("index.html"); }else{ response.sendRedirect("Admin.jsp"); } } catch (ClassNotFoundException | SQLException ey) { System.out.println(ey); } please try this code,it should works fine
answers question: http://stackoverflow.com/q/23082392

http://stackoverflow.com/a/22991592
answers question: http://stackoverflow.com/q/22979990
score: 0
has body: You are also not checking the input for validity(time = Serial.parseInt()) so any noise on the line will act as a valid input value. I wrap my calls to the Arduino with a command protocol so that I can be sure the Arduino got the sent value and not noise. i.e. first send 16 for GetReadyToReceive, then the value. That way there is less chance of a false input. See my code at http://playground.arduino.cc/Csharp/SerialCommsCSharp for an example
type: Answer
has comment: http://stackoverflow.com/comment/35264359
has comment: http://stackoverflow.com/comment/35224989

http://stackoverflow.com/a/23087046
upvote count: 1
answers question: http://stackoverflow.com/q/23085399
type: Answer
downvote count: 0
score: 1
type: AcceptedAnswer
has body: 1) I don't think node.js is such big deal to learn. I would personally prefer a well known - broadly used framework. 2) If you are considering mobile, probably the first option seems more sound. You should consider send/push deltas during the game, and still provide functionality to retrieve the full state of the game in case the client disconnect and connect with same ID. 3) WebSocket would be the best option. Push approach, TLS option and well supported. Another option is the WebRTC data connection, that is peer-2-peer most of the times. I say most of the times because if one of the users is behind a dynamic NAT router or restrictive firewall, it won't be possible, and you will need a TURN (relay) server. Anyway, it is less supported than WS. 4) You should not "pair websockets". The WS connections just input commands to your logic, and your logic broadcast events to whoever it wants. Despite of being a 1vs1 game, probably you want to inspect the flow of events for further debugging or analysis. So consider WS as a transport, not as an entity. 5) Very, very, very broad question. But assuming that you are going to use WS, and that your application will be so successful that you will need multiple servers... assume that it is impossible to predict that two users will connect to the same server, so you should consider a message bus that allow to play users from one server with the users in other server. An EDA (Event Driven Architecture) would make sense.
accepted answer of: http://stackoverflow.com/q/23085399

http://stackoverflow.com/q/23038993
upvote count: 6
answer count: 4
score: 6
has answer: http://stackoverflow.com/a/23039066
has answer: http://stackoverflow.com/a/23148757
tagged with: recursion
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23039024
has title: How does this recursion loop code executes
tagged with: java
has comment: http://stackoverflow.com/comment/35200104
type: Question
has comment: http://stackoverflow.com/comment/35199415
has comment: http://stackoverflow.com/comment/35199385
downvote count: 0
accepted answer: http://stackoverflow.com/a/23148757
has answer: http://stackoverflow.com/a/23039035
favorite count: 0
has body: I have some line of code where i cannot understand how the codes are executes, i mean the flow of program. Code: 1) public class RecurLoopTest { 2) public static void main(String[] args) { 3) printit(2); 4) } 5) private static int printit(int n){ 6) if(n&gt;0){ 7) printit(--n); 8) } 9) System.out.print(n+","); 10) return n; 11) } 12) } I am thinking output should be: 0, But Output is: 0,0,1, I have done DEBUG above class so many time, The flow i have seen while debugging: Starts execution from line 3, i.e. invokes printit() with 2 as parameter. line 6, if condition checks n value if greater than zero, then controls goes to line 7, i.e. prinit() invokes again by decrements n value once. step 2 continuous execution until n value becomes 0, then line 6, if condition is false. so in line 9, SYSO prints 0. Then, unable to understood that, how the control again goes from line 10 to 5 ??
possible better answer: http://stackoverflow.com/a/23039035

http://stackoverflow.com/q/22989500
type: AnsweredQuestion
tagged with: java
tagged with: thread-safety
has answer: http://stackoverflow.com/a/35367261
has comment: http://stackoverflow.com/comment/35117199
type: Question
upvote count: 80
linked to: http://stackoverflow.com/q/21145558
has answer: http://stackoverflow.com/a/35088604
possible better answer: http://stackoverflow.com/a/35367261
accepted answer: http://stackoverflow.com/a/22989501
has title: Is RestTemplate thread safe?
linked to: http://stackoverflow.com/q/21242812
score: 79
tagged with: rest
linked to: http://stackoverflow.com/q/6747478
linked to: http://stackoverflow.com/q/801993
answer count: 4
has comment: http://stackoverflow.com/comment/35108893
favorite count: 0
linked to: http://stackoverflow.com/q/33785455
has comment: http://stackoverflow.com/comment/35108921
has body: Is a Spring RestTemplate thread-safe? That is Is a RestTemplate a Strategy object that multiple connections can safely share. or Is a RestTemplate a connection object (like a data-base connection), which can not be shared while in use, and requires creation afresh, or pooling, for each connection.
linked to: http://stackoverflow.com/q/18510395
has answer: http://stackoverflow.com/a/36498980
tagged with: spring
downvote count: 1
has answer: http://stackoverflow.com/a/22989501

http://stackoverflow.com/q/23018519
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23018926
type: Question
has body: Until now i used the JSF implemented (but deprecated) ManagedBeans for my webapplication. After i changed it to CDI-beans . (javax.enterprise.context.*) import javax.enterprise.context.SessionScoped; @SessionScoped @Named public class UserSession implements Serializable, HttpSessionListener { //..... } I got following Exceptions: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: java.lang.IllegalArgumentException: The class xbu.gbcp.bean.session.UserSession is annotated with an invalid scope at org.apache.catalina.core.StandardContext.start(StandardContext.java:5864) at com.sun.enterprise.web.WebModule.start(WebModule.java:691) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1041) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:1024) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2278) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1924) at com.sun.enterprise.web.WebApplication.start(WebApplication.java:139) at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122) at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291) at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:497) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:360) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.ex…
downvote count: 0
answer count: 1
favorite count: 0
tagged with: cdi
accepted answer: http://stackoverflow.com/a/23018926
upvote count: 1
tagged with: jakarta-ee
type: AnsweredQuestion
has title: @SessionScoped throws Exception. (LifecycleException - "UserSession is annotated with an invalid scope")
tagged with: jsf

http://stackoverflow.com/q/23112537
type: UnansweredQuestion
has body: I'm creating a Breakout game to familiarize myself with Java. Currently I've got everything working but I've noticed that the ball seems to take off in the same direction. I've programmed it so when the ball hits the paddle the Y velocity is reversed. This works, but the ball seems to follow the same route... How would a make the collision seem more realistic? When the ball hits the left side of the paddle, I want to redirect it back to the left but I'm not sure at which angle to reflect it. Can anyone provide a formula to help me work out the angle at which I need to direct the ball upon contact with either the left or right side of the paddle?
answer count: 4
has title: Java - Breakout physics, ball direction on paddle collision?
downvote count: 0
has comment: http://stackoverflow.com/comment/35334313
score: 1
has answer: http://stackoverflow.com/a/23112773
favorite count: 0
has answer: http://stackoverflow.com/a/23112785
type: Question
has answer: http://stackoverflow.com/a/23199618
has comment: http://stackoverflow.com/comment/35334020
has comment: http://stackoverflow.com/comment/35330977
tagged with: collision
upvote count: 1
has comment: http://stackoverflow.com/comment/35331123
has answer: http://stackoverflow.com/a/23112609
tagged with: graphics
has comment: http://stackoverflow.com/comment/35330957
tagged with: java
linked to: http://stackoverflow.com/q/345838

http://stackoverflow.com/q/23084114
downvote count: 0
type: UnansweredQuestion
tagged with: pdf-generation
has answer: http://stackoverflow.com/a/23103418
score: 1
tagged with: java
type: Question
answer count: 1
tagged with: grails
upvote count: 1
has body: I have an orbeon form and when someone has fill out the form, I want it to create a pdf and sent it to my webservice. Right now, when the form is fill out and you press sent, the document id, app name and form name are sent to the webservice. Can anyone help me with a guide or an example ? The webservice is in grails (JAVA). Best regard Martin
has title: PDF generation in orbeon
tagged with: orbeon
favorite count: 0

http://stackoverflow.com/q/23056324
has title: Why does Java allow null value to be assigned to an Enum?
has answer: http://stackoverflow.com/a/47249222
downvote count: 0
upvote count: 84
favorite count: 0
accepted answer: http://stackoverflow.com/a/23056392
answer count: 5
has answer: http://stackoverflow.com/a/23057356
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23057356
tagged with: java
has answer: http://stackoverflow.com/a/23056730
score: 84
has answer: http://stackoverflow.com/a/23056385
has body: This is more of a design question, so no code. I could post code of creating an Enum and assigning it to null if you want me to do it. :)) I've been thinking a lot about this lately, but can't come up with one good reason. The Enum constants are implicitly static and final. Enum is meant to say - "I can take a value of one of the constants present in me". Why allow Enum to have a null value? Why not implicitly default the Enum's value to a Enum.DEFAULT or Enum.None? Isn't this a better approach than allowing the Enum to be null?
type: Question
tagged with: enums
has answer: http://stackoverflow.com/a/23056392

http://stackoverflow.com/comment/35260174
type: Comment
type: QuestionComment
has text: Try making your sub-select select distinct ir2.wonum from invreserve ir2 where ir2.location='01'). I believe Maximo assumes the query will be select * from invreserve, so your where clause may not be explicit enough to process correctly.
score: 0
comment on: http://stackoverflow.com/q/23058916

http://stackoverflow.com/comment/35224785
comment on: http://stackoverflow.com/a/23052264
has text: <constructor-arg index="0" value="#{systemProperties['instanceId'].equals('primary') ? '${PrimaryAccount}' : '${PrimaryAccount}' }">
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23008529
tagged with: email
has answer: http://stackoverflow.com/a/23013512
favorite count: 0
has answer: http://stackoverflow.com/a/23008732
has body: I am trying to send html page as message. already send html email through message.setContent(" This is actual message ","text/html" ); these method .Now iwant to send a html page . like message.setContent("street.html","text/html" ); how to send these below is my full code String to = "to@gmail.com"; String from = "from@gmail.com"; Properties properties = System.getProperties(); properties.put("mail.smtp.starttls.enable", "true"); properties.put("mail.smtp.host", "smtp.gmail.com"); properties.put("mail.smtp.port", "587"); properties.put("mail.smtp.auth", "true"); Session session = Session.getInstance(properties, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("from@gmail.com", "from2013"); }}); try{ MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.addRecipient(Message.RecipientType.TO,new InternetAddress(to)); message.setSubject("This is the Subject Line!"); message.setContent("street.html","text/html" ); Transport.send(message); System.out.println("Sent message successfully...."); }catch (MessagingException mex) { mex.printStackTrace(); }
has comment: http://stackoverflow.com/comment/35143747
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35143394
has comment: http://stackoverflow.com/comment/35144680
has comment: http://stackoverflow.com/comment/35143650
score: 2
has answer: http://stackoverflow.com/a/23008703
downvote count: 0
has answer: http://stackoverflow.com/a/23009717
tagged with: java
has title: send html page as email in java
type: Question
has answer: http://stackoverflow.com/a/52380993
answer count: 6
has answer: http://stackoverflow.com/a/23008943
upvote count: 2

http://stackoverflow.com/q/22987878
tagged with: http://stackoverflow.com/tag/xml
score: 0
type: Question
has title: java Xstream custom Converter for Jtree
tagged with: xstream
tagged with: java
has answer: http://stackoverflow.com/a/22988059
has body: I would like to serialize a Jtree to Xml via XStream. The jTree consists of user objects like this: public class Chapter{ private int id; private String iconName; /** * @return the id */ public int getId() { return id; } /** * @param id the id to set */ public void setId(int id) { this.id = id; } @Override public String toString() { return this.getTitel(); } /** * @return the icon */ public String getIcon() { return iconName; } /** * @param icon the icon to set */ public void setIcon(String icon) { this.iconName = icon; } } The structure of the Tree looks like that: root +chapter 1 -chapter 1.1 -chapter 1.2 -chapter 1.2.1 .... +chapter 10 no i want a XMl String like that: 1 1 1.1 2 .... How can i do this? The Xml String don´t need to be deserializable. Thanks!
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/35335864
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23098195
has text: It's too bad that there's only one virtual `equals`/`hashCode` pair, since equivalence depends upon whether an object will ever change, and the holder of an object will often know more about that than the object itself will. Having one method pair which would regard as equivalent only those things which will *always* be equivalent, and another which would regard as equivalent things which will be equivalent unless or until one of them is modified, could do a lot to resolve such issues.

http://stackoverflow.com/comment/35288953
type: AnswerComment
has text: That worked. I'll accept as soon as SO let's me. Thanks!
type: Comment
comment on: http://stackoverflow.com/a/23088652
score: 0

http://stackoverflow.com/q/22992015
downvote count: 0
has title: POI for XPages - using xwpfdocument
tagged with: xpages
favorite count: 0
possible better answer: http://stackoverflow.com/a/23026085
tagged with: apache-poi
upvote count: 1
has answer: http://stackoverflow.com/a/22994163
accepted answer: http://stackoverflow.com/a/22994163
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/826319
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23026085
has body: To help solve another problem I have, I'm testing the following code in the postGenerationProcess event of the POI Word widget: var jce:writeXWPFDocument = new writeXWPFDocument(); var newString3 = jce.doSomething3(xwpfdocument); print("newString3 = " + newString3); doSomething3 is defined in a Java class contained in the .nsf. public class writeXWPFDocument { public String doSomething3(XWPFDocument xwpfdocument) { return "DO SOMETHING - xwpfdocument"; }} When I run this code, I get the error: Java method 'doSomething3(org.apache.poi.xwpf.usermodel.XWPFDocument)' on java class 'AZGPackage.writeXWPFDocument' not found What could be causing this error? @Knut Hermann - this is a test which relates to the other problem you have been helping me with.

http://stackoverflow.com/q/23045338
score: 0
type: UnansweredQuestion
tagged with: windowbuilder
tagged with: swing
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23045463
has answer: http://stackoverflow.com/a/23045466
answer count: 2
tagged with: user-interface
has body: I am kind of newbie em Java and right now I am trying to program a simple GUI. Recently, I was looking for some kind of GroupBox (for WindowBuilder if possible), like the "Search" and "Overview" Groupboxes in the following image: http://imagizer.imageshack.us/a/img812/7239/jxsv.jpg So, which graphical object would be nice for it?
tagged with: groupbox
has title: Setting GroupBoxes in Java

http://stackoverflow.com/comment/35133414
score: 0
type: QuestionComment
has text: I have posted the main method, CodeCamper.
type: Comment
comment on: http://stackoverflow.com/q/23002490

http://stackoverflow.com/a/23138914
has body: The first thing to know is that FedEx does not provide any test tracking numbers, so you should change the endpoint to production (How track by Tracking Number Unique Identifier?). The second step is to obtain a real FedEx tracking number, and perform a tracking request. Best!
answers question: http://stackoverflow.com/q/23071463
score: 0
type: Answer
downvote count: 1
upvote count: 1

http://stackoverflow.com/q/23037783
tagged with: devserver
has body: I'm trying to convert my current GAE project to using modules. I'd like all tasks of a certain path to run on a specific module. I understand that in production, I can just enqueue the task as normal and the dispatch file handles routing it to the correct module. However, how can I get this same behaviour in the dev server? I'd rather not do something hackey like addressing the module directly. Thanks!
answer count: 1
tagged with: task-queue
has comment: http://stackoverflow.com/comment/35298479
favorite count: 0
upvote count: 2
tagged with: google-app-engine
tagged with: module
type: AnsweredQuestion
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23094249
has comment: http://stackoverflow.com/comment/35291978
accepted answer: http://stackoverflow.com/a/23094249
downvote count: 0
has comment: http://stackoverflow.com/comment/35281390
has title: Routing tasks to specific modules in GAE devserver

http://stackoverflow.com/q/23028899
type: Question
tagged with: session
tagged with: java
accepted answer: http://stackoverflow.com/a/23029232
has title: Session not saved for devices which are not browsers
score: 0
answer count: 1
tagged with: tomcat
has body: I have a tomcat server, and I use it as a restful server. With each rest request I need to provide a token. Once toke was provided I am storing it in the session. The problem is when I check some request via browser url the token saved in the session, but when I am doing this via some client (in my case android app) it always creates new session. It seems that each request from same client is handled as request from deferent clients. Do I need to configure something in the tomcat? Why I am getting new session for the same client (when the client is not the browser? Thanks!
tagged with: rest
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23029232

http://stackoverflow.com/comment/35322320
has text: I want a list of all apartmentID's wich are not in the reservation-table with those dates.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23107807
type: Comment

http://stackoverflow.com/a/23106546
has comment: http://stackoverflow.com/comment/35321837
answers question: http://stackoverflow.com/q/23105982
has comment: http://stackoverflow.com/comment/35322576
has body: I believe you are getting an error because you have socket, packet, address and pduFactory declared twice -- once in main and once as members of the class. And you really need to decide if you want receivePdu() to be static or not. You have a couple decisions to make: 1) Should socket, packet, address and pduFactory be local to receivePdu() or members of EspduReceiver? If the answer to this its "local to receivePdu()", then you need to remove the outer declaration for these variables. If the answer is "members of EspduReceiver" then you need to remove the inner declaration, and maybe refer to each using "this.socket" to make the references clear. 2) Intertwined with that decision is if those variables should be local to the method or members of the class is if receivePdu() is static or not. So I think there are three overall approaches: A) receivePdu() is a static member which accesses only static and local variables (convert the instance variables to static variables (as @barak says) and remove the local variables.) B) receivePdu() is a method invoked on an instance of EspduReceiver, so you need to instantiate an instance of EspduReceiver in order to envoke it. "socket" and the other variables should be members, not re-declared in receivePdu() C) set up receivePdu() as a singleton class, and proceed similarly to "B". good luck!
has comment: http://stackoverflow.com/comment/35321878
type: Answer
has comment: http://stackoverflow.com/comment/35321775
has comment: http://stackoverflow.com/comment/35320894
score: 0

http://stackoverflow.com/q/23053935
favorite count: 0
has answer: http://stackoverflow.com/a/23054316
accepted answer: http://stackoverflow.com/a/23054316
has title: When would you use AffineTransform getScaleX()?
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: affinetransform
type: Question
tagged with: awt
upvote count: 3
tagged with: matrix
answer count: 1
has body: Is there a legitimate use case for AffineTransform.getScaleX() and family? It returns the m00 or the top left corner element of the transform matrix and that is pretty useless for determining the scaling the matrix does. Consider for example a trivial 90 degree rotation matrix and both getScaleX() and getScaleY() return 0. I would never use this call as it is confusing to the code reader who may not be familiar with the fact that it does not return scaling in a meaningful way, much better to getMatrix(m) and then access the m[0], because most people likely to read code that uses transformations are familiar with matrix math. There must be a use case for this, but I just don't get it.

http://stackoverflow.com/a/23222019
type: Answer
score: 1
upvote count: 1
has body: I think this is because in Ruby you can't overload a method with the same number of arguments because there is no data type declaration. You can only overload methods with different numbers of arguments: public void test(int x) vs public void test(RubyArray arr, int x) So when you call the test-method it flips out and it just takes the first method (don't know how or why it searches or finds the one with the int-param). Also see this answer: Why doesn&#39;t ruby support method overloading?
answers question: http://stackoverflow.com/q/23121703
downvote count: 0

http://stackoverflow.com/comment/35374242
score: 0
type: Comment
type: AnswerComment
has text: thanks. but right the db is named op. how can i call the function op.createTheGraph();op.knowsLikesTraverser(A); the second one give me error
comment on: http://stackoverflow.com/a/23130929

http://stackoverflow.com/a/23049623
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/35218439
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23049619
answers question: http://stackoverflow.com/q/23049619
has comment: http://stackoverflow.com/comment/35218495
upvote count: 4
has body: You need to assign the return value of name to a local variable: public static void main(String[] args) { // TODO code application logic here intro(); String name = name(); System.out.println("Welcome " + name); } public static String name(){ System.out.println("Enter Name:"); String name = sc.next(); return name; }
has comment: http://stackoverflow.com/comment/35218457

http://stackoverflow.com/q/23128232
answer count: 4
tagged with: client-server
has answer: http://stackoverflow.com/a/23246754
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/75983450
has body: I want to write a netty based client. It should have method public String send(String msg); which should return response from the server or some future - doesen't matter. Also it should be multithreaded. Like this: public class Client { public static void main(String[] args) throws InterruptedException { Client client = new Client(); } private Channel channel; public Client() throws InterruptedException { EventLoopGroup loopGroup = new NioEventLoopGroup(); Bootstrap b = new Bootstrap(); b.group(loopGroup).channel(NioSocketChannel.class).handler(new ChannelInitializer&lt;SocketChannel&gt;() { @Override protected void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new StringDecoder()). addLast(new StringEncoder()). addLast(new ClientHandler()); } }); channel = b.connect("localhost", 9091).sync().channel(); } public String sendMessage(String msg) { channel.writeAndFlush(msg); return ??????????; } } And I don't get how can I retrieve response from server after I invoke writeAndFlush(); What should I do? Also I use Netty 4.0.18.Final
favorite count: 0
score: 17
type: Question
tagged with: netty
has answer: http://stackoverflow.com/a/36836576
has answer: http://stackoverflow.com/a/35318079
tagged with: java
has title: How to get server response with netty client
upvote count: 17

http://stackoverflow.com/q/23100014
tagged with: boxlayout
type: Question
has comment: http://stackoverflow.com/comment/35310301
tagged with: java
has answer: http://stackoverflow.com/a/23102767
has body: I am extremely new to Java Swing, and I'm having quite a bit of issues getting a nice layout going. I have checked out google, and even other answers on this website, but no information I find seems to solve the issue. Here is the result of my efforts: As you can see, the label, text field, and button are all out of alignment. It is my goal for all of them to have the same left-hand border, and for the button and text field to have the same right-hand border, with these left and right hand borders being each the same distance from the left and righthand sides of my window. Here are the important parts of my code: public void run() { JFrame frame = new JFrame("Arduino Server"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); InstancePanel = new ServerGUIPanel(); frame.getContentPane().add(InstancePanel); frame.pack(); frame.setVisible(true); } And, in ServerGUIPanel.java: public ServerGUIPanel() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setPreferredSize(new Dimension(500, 500)); setBorder(new EmptyBorder(10, 10, 10, 10)); StatusLabel = new JLabel("STATUS: BOOTUP"); add(StatusLabel); PortField = new JTextField(); PortField.setPreferredSize(new Dimension(5000, 20)); PortField.setMaximumSize(PortField.getPreferredSize()); PortField.setActionCommand("PortChanged"); add(PortField); ConnectionButton = new JButton(); ConnectionButton.setPreferredSize(new Dimension(5000, 20)); ConnectionButton.setMaximumSize(ConnectionButton.getPreferredSize()); ConnectionButton.setActionCommand("ConnectionClicked"); add(ConnectionButton); } Does anyone have a simple solution to this? What am I doing wrong here? Thank you very much! --Georges Oates Larsen
answer count: 2
tagged with: user-interface
downvote count: 0
has title: Java Swing (BoxLayout) alignment issues
favorite count: 0
score: 2
linked to: http://stackoverflow.com/q/12167754
upvote count: 2
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/23100536

http://stackoverflow.com/comment/35165443
type: Comment
type: QuestionComment
has text: Spoon-feeding was just something I needed right now. I believe somebody will also make use of it
score: 0
comment on: http://stackoverflow.com/q/23020090

http://stackoverflow.com/a/23039470
has body: If you want to read strings one letter at a time, you can use charAt() to convert to a char array. for (int i = 0; i &lt; myString.length(); i++) { char c = myString.charAt(i); // Do whatever you need with c // If you want to convert it back to a String type, you can do // String s = "" + c; } Using the character array: char[] myCharArray = myString.toCharArray(); for (int i = 0; i &lt; myCharArray.length; i++) { char c = myCharArray[i]; } Of course if you really just want the String type for some reason, you can use substring(). for (int i = 0; i &lt; myString.length(); i++) { String s = myString.substring(i, i+1); }
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23039447

http://stackoverflow.com/a/22969868
upvote count: 7
has comment: http://stackoverflow.com/comment/35074248
has comment: http://stackoverflow.com/comment/35074031
score: 7
accepted answer of: http://stackoverflow.com/q/22969844
has comment: http://stackoverflow.com/comment/35074142
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35074584
answers question: http://stackoverflow.com/q/22969844
downvote count: 0
type: Answer
has body: You have a bracket instead of a left parenthesis in your else if. Also, you have a semicolon instead of brackets, and are missing a right parenthesis. This: else if {String.valueOf(play).matches("[A-Z]"); should be this: else if (String.valueOf(play).matches("[A-Z]")) { About your edit: You have this: } else if (String.valueOf(play).matches("[A-Z]")) { throw new IllegalStateException( "the guess should be a letter from A­Z"); guessed.add(goat); // Unreachable Code return currentPhrase.guessLetter(goat); return false; } If the program goes into the else-if, your code: Throws an exception (and doesn't continue executing the content of the block). Adds goat to guessed (unreachable code) returns (unreachable code) returns again (double unreachable code) I think you were trying to do this: } else if (String.valueOf(play).matches("[A-Z]")) { throw new IllegalStateException( "the guess should be a letter from A­Z"); } guessed.add(goat); // Unreachable Code return currentPhrase.guessLetter(goat); but I'm not really sure. Also, if you want to throw an exception when the letter is not in the range A-Z you need: else if (!String.valueOf(play).matches("[A-Z]")) { When play doesn't match [A-Z].

custom-exceptions
type: Tag
tag name: custom-exceptions
tags question: http://stackoverflow.com/q/23022495

http://stackoverflow.com/a/23123698
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23123668
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23123668
has body: You should have only one public class per file in Java. The filename should be the same as class name plus .java extension. In your case you should have 2 files: Tester.java with Tester class ThreadTest.java with ThreadTest class

http://stackoverflow.com/comment/35100012
score: 0
has text: With that version the tomcat connection pool should be present in lib.
type: Comment
comment on: http://stackoverflow.com/a/22984378
type: AnswerComment

http://stackoverflow.com/comment/35262055
type: Comment
type: QuestionComment
has text: No matter where I put it I get the exception. I tried taking the method setSubject() out of AsyncTask and then did String s = setSubject() as the first thing on buttonClick3. I also moved the whole method itself without the heading to set the variable itself in buttonClick3 and then do sendEmails(subject) as you suggested but I STILL GET THE ERROR. Have been stuck here for quite some time.
comment on: http://stackoverflow.com/q/23072907
score: 0

http://stackoverflow.com/comment/35320894
has text: Thanks for your answer- I think I understand what you mean: basically I can't declare the socket, packet, InetAddress or PduFactory both globally and locally? I'm fairly sure I want to declare them globally, because I may need to use them in other classes- so should I change the code inside my `receivePdu()` method to `this.socket = new MulticastSocket(EspduSender.PORT);`, and leave the global declarations there? I have updated my original post to show what my code currently looks like.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23106546

http://stackoverflow.com/a/23009520
accepted answer of: http://stackoverflow.com/q/23009268
answers question: http://stackoverflow.com/q/23009268
has body: It's Simple because you ar redirecting the page twice. if your first (if) condition true or false, the page is already redirected to other page. after that how it will redirect again. so solution is that convert two condition's into one. like that :- if (error.equals("")) { System.out.print(receptnr); if(error1.equals("")) { System.out.print(varenr); response.sendRedirect("VisOKData.jsp?varenr_resultat="+varenr); } else { response.sendRedirect("VisError.jsp?error_resultat="+error); } } else { response.sendRedirect("VisError.jsp?error_resultat="+error); }
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer
upvote count: 3

http://stackoverflow.com/q/23037304
tagged with: arrays
has title: how to insert an integer element into sorted array
has answer: http://stackoverflow.com/a/23037537
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23037686
tagged with: insert
favorite count: 0
type: UnansweredQuestion
has body: I need to create a method that inserts an integer into a sorted array of integers. I had already done this method but not with integers but with strings. Now I have a problem with integers. My method with array of strings is: public int inserisci(String s) throws IllegalStateException { if(numElementi == elementi.length) throw new IllegalStateException("Full array."); int pos = ricercaBinaria(s); if(pos &gt; -1) return -1; if(elementi[-(pos + 1)] != null) { for(int i = numElementi; i &gt;= -(pos + 1); i--) elementi[i + 1] = elementi[i]; } elementi[-(pos + 1)] = s; numElementi++; return -(pos + 1); } For the array of strings I wrote this one: public int insert(int x) throws IllegalStateException { if(numElements == elements.length) throw new IllegalStateException("Full array."); int pos = binarySearch(x); if(pos &gt; -1) return -1; if(**elements[-(pos + 1)] != null**) { for(int i = numElements; i &gt;= -(pos + 1); i--) elements[i + 1] = elements[i]; } elements[-(pos + 1)] = x; numElements++; return -(pos + 1); } But the bold part (elements[-(pos + 1)] != null) is not correct. How can I replace it? Thanks
has comment: http://stackoverflow.com/comment/35196298
has answer: http://stackoverflow.com/a/23037396
tagged with: java
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/a/23009881
has body: You can use the 2 backslashes as a single variable say, String separator = "\\"; String file_path = "src"+separator +"com"+separator +"config"+separator +"OR.properties"; System.out.println("File Path is :: " + file_path); Or as Mena Suggested, you can use: String separator = System.getProperty("file.separator");
type: Answer
answers question: http://stackoverflow.com/q/23009455
score: 0

http://stackoverflow.com/q/22996619
has comment: http://stackoverflow.com/comment/35122437
has comment: http://stackoverflow.com/comment/35122242
has body: In a swing application, I have a popup jDialog which pops up with a jlabel that says "Hang on 5 seconds." After 5 Seconds, the label should change to "Okay, now I'm done." And a button should appear allowing the user to click continue. In the example action below (linked to a button which causes the popup), the popup appears as it should but it is blank instead of saying "Hang on 5 seconds." Then after 5 seconds everything updates and the labels are there and the button too. So what's going on? Is the thread sleeping before a repaint or something? @Action public void popUp() { popUpDialog.setSize(300,200); popUpDialog.setLocationRelativeTo(null); popUpDialog.setVisible(true); popUpLabel.setVisible(true); popUpLabel.setText("Working, hang on a sec...."); try { Thread.sleep(5000); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } popUpLabel.setText("Okay Now I'm Done."); popUpBut.setVisible(true); } EDIT: So I tried this, in an effort to use a swing timer in place of thread sleeping: @Action public void popUp() { popUpDialog.setSize(300,200); popUpDialog.setLocationRelativeTo(null); popUpDialog.setVisible(true); popUpLabel.setVisible(true); popUpLabel.setText("Working, hang on a sec...."); Timer timer = new Timer(speed, this); timer.setInitialDelay(pause); timer.start(); popUpLabel.setText("Okay Now I'm Done."); popUpBut.setVisible(true); } Obviously I'll need more code to finish the timer, but right off the bat I get a symbol not found, variable: timer error. What's that all about? Am I doing it wrong? Edit 2: I changed the timer declaration and solved one problem but created another. Now I am getting the symbol not found error in regards to speed. I have never used a swing timer before and don't know how to use them. The java tutorial on the topic is convoluted and difficult to understand. Can any of you point me to a simple, clear example of a timer so I can learn from that and figure out what I need to do?
upvote count: 1
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22997093
downvote count: 0
has comment: http://stackoverflow.com/comment/35122126
has comment: http://stackoverflow.com/comment/35122480
has comment: http://stackoverflow.com/comment/35122715
has answer: http://stackoverflow.com/a/22996776
has comment: http://stackoverflow.com/comment/35122571
answer count: 3
has comment: http://stackoverflow.com/comment/35123620
tagged with: thread-sleep
has comment: http://stackoverflow.com/comment/35122299
has title: Simple Swing Delay
possible better answer: http://stackoverflow.com/a/22996776
has comment: http://stackoverflow.com/comment/35122367
has comment: http://stackoverflow.com/comment/35122858
has answer: http://stackoverflow.com/a/22996946
favorite count: 0
has comment: http://stackoverflow.com/comment/35122235
accepted answer: http://stackoverflow.com/a/22997093
tagged with: event-dispatch-thread
has comment: http://stackoverflow.com/comment/35122324
has comment: http://stackoverflow.com/comment/35122154

http://stackoverflow.com/comment/35279425
score: 0
has text: Uh, if you look at the error message, that's what it says. I am connecting to localhost, which is hard to screw up and it's the out of the box port.
type: AnswerComment
comment on: http://stackoverflow.com/a/23083471
type: Comment

http://stackoverflow.com/q/22994526
has comment: http://stackoverflow.com/comment/35118154
downvote count: 1
has body: Why in the code below "public void run() throws InterruptedException" creates a compilation error but "public void run() throws RuntimeException" does not? The compilation error raised by InterruptedException is"Exception InterruptedException is not compatible with throws clause in Runnable.run()" Is it because RuntimeException is unchecked exception therefore does not change the run() signature? public class MyThread implements Runnable{ String name; public MyThread(String name){ this.name = name; } @Override public void run() throws RuntimeException{ for (int i = 0; i &lt; 10; i++) { try { Thread.sleep(Math.round(100*Math.random())); System.out.println(i+" "+name); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public static void main(String[] args) { Thread thread1 = new Thread (new MyThread("Jay")); Thread thread2 = new Thread (new MyThread("John")); thread1.start(); thread2.start(); } }
type: AnsweredQuestion
score: 3
tagged with: java
linked to: http://stackoverflow.com/q/22968504
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/22994603
linked to: http://stackoverflow.com/q/11584159
answer count: 1
tagged with: exception
accepted answer: http://stackoverflow.com/a/22994603
favorite count: 0
has comment: http://stackoverflow.com/comment/93193591
duplicate of: http://stackoverflow.com/q/11584159
linked to: http://stackoverflow.com/q/10513374
has title: Why adding throws InterruptedException creates compilation error for implementation of Runnable
tagged with: multithreading

http://stackoverflow.com/q/22975503
type: Question
has answer: http://stackoverflow.com/a/22983850
has answer: http://stackoverflow.com/a/22984011
has comment: http://stackoverflow.com/comment/35084531
has comment: http://stackoverflow.com/comment/35084988
tagged with: android-location
has comment: http://stackoverflow.com/comment/35084768
has comment: http://stackoverflow.com/comment/35084448
has title: Crash onLocationChanged() Android
has comment: http://stackoverflow.com/comment/35084598
has comment: http://stackoverflow.com/comment/35084981
possible better answer: http://stackoverflow.com/a/22976524
downvote count: 0
has comment: http://stackoverflow.com/comment/35085105
has body: I am getting a crash in onLocationChanged() method and this is what I get in logCat 04-10 00:51:43.354: E/AndroidRuntime(4132): FATAL EXCEPTION: main 04-10 00:51:43.354: E/AndroidRuntime(4132): Process: com.dd.assistant, PID: 4132 04-10 00:51:43.354: E/AndroidRuntime(4132): java.lang.NullPointerException 04-10 00:51:43.354: E/AndroidRuntime(4132): at com.twixkat.assistant.MainActivity.onLocationChanged(MainActivity.java:1314) 04-10 00:51:43.354: E/AndroidRuntime(4132): at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:279) 04-10 00:51:43.354: E/AndroidRuntime(4132): at android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:208) 04-10 00:51:43.354: E/AndroidRuntime(4132): at android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:224) 04-10 00:51:43.354: E/AndroidRuntime(4132): at android.os.Handler.dispatchMessage(Handler.java:102) 04-10 00:51:43.354: E/AndroidRuntime(4132): at android.os.Looper.loop(Looper.java:136) 04-10 00:51:43.354: E/AndroidRuntime(4132): at android.app.ActivityThread.main(ActivityThread.java:5081) 04-10 00:51:43.354: E/AndroidRuntime(4132): at java.lang.reflect.Method.invokeNative(Native Method) 04-10 00:51:43.354: E/AndroidRuntime(4132): at java.lang.reflect.Method.invoke(Method.java:515) 04-10 00:51:43.354: E/AndroidRuntime(4132): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 04-10 00:51:43.354: E/AndroidRuntime(4132): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607) 04-10 00:51:43.354: E/AndroidRuntime(4132): at dalvik.system.NativeStart.main(Native Method) and method: @Override public void onLocationChanged(Location arg0) { // TODO Auto-generated method stub List&lt;Address&gt; addresses = null; if (arg0 != null) { double longitude = arg0.getLongitude(); double latitude = arg0.getLatitude(); Geocoder gcd = new Geocoder(getApplicationContext(), Locale.getDefault()); try { addresses = gcd.get…
has comment: http://stackoverflow.com/comment/35084634
favorite count: 0
accepted answer: http://stackoverflow.com/a/22985147
has comment: http://stackoverflow.com/comment/35085525
has comment: http://stackoverflow.com/comment/35084457
has comment: http://stackoverflow.com/comment/35084921
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/22985147
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/22976524
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35084593

http://stackoverflow.com/q/23093897
type: UnansweredQuestion
tagged with: soap
tagged with: spring-ws
has answer: http://stackoverflow.com/a/37323805
tagged with: java
has title: Sending XmlData in soap request using spring ws
has body: I have requirement to send XmlData in CDATA to soap request which returns an attachment. Using org.springframework.oxm.jaxb.Jaxb2Marshaller as marshaller and unmarshaller. &lt;![CDATA[&lt;tag&gt;Test&lt;/tag&gt;]]&gt; this is something I want to send in the soap request and remote service is expecting it to see the same way. I have created the data but when I use webServiceTemplate.marshalSendAndReceive(payloadRequest, SoapActionCallback) somehow, payload request xmltags are encoded and shows as &amp;lt;![CDATA[&amp;lt;tag&amp;gt;Test&amp;lt;\tag&amp;gt; Because of this encoding, remote service cannot process the request and send org.springframework.ws.soap.client.SoapFaultClientException: Object reference not set to an instance of an object. how can I fix this issue? Any suggestions! Update: Does, spring mvc's defaultHtmlEscape as context-param in web.xml responsible for this behaviour?
type: Question
has answer: http://stackoverflow.com/a/31157627
answer count: 2
downvote count: 0
favorite count: 0
score: 8
upvote count: 8

http://stackoverflow.com/comment/87961232
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/35318079
has text: Anyone else getting this error? In `return sendMessage(message, ctx.newPromise());` newPromise is of type `io.netty.channel.ChannelPromise` when required is `io.netty.util.concurrent.Promise<String>`. After some casts Im getting `ClassCastException: java.lang.String cannot be cast to java.lang.Void`.
score: 0

http://stackoverflow.com/a/64860644
type: Answer
answers question: http://stackoverflow.com/q/23036284
has body: No you cannot do that. Because the servlet name that you define in section you define the URL Pattern with acts as an identifier to the servlet name that is used to map it with the class
score: 0

http://stackoverflow.com/q/22997733
linked to: http://stackoverflow.com/q/11093326
favorite count: 0
has answer: http://stackoverflow.com/a/22997804
type: AnsweredQuestion
score: 1
upvote count: 1
tagged with: swing
tagged with: jtextfield
type: Question
accepted answer: http://stackoverflow.com/a/22997804
tagged with: java
has body: Just wanted to know why this is occurring, not that it's a huge issue. Problem I have a class, JDecimalField, that extends JTextField. I've modified the createDefaultModel() code in this class so it returns a custom Document that writes only numerical inputs (1 through 9 as well as '.'). Created a quick SSCCE of the code I have, excuse the dirtiness: import java.io.Serializable; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.WindowConstants; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.PlainDocument; public class TestField{ public static void main(String args[]){ JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JDecimalField field = new JDecimalField(); frame.add(field); frame.pack(); frame.setVisible(true); } public static class JDecimalField extends JTextField{ public JDecimalField() { super(); } @Override protected Document createDefaultModel() { String[] inputs = {"1", "2", "3", "4","5","6","7","8","9", "0", "."}; return new RestrictedDocument(inputs); } public int getValue() throws NumberFormatException{ return Integer.parseInt(getText()); } } public static class RestrictedDocument extends PlainDocument implements Serializable { private final String[] charList; public RestrictedDocument(String[] charList){ this.charList = charList; } public boolean validate(String exp){ for (String charList1 : charList) { if (exp.equals(charList1)) { return true; } } return false; } @Override public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { if (validate(str)){ super.insertString(offs, str, a); } } } } My Question/TL;DR: I just was wondering what in my RestrictedDocument is not accepting a ctrl+v action? Being able to do so would be nice but I could live without it. And before it's mentioned, yes I've considered using a JFormattedTextField. I usually do, just in …
has title: JTextField with customDefaultModel override doesn't allow pasting
linked to: http://stackoverflow.com/q/6172267
answer count: 1
downvote count: 0

http://stackoverflow.com/q/22975394
possible better answer: http://stackoverflow.com/a/22975566
type: AnsweredQuestion
tagged with: fxml
upvote count: 1
type: Question
score: 1
tagged with: java
has title: How do I get my fxml and java classes to work together?
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22975542
favorite count: 0
has answer: http://stackoverflow.com/a/22975566
has body: This is a class project where we needed to set up our GUI on an fxml doc. I have gotten the layout set on the fxml however I wasn't sure how I could get the buttons to print out statement or call methods that were in different java classes. I tried searching online but didn't really understand it. Could someone tell me how I can go about having the GUI be more than just a button and have it perform things like mathamatical methods? Thank You
accepted answer: http://stackoverflow.com/a/22975542

http://stackoverflow.com/comment/35351324
score: 0
has text: i have already try this and it not working, it ill give out default value that is = 0 it not going to take out the value values to class B.
type: Comment
comment on: http://stackoverflow.com/a/23079517
type: AnswerComment

http://stackoverflow.com/q/23109443
has comment: http://stackoverflow.com/comment/35327637
has answer: http://stackoverflow.com/a/35040598
type: UnansweredQuestion
tagged with: dot-matrix
has body: i am trying to print on the USB port with EPSON LX 350 dot matrix print. i am using windows 8.1 and printer can print test page in printer properties. When i try to print some string, it runs without any problem. I see printer name as output. And i see 'java printing' line for 1 second in the printer status dialog of windows control panel. Then it disappear like it is finished printing. But it doesnt print and there is no activity in the printer. Here is the code i use for printing : String defaultPrinter = PrintServiceLookup.lookupDefaultPrintService().getName(); System.out.println("Default printer: " + defaultPrinter); PrintService service = PrintServiceLookup.lookupDefaultPrintService(); InputStream is = new ByteArrayInputStream("hello world!\f".getBytes("UTF8")); DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE; Doc doc = new SimpleDoc(is, flavor, null); DocPrintJob job = service.createPrintJob(); job.print(doc, null); is.close(); Is the problem about computer or java code or printer?
type: Question
has answer: http://stackoverflow.com/a/23129347
tagged with: java
has comment: http://stackoverflow.com/comment/35359122
score: 0
answer count: 2
has title: java usb dot matrix printing

fractions
type: Tag
tags question: http://stackoverflow.com/q/23009574
tags question: http://stackoverflow.com/q/23005518
tag name: fractions

http://stackoverflow.com/a/23023557
score: 0
answers question: http://stackoverflow.com/q/23018531
type: Answer
has comment: http://stackoverflow.com/comment/127099405
has body: The problem in my case was an external Proxy server (SSO server in my case) was filtering the cookies. So it was an environmental problem. I'm sure that parent domain cookies are available in normal environments.

http://stackoverflow.com/comment/35339395
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23116292
has text: Getting closer. I keep getting an error and it's sending me back to this line of code "StockRecord record = new StockRecord(data[0], Double.valueOf(data[4])); "
type: AnswerComment

http://stackoverflow.com/a/23081550
type: Answer
has comment: http://stackoverflow.com/comment/35277237
answers question: http://stackoverflow.com/q/23081462
has comment: http://stackoverflow.com/comment/35276167
has comment: http://stackoverflow.com/comment/35276766
has comment: http://stackoverflow.com/comment/35277148
has comment: http://stackoverflow.com/comment/35276946
has body: Quick answer is Yes. Static is a instance/class modifier. It has nothing to do with synchronization and memory model. While volatile ensures 1) instruction optimization doesn't swap the operation to volatile variable to anything before/after that 2)anything happens before manipulating the volatile variable are written to main memory. So yes you do need to make it volatile. Having said all the above I personally think your design isn't good. Exposing such global static volatile basically violates encapsulation. Unless you have such a performance reason to do so (which I guess not), the static var better be private member and latest value returned by methods to have better encapsulation.
upvote count: 4
has comment: http://stackoverflow.com/comment/35276873
has comment: http://stackoverflow.com/comment/35295486
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/35277028

http://stackoverflow.com/comment/35182457
type: QuestionComment
comment on: http://stackoverflow.com/q/23029626
score: 0
has text: @MikeM. : Working. Hats off to you! You are a pro!
type: Comment

single-sign-on
tags question: http://stackoverflow.com/q/23002749
type: Tag
tag name: single-sign-on

http://stackoverflow.com/comment/35317754
has text: btw, you can remove `@DocumentId from the mapping and probably also the `@Field on the id property (but I don't know your exact usecase). `@Id will sufficiently mark the id property as id used for Hibernate Search.
type: Comment
comment on: http://stackoverflow.com/q/23077222
type: QuestionComment
score: 0

http://stackoverflow.com/q/23031349
answer count: 2
has body: I'm trying to remove an item from an Text file using an arrayList. The ArrayList get's its values from the Text File, and then it displays it in a ListView. I have a contextual menu that pops up, and gives me an option to remove the item from the list. In the text file, all the items are on a new line. How will I go about removing specific items from the file? The ArrayList will clear it's self, and pull the data into the ArrayList when ever the action has been performed, so that is sorted. Code to remove item from array: int id = info.position; for(int i = array.size()-1; i &gt;=0; i--){ array.remove(id); }
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/23031431
has answer: http://stackoverflow.com/a/23031431
has answer: http://stackoverflow.com/a/23031468
has comment: http://stackoverflow.com/comment/35185490
favorite count: 0
tagged with: android
has title: Java - Removing item from Text File using arrayList
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23031468
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/a/23106760
has comment: http://stackoverflow.com/comment/35320279
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35320455
answers question: http://stackoverflow.com/q/23106657
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23106657
has body: Change this: Bitmap bm = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory() + "/MANUAL/workflow/" + bmt); to this: Bitmap bm = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory() + "/MANUAL/workflow/" + bmt[0]); You have to get first element of String... bmt string array.
type: Answer

http://stackoverflow.com/a/23018185
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23018136
accepted answer of: http://stackoverflow.com/q/23018136
has body: I think this schould work: if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { e.consume(); //My Problem is Here---------------------------- ((JTextField)e.getSource()).setText(""); } Just the default way of casting objects. But it might happen that some errors occur if e is not an instance of JTextField. So if you are sure that your Listener will not give a source other than JTextField object you can go this way. Otherwise you you add errorhandling /-prevention.

http://stackoverflow.com/comment/35167101
type: Comment
comment on: http://stackoverflow.com/a/23020851
type: AnswerComment
has text: The binary code string is returned by the method. You would have something like this: System.out.print(toBinary(num));
score: 0

http://stackoverflow.com/q/23101612
tagged with: wallpaper
type: AnsweredQuestion
has title: PhotoView library and image set as wallpaper
accepted answer: http://stackoverflow.com/a/23102615
type: Question
tagged with: android
score: 0
has body: I'm using the PhotoView library to have a slide view of images. That's easy. Then I wanted set as wallpaper the image I wanted, maybe on click in a button but I have a problem! The library seems that not allows create a layout but only its in this way. &lt;com.ex.paper.HackyViewPager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/view_pager" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; So i can't add any button. I need detect the right array position and in some way set that image as wallpaper.. So far the code is this: `public class MainActivity extends Activity { Bitmap bitmap; int lastImageRef; private static final String ISLOCKED_ARG = "isLocked"; private ViewPager mViewPager; private static MenuItem menuLockItem; private WallpaperManager wallpaper; private static int[] sDrawables = { R.drawable.wallpapertwo, R.drawable.twixkatfirst, R.drawable.wallpaper, R.drawable.sfondo, R.drawable.wallpapertre}; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mViewPager = (HackyViewPager) findViewById(R.id.view_pager); setContentView(mViewPager); mViewPager.setAdapter(new SamplePagerAdapter()); if (savedInstanceState != null) { boolean isLocked = savedInstanceState.getBoolean(ISLOCKED_ARG, false); ((HackyViewPager) mViewPager).setLocked(isLocked); } } static class SamplePagerAdapter extends PagerAdapter { @Override public int getCount() { return sDrawables.length; } @Override public View instantiateItem(ViewGroup container, int position) { PhotoView photoView = new PhotoView(container.getContext()); photoView.setImageResource(sDrawables[position]); WallpaperManager wallpaper = WallpaperManager.getInstance(container.getContext()); /*Toast number = Toast.makeText(container.getContext(), "wallpaper number "+position, Toast.LENGTH_LONG); number.show();*/ // Now just add PhotoView to ViewPag…
tagged with: java
has answer: http://stackoverflow.com/a/23102615
answer count: 1
tagged with: photoviewer

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/23127163
tags question: http://stackoverflow.com/q/23059814
tag name: ksoap2
tags question: http://stackoverflow.com/q/23076478

http://stackoverflow.com/comment/35216982
score: 0
type: Comment
type: QuestionComment
has text: where is the code that take a while to perform ?
comment on: http://stackoverflow.com/q/23048763

http://stackoverflow.com/comment/35265157
type: QuestionComment
comment on: http://stackoverflow.com/q/23074844
score: 0
has text: ITs working whats prob with that? and SFD use to format date.
type: Comment

http://stackoverflow.com/q/23119569
tagged with: java
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/23119691
answer count: 1
has title: From BufferedImage to File: Return Type issues
has answer: http://stackoverflow.com/a/23119691
tagged with: file
tagged with: swing
tagged with: bufferedimage
type: AnsweredQuestion
has body: Sorry if this bugs anyone, but I'm unsure of the other questions I perused searching for an answer. My issue is I'm creating a class that simply adds Gaussian Noise to the File type passed in. Once I've added the noise, I'd like to return the result to a MainScreen class I have created. The problem is, MainClass uses File in its JPanel. My question is how do I convert the BufferedImage type into a File type return for my Mainscreen class without causing errors for use with Swing's Jpanel? Here's the code, if you'd like to see it for clarity. (I'm okay with this being closed if it's the wrong way to ask; I'm new to all of this and I'll be zen about this) import java.io.*; import java.util.*; import java.lang.Math; import java.awt.Image; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; public class NoiseGenerator { Image image; BufferedImage buffered; Random r; int width; int height; int index; //The part of the code I'm referring to in the question //addNoiseToImage takes in a File. public BufferedImage addNoiseToImage(File imageToBeChanged, int standardDeviation){ try { image = ImageIO.read(imageToBeChanged); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } buffered = (BufferedImage) image; width = image.getWidth(null); height = image.getHeight(null); index = 0; double noiseHolder; int noiseValues[] = new int[100]; int delay = 0; int check = 0; do { noiseHolder = r.nextGaussian() * standardDeviation; check = (int) Math.round(noiseHolder); if (check &gt; 0) { noiseValues[delay] = (int) noiseHolder; delay++; } } while (delay &lt;= 100); int j; int i; for (j=0; j&lt;height; j++) { for(i=0;i&lt;width;i++) { index = (int) (Math.random() * (99 - 0)) + 0; buffered.setRGB(j,i,noiseValues[index]); } } return buffered; //I just have it returning a BufferedImage type to stop the error message; I'd prefer it to be a File type. } }

http://stackoverflow.com/q/23120014
tagged with: unit-testing
type: Question
tagged with: mockito
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23120446
has body: I am working on unit tests. Our project is working with the Play! framework. The unit tests are written in Java. Our team has encountered a problem where we have been experiencing duplicate test runs for test classes which are annotated with @RunWith(PowerMockRunner.class) and extend another class. Our main set up for test classes are as follows: A Unit Test Harness: Contains functionality shared among various test cases. Also contains commonly used fields. @Ignore @RunWith(PowerMockRunner.class) @PrepareForTest(SomeStaticClass.class) public abstract class UnitTestHarness { //Bunch of setup code... } A Test Class: Contains the test cases for the class we're testing. public class TestClass extends UnitTestHarness { @Test public void testSomething(){ //Perform some tests... } } As you can see, TestClass extends UnitTestHarness which has the annotation. When TestClass is run by the play "test-only" command, the following output is returned: [info] somepackage.TestClass [info] + testSomething [info] [info] [info] Total for test somepackage.TestClass [info] Finished in 0.055 seconds [info] 1 tests, 0 failures, 0 errors [info] somepackage.TestClass [info] + testSomething [info] [info] [info] Total for test somepackage.TestClass [info] Finished in 0.001 seconds [info] 4 tests, 0 failures, 0 errors [info] Passed: Total 4, Failed 0, Errors 0, Passed 4 [success] Total time: 18 s, completed Apr 16, 2014 4:19:37 PM Obviously, the tests are being run twice for some reason. I've read online that there have been some issues with the @RunWith annotation and extending classes, but I haven't been able to find a solution. I feel it is also import to note that if I move the annotation from UnitTestHarness to TestClass, the following output will be returned: [info] somepackage.TestClass [info] [info] [info] Total for test somepackage.TestClass [info] Finished in 0.032 seconds [info] 0 tests, 0 failures, 0 errors [info] somepackage.TestClass [info] + testSomething [info] [info] [info] To…
favorite count: 0
has comment: http://stackoverflow.com/comment/35345451
tagged with: powermock
type: UnansweredQuestion
has title: Test Class with @RunWith(PowerMockRunner.class) annotation runs test cases twice when extending another class
tagged with: annotations
upvote count: 1
has comment: http://stackoverflow.com/comment/35345322
score: 1
tagged with: java

jsp
tags question: http://stackoverflow.com/q/22995419
tags question: http://stackoverflow.com/q/22980147
tags question: http://stackoverflow.com/q/23005822
tags question: http://stackoverflow.com/q/23117797
tags question: http://stackoverflow.com/q/23114591
tags question: http://stackoverflow.com/q/23095387
tags question: http://stackoverflow.com/q/22985463
tags question: http://stackoverflow.com/q/22975964
tags question: http://stackoverflow.com/q/23066864
tags question: http://stackoverflow.com/q/23096555
tags question: http://stackoverflow.com/q/23026452
tags question: http://stackoverflow.com/q/23068223
tags question: http://stackoverflow.com/q/23104740
tags question: http://stackoverflow.com/q/23098478
tags question: http://stackoverflow.com/q/22979162
tags question: http://stackoverflow.com/q/23093200
tags question: http://stackoverflow.com/q/22998834
tags question: http://stackoverflow.com/q/23073291
tags question: http://stackoverflow.com/q/23011391
tags question: http://stackoverflow.com/q/22992142
tags question: http://stackoverflow.com/q/23031317
tags question: http://stackoverflow.com/q/22993282
tags question: http://stackoverflow.com/q/23100995
tags question: http://stackoverflow.com/q/23015792
tags question: http://stackoverflow.com/q/23078302
tags question: http://stackoverflow.com/q/23119018
tags question: http://stackoverflow.com/q/23032772
tags question: http://stackoverflow.com/q/23053341
tags question: http://stackoverflow.com/q/23078603
tags question: http://stackoverflow.com/q/23045690
tags question: http://stackoverflow.com/q/23081392
tags question: http://stackoverflow.com/q/23031984
tags question: http://stackoverflow.com/q/22976365
tags question: http://stackoverflow.com/q/23005192
tags question: http://stackoverflow.com/q/22978212
tags question: http://stackoverflow.com/q/22990182
tags question: http://stackoverflow.com/q/23009268
tags question: http://stackoverflow.com/q/23027535
type: Tag
tags question: http://stackoverflow.com/q/23118478
tags question: http://stackoverflow.com/q/23116770
tags question: http://stackoverflow.com/q/23080102
tags question: http://stackoverflow.com/q/23083945
tags question: http://stackoverflow.com/q/23053666
tags question: http://stackoverflow.com/q/23113236
tags question: http://stackoverflow.com/q/23048532
tags question: http://stackoverflow.com/q/22969405
tags question: http://stackoverflow.com/q/23069839
tags question: http://stackoverflow.com/q/23055284
tags question: http://stackoverflow.com/q/22990378
tags question: http://stackoverflow.com/q/23010458
tags question: http://stackoverflow.com/q/23055094
tags question: http://stackoverflow.com/q/23064748
tags question: http://stackoverflow.com/q/23111928
tags question: http://stackoverflow.com/q/22968950
tags question: http://stackoverflow.com/q/23062536
tags question: http://stackoverflow.com/q/23127593
tags question: http://stackoverflow.com/q/23122675
tag name: jsp
tags question: http://stackoverflow.com/q/23016224
tags question: http://stackoverflow.com/q/22987226
tags question: http://stackoverflow.com/q/23059947
tags question: http://stackoverflow.com/q/23016577
tags question: http://stackoverflow.com/q/23075933
tags question: http://stackoverflow.com/q/23109985
tags question: http://stackoverflow.com/q/23121028
tags question: http://stackoverflow.com/q/22970677
tags question: http://stackoverflow.com/q/22994088
tags question: http://stackoverflow.com/q/23100924
tags question: http://stackoverflow.com/q/23041750
tags question: http://stackoverflow.com/q/23016869
tags question: http://stackoverflow.com/q/23011934
tags question: http://stackoverflow.com/q/23128429
tags question: http://stackoverflow.com/q/22975949
tags question: http://stackoverflow.com/q/23020975
tags question: http://stackoverflow.com/q/23126587
tags question: http://stackoverflow.com/q/23048599
tags question: http://stackoverflow.com/q/23009479
tags question: http://stackoverflow.com/q/23054471
tags question: http://stackoverflow.com/q/23013316

http://stackoverflow.com/q/23016194
tagged with: opencv
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35290235
tagged with: java
tagged with: image-processing
type: Question
upvote count: 4
score: 4
linked to: http://stackoverflow.com/q/17162559
has answer: http://stackoverflow.com/a/23017872
downvote count: 0
answer count: 1
has title: Detecting rectangle in image gives unwanted result (opencv, java)
favorite count: 0
accepted answer: http://stackoverflow.com/a/23017872
has body: I have this picture that I have done thresholding on to convert it to binary image and black and white. See the picture below: I want to extract each box with a letter, this was done by the following code: List&lt;MatOfPoint&gt; contours = new ArrayList&lt;MatOfPoint&gt;(); Imgproc.findContours(destination3, contours, new Mat(), Imgproc.RETR_LIST,Imgproc.CHAIN_APPROX_SIMPLE); MatOfPoint2f approxCurve = new MatOfPoint2f(); int x = 1; //For each contour found for (int i=0; i&lt;contours.size(); i++) { //Convert contours(i) from MatOfPoint to MatOfPoint2f MatOfPoint2f contour2f = new MatOfPoint2f( contours.get(i).toArray() ); //Processing on mMOP2f1 which is in type MatOfPoint2f double approxDistance = Imgproc.arcLength(contour2f, true)*0.02; Imgproc.approxPolyDP(contour2f, approxCurve, approxDistance, true); //Convert back to MatOfPoint MatOfPoint points = new MatOfPoint( approxCurve.toArray() ); // Get bounding rect of contour Rect rect = Imgproc.boundingRect(points); if(rect.height &gt; 50 &amp;&amp; rect.height &lt; 100) { // draw enclosing rectangle (all same color, but you could use variable i to make them unique) //Core.rectangle(destination, new Point(rect.x,rect.y), new Point(rect.x+rect.width,rect.y+rect.height), new Scalar(255, 0, 255), 3); Rect roi = new Rect(rect.x, rect.y, rect.width, rect.height); Mat cropped = new Mat(destination3, roi); Highgui.imwrite("letter"+x+".jpg", cropped); x++; } } But a letter extracted is totally black, it seems like it fills in the white letters as well as seen in the picture below. How do I fix this? What is wrong with my code?

http://stackoverflow.com/q/22981673
has title: What is the purpose of using synchronized (Thread.currentThread()){...} in Java?
has answer: http://stackoverflow.com/a/22981731
downvote count: 0
possible better answer: http://stackoverflow.com/a/22982070
accepted answer: http://stackoverflow.com/a/22981950
has comment: http://stackoverflow.com/comment/35095028
has comment: http://stackoverflow.com/comment/35095199
tagged with: synchronization
favorite count: 0
upvote count: 25
has body: I faced the following code in our project: synchronized (Thread.currentThread()){ //some code } I don't understand the reason to use synchronized on currentThread. Is there any difference between synchronized (Thread.currentThread()){ //some code } and just //some code Can you provide an example which shows the difference? UPDATE more in details this code as follows: synchronized (Thread.currentThread()) { Thread.currentThread().wait(timeInterval); } It looks like just Thread.sleep(timeInterval). Is it truth?
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35094998
has answer: http://stackoverflow.com/a/22982038
answer count: 4
score: 25
has answer: http://stackoverflow.com/a/22981950
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35100584
tagged with: java
tagged with: thread-safety
tagged with: concurrency
has answer: http://stackoverflow.com/a/22982070
type: Question

http://stackoverflow.com/q/23026118
has answer: http://stackoverflow.com/a/30118539
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35176709
tagged with: bukkit
has title: Cant reset Score
has comment: http://stackoverflow.com/comment/35176700
type: Question
score: 0
has body: So using my two methods here public static void run(final Plugin plugin, String oldText, final Scroller scroller, final Scoreboard board, final Objective obj){ final String text = scroller.next(); board.resetScores(Bukkit.getOfflinePlayer(oldText)); Bukkit.getScheduler().runTaskTimer(plugin, new Runnable(){ public void run(){ Score score = obj.getScore(Bukkit.getOfflinePlayer(text)); score.setScore(4); resetScores(scroller.next(), board, plugin, scroller); } }, 20L, 20L); } public static void resetScores(final String args, final Scoreboard board, Plugin plugin, Scroller scroller){ Bukkit.getScheduler().runTaskLater(plugin, new Runnable(){ @Override public void run() { board.resetScores(Bukkit.getOfflinePlayer(args)); } }, 20L); scroller.next(); } I cannot reset the score for the Player. I want it so it creates a scrolling fashion on my scoreboard. I am calling it like so (In a different class) scoreboardScroller.run(plugin, "One Moment...", rankScroller, scoreboard, objective);
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/a/23078389
has body: you can not directly cast JSONArray to Points what you can do something like following get json as a string de-serialize json to Point using jackson(ObjectMapper)
type: Answer
answers question: http://stackoverflow.com/q/23078242
score: 0

http://stackoverflow.com/a/23029137
downvote count: 0
upvote count: 3
has body: Just change below line, although its not an issue. System.out.print(i); //this code does not seems execute by checking o/p on console but in reals it works as well. To System.out.println(i); //this code works and you will be able to see o/p on console. OR System.out.print(i+" "); // this will show you some momentary action on Eclipse console. It seems to me as some Eclipse IDE console printing issue. With the first version as you mentioned in your question, I can't see any output. As print() keeps on printing on the same line may be its not visible to us. However, if you run your code in Debug mode and place a breakpoint on the above line. Breakpoint will hit and you can see the output being printed as well. But for the second version, I can see it printing all number starting from 0,1... This is a similar discussion as shared by @PakkuDon
type: Answer
answers question: http://stackoverflow.com/q/23029007
score: 3
has comment: http://stackoverflow.com/comment/35181504

http://stackoverflow.com/q/22976087
has title: Parsing FHIR Bundles In Java using JSON
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35086328
tagged with: hl7-fhir
has comment: http://stackoverflow.com/comment/35086194
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 1
type: Question
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/35086367
has comment: http://stackoverflow.com/comment/35085462
has body: I am not able to parse the incoming Bundle request (JSON) to the Java data objcets. It seems that the parser does not recognize the "resourceType": "Bundle". Parser fails on if (json.has("feed")) statement of JsonParserBase. I have also tried using "resourceType": "feed" but no luck. Java implementation does not gives a concrete parser whereas it is available for .NET version. My application is Java based and it is not able to recognize the incoming Bundle request. I am using org.hl7.fhir.instance.formats.JsonParser's parseGeneral() method. Are there any third party parsers available or I am missing any thing?
answer count: 1
has comment: http://stackoverflow.com/comment/35086982
favorite count: 0
has answer: http://stackoverflow.com/a/22979267

http://stackoverflow.com/a/22985013
answers question: http://stackoverflow.com/q/22984937
type: Answer
downvote count: 0
has body: From the javadoc: If no registered ImageReader claims to be able to read the resulting stream, null is returned. You InputStream probably does not exactly contain a readable image.
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35100617

http://stackoverflow.com/comment/35137915
type: QuestionComment
comment on: http://stackoverflow.com/q/22981434
has text: This configuration and code working fine even without -metadata.xml suffix, It only creates problem when I add the line:: src/main/webapp/WEB-INF/${artifactId}-servlet.xml
score: 0
type: Comment

http://stackoverflow.com/comment/35211384
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23039927
type: AnswerComment
has text: @ash I'm confused about which part you're having trouble with or why you beleive that you have to modify the arguments. Are you perhaps getting mixed up with Java level variable arity methods? Those don't exist at the bytecode level - they just take an array parameter. Perhaps it would help if you could post an actual example of precisely what you are trying to accomplish, including the descriptors of the relevant methods.

http://stackoverflow.com/comment/44053334
type: Comment
type: QuestionComment
has text: Best way is to copy it to HDFS using copyFromLocal, then process them using Apache Hive or other big data tools.
comment on: http://stackoverflow.com/q/23009683
score: 0

http://stackoverflow.com/comment/35255947
score: 0
type: Comment
has text: **Google** will definitely help in it. Thanks a lot. It's very helpful.
comment on: http://stackoverflow.com/a/23069924
type: AnswerComment

http://stackoverflow.com/comment/35263988
has text: Braj i have anther question. In my code i loop through array and send data one by one to the client. Is it possible to send it once as string[] ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23064989
type: Comment

http://stackoverflow.com/comment/35312111
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23101380
has text: @iProgrammer : very impressive answer here http://stackoverflow.com/questions/13764280/how-do-i-exclude-fields-with-jackson-not-using-annotations
score: 3

http://stackoverflow.com/q/23035465
accepted answer: http://stackoverflow.com/a/23055738
type: Question
tagged with: testing
linked to: http://stackoverflow.com/q/8562881
has comment: http://stackoverflow.com/comment/35214719
score: 0
tagged with: playframework
tagged with: junit
answer count: 1
has answer: http://stackoverflow.com/a/23055738
has title: play testing fails (playframework 2.2.2)
has comment: http://stackoverflow.com/comment/35215175
has comment: http://stackoverflow.com/comment/35196344
type: AnsweredQuestion
tagged with: playframework-2.0
has body: Just getting used to the Play Framework and setting up a new Web Application. I wanted to do some Model Unit Tests but when I run play test I get the following error message: [Opinions] $ test [trace] Stack trace suppressed: run last *:testListeners for the full output. [error] (*:testListeners) java.net.UnknownHostException: linux-hkem.site: linux-hkem.site: Der Name oder der Dienst ist nicht bekannt [error] Total time: 10 s, completed 12.04.2014 21:42:35 Der Name oder der Dienst ist nicht bekannt is german and means: The name or the service is not recognized linux-hkem is my PC name. This seems not to be a code error, but rather a configuration error. Anyone could help me out fixing this? Heres the full stack trace: java.net.UnknownHostException: linux-hkem.site: linux-hkem.site: Der Name oder der Dienst ist nicht bekannt at java.net.InetAddress.getLocalHost(InetAddress.java:1473) at eu.henkelmann.sbt.JUnitXmlTestsListener.&lt;init&gt;(JUnitXmlTestListener.scala:25) at play.Settings$$anonfun$defaultSettings$17.apply(PlaySettings.scala:94) at play.Settings$$anonfun$defaultSettings$17.apply(PlaySettings.scala:94) at scala.Function2$$anonfun$tupled$1.apply(Function2.scala:54) at scala.Function2$$anonfun$tupled$1.apply(Function2.scala:53) at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47) at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42) at sbt.std.Transform$$anon$4.work(System.scala:64) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237) at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18) at sbt.Execute.work(Execute.scala:244) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237) at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160) at sbt.CompletionService$$anon$2.call(CompletionService.scala:30) at java.util.concurrent.FutureTask.run(F…
tagged with: java
linked to: http://stackoverflow.com/q/19472124

http://stackoverflow.com/a/23087761
has comment: http://stackoverflow.com/comment/35304390
has comment: http://stackoverflow.com/comment/35303767
has body: Just load all the data into a Client object at one time, instead of trying to go back and hit the db each time. class Client { int id; String name; String phone; String email; // getter and setters @Override public String toString() { return id + " : " + name; } } Then you can can just load all the data into the client objects and just add them to the model ResultSet RS = stmt.executeQuery("SELECT * FROM APP.CLIENTS"); ... while (RS.next()){ Client client = new Client(); client.setId(rs.getInt("id"); client.setName(rs.getString("clientName")); client.setPhone(rs.getString("clientPhone")); client.setEmail(rs.getString("clientMail"); model.addElement(client); } Then wehn you click on the JList, just extract the Client object selected and use the getters to set the text fields client_listClientes.addListSelectionListener(new ListSelectionListener(){ public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { JList list = (JList)e.getSource(); Client client = (Client)list.getSelectedValue(); textfield.setText(client.getEmail()); } } });
answers question: http://stackoverflow.com/q/23084224
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/129280540
has text: You are correct! In my case I was changing it toPKCS12 but somehow it got out of sequence. This is the command to switch it from JKS to PKCS12 ``keytool -importkeystore -srckeystore $USERPROFILE\\.keystore -destkeystore $USERPROFILE\\.keystore -deststoretype pkcs12 -deststorepass changeit -srcstorepass changeit``
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23663529
type: Comment

http://stackoverflow.com/comment/35317833
has text: Well basically all the panel containers such as voting, calling, etc. are added to the array. In the first loop, I initialize the size, and the border for all of the panel in the array.
comment on: http://stackoverflow.com/a/23096761
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23089939
downvote count: 0
has body: I am thinking about user perspective. You could wrap this one-self containing jar within a .exe or .dmg and just install it without the need to have additional instructions on how to deploy. Also, since you are doing the deploy for a particular server only, you could take advantage of that particular server
score: 4
answers question: http://stackoverflow.com/q/23089700
type: Answer
upvote count: 4

http://stackoverflow.com/comment/35144249
comment on: http://stackoverflow.com/q/23008635
has text: You could also setup a servlet that takes an id from the request and then returns the image itself. Thus, your second app can perform an httprequest to the app1 and retrieve the image
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35261030
has text: That is actually where I got the idea to view java source code. I used the second highest rated answer to view. ctrl + click. However, it seems eclipse is not the best way to view source code, as it modifies the code
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23072659

http://stackoverflow.com/a/23088652
accepted answer of: http://stackoverflow.com/q/23088559
has comment: http://stackoverflow.com/comment/35288953
answers question: http://stackoverflow.com/q/23088559
score: 4
has body: You need to use the DOTALL flag to match the newline characters Pattern pattern = Pattern.compile(payload, Pattern.DOTALL);
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35367367
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23122242
has text: @MadProgrammer Or.. display that image in a `JLabel` and call `label.repaint()` when it changes.

http://stackoverflow.com/q/23014876
has body: I'm building a math library with coordinates / vectors. There's a ReadableCoord and WritableCoord interfraces. AbstractCoordValue can be extended to override the coordinate getters. The problem is, the methods in immutable coord (AbstractCoordValue) can be implemented two ways, as seen here as VARIANT 1 and VARIANT 2. My DRY guts tell me to go with the first (then the impl is in one place only), but I'm not sure if the second doesn't have less overhead. Which one to use? public abstract class AbstractCoordValue implements ReadableCoord { // x(), y(), z() are abstract getters from the interface @Override public WritableCoord copy() { return new CoordVariable(x(), y(), z()); } /* VARIANT 1 */ @Override public WritableCoord add(double x, double y, double z) { return copy().add_ip(x(), y(), z())); } /* VARIANT 2 */ @Override public WritableCoord add(double x, double y, double z) { return new CoordVariable(x()+x, y()+y, z()+z)); } // --- snip --- } And the extending class, mutable: public class CoordVariable extends AbstractCoordValue implements WritableCoord { private double x, y, z; // implements x(), y(), z() as getters public CoordVar(double x, double y, double x) { this.x = x; this.y = y; this.z = z; } @Override // "_ip" stands for "in place" public WritableCoord add_ip(double x, double y, double z) { this.x += x; this.y += y; this.z += z; return this; } // --- snip --- }
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23014985
accepted answer: http://stackoverflow.com/a/23014985
tagged with: class
score: 0
answer count: 1
has title: Java OOP hierarchy - avoiding overhead
tagged with: hierarchy
type: AnsweredQuestion
tagged with: oop

http://stackoverflow.com/comment/35333597
has text: Maybe not realted but.. Is this normal targetSdkVersion 17 in your gradle if your manifest has 19?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23113668

http://stackoverflow.com/comment/35264086
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23062536
has text: you missed to configure the action that u r calling on submit from your jsp.

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/23057600
tags question: http://stackoverflow.com/q/22998562
tags question: http://stackoverflow.com/q/23072623
type: Tag

http://stackoverflow.com/comment/46126022
comment on: http://stackoverflow.com/q/23037845
type: Comment
type: QuestionComment
has text: @EJP how does the `ConnectionFactory` load `jndi.properties`? While there's an [ldap example](https://docs.oracle.com/javase/jndi/tutorial/ldap/misc/url.html#MULTI) I didn't see a solution in the JNDI tutorial which answers this question.
score: 1

http://stackoverflow.com/comment/35231507
score: 0
comment on: http://stackoverflow.com/q/23054630
type: Comment
type: QuestionComment
has text: doing some debugging my equals method seems to work perfectly fine. I could be wrong but it seems to be identifying repeated states correctly

http://stackoverflow.com/comment/35284179
type: AnswerComment
type: Comment
score: 0
has text: Thanks, but what do i have to add in outPadding?
comment on: http://stackoverflow.com/a/23085951

http://stackoverflow.com/comment/41191004
comment on: http://stackoverflow.com/q/23105633
score: 0
has text: @Dragon Your code in the above question is working properly..Do you know the procedure to copy an entire directory into localhost machine??
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35161462
score: 0
comment on: http://stackoverflow.com/q/23017844
type: Comment
type: QuestionComment
has text: Is this full console log?

http://stackoverflow.com/comment/35218768
has text: Please post the detailed exception from logcat.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23049759

http://stackoverflow.com/a/23085628
has comment: http://stackoverflow.com/comment/35285486
answers question: http://stackoverflow.com/q/23085389
type: Answer
has comment: http://stackoverflow.com/comment/35283807
has comment: http://stackoverflow.com/comment/35301767
has body: Using enums example. public enum UserStatus { PENDING("P"), ACTIVE("A"), INACTIVE("I"), DELETED("D"); private String statusCode; private UserStatus(String s) { statusCode = s; } public String getStatusCode() { return statusCode; } } public void method(UserStatus status) { System.out.println(status.getStatusCode()); } }
score: 0
has comment: http://stackoverflow.com/comment/35284957

http://stackoverflow.com/comment/35205323
type: Comment
type: QuestionComment
has text: Learn to use your debugger, and find by yourself. by executing the code step by step, and inspecting the variable values. Also, realize that each time you have findEntries(name) in the code, it executes the findEntries() method.
comment on: http://stackoverflow.com/q/23042655
score: 4

http://stackoverflow.com/a/23012373
has comment: http://stackoverflow.com/comment/35150801
has comment: http://stackoverflow.com/comment/35151732
upvote count: 2
has comment: http://stackoverflow.com/comment/35150541
answers question: http://stackoverflow.com/q/23012328
type: Answer
has comment: http://stackoverflow.com/comment/35151306
score: 2
downvote count: 0
has body: Simply use JPasswordField a subclass of JTextField. It's very clearly and simply discussed in java doc so I avoid repeat.

http://stackoverflow.com/comment/35239178
comment on: http://stackoverflow.com/a/23061068
type: Comment
has text: Well ... possibly the `Child` is a nameless ghoul. :)
score: 2
type: AnswerComment

http://stackoverflow.com/comment/35231598
comment on: http://stackoverflow.com/q/23056376
has text: Working for both cases for me: `"(\\w+\\s+\\d+\\s+[\\d:]+)\\s+(\\w+)\\s+([^:]+):\\s+(.*)"`, `[^:]+` matches all the things not a `:`
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/35255854
type: QuestionComment
comment on: http://stackoverflow.com/q/23070016
has text: possible duplicate of [How do I extend Java classes by Reflection?](http://stackoverflow.com/questions/1886785/how-do-i-extend-java-classes-by-reflection)
score: 0
type: Comment

http://stackoverflow.com/q/23079460
has comment: http://stackoverflow.com/comment/35272774
answer count: 1
has comment: http://stackoverflow.com/comment/35272971
has comment: http://stackoverflow.com/comment/35272501
tagged with: java
has comment: http://stackoverflow.com/comment/35272557
has comment: http://stackoverflow.com/comment/35272868
has answer: http://stackoverflow.com/a/23079779
tagged with: client-server
type: AnsweredQuestion
has body: I am making a project, I have built a Server and a client. This is currently in the development stage and still doesn't do much. I just waned to know if its possible to send keystroke over the network from the client to the server? I have implemented keylistener to my client class. That's all done, the question is, how would I send keystroke to the server, and how would the server receive the keystrokes? How will I convert keystrokes to bytes? Will I still use getInputStream() and getOutputStream()?
has title: Sending key stroke from client to server
type: Question
accepted answer: http://stackoverflow.com/a/23079779
score: 0

http://stackoverflow.com/a/22989981
accepted answer of: http://stackoverflow.com/q/22980362
type: Answer
score: 1
upvote count: 1
has body: In JProfiler, go to the heap walker and take a heap snapshot. Then change to the "Inspections" view of the heap walker and execute the inspection named "HTTP session objects". In the references view you will be able to see all session objects and you can inspect the attributes by opening the outgoing reference.
has comment: http://stackoverflow.com/comment/35135619
has comment: http://stackoverflow.com/comment/35137581
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22980362

http://stackoverflow.com/comment/35216303
type: Comment
comment on: http://stackoverflow.com/a/23038222
score: 1
has text: @Gokarting54 Please don't replicate code 20 times. I don't know if it's easier to replicate the code (with some fancy text editors it might be). But it is bad programming practice. If you have to make a change to your algorithm, and you have the same code 20 times, you have to make the change in 20 places--what happens if you forget one?
type: AnswerComment

http://stackoverflow.com/comment/35331038
type: Comment
comment on: http://stackoverflow.com/q/23112345
score: 0
has text: i cannot find a str8 answer to my query,...the possible duplicate is not what i'm after. How do you create a curve of best fit and how would you generate an equation for it?
type: QuestionComment

http://stackoverflow.com/a/23020026
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23019689
score: 1
type: AcceptedAnswer
has body: Besides the == and equals I pointed out, you never call init(), which initializes your action commands. Also note, you class is already a JFrame. Either use the class JFrame or use the instance JFrame. You should fix the above problem so that you can properly call your init() method. Try this private static void createAndShowGUI() { mainFrame frame = new mainFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setLocationRelativeTo(null); addComponentsToPane(frame.getContentPane()); frame.init(); &lt;&lt;&lt;&lt;&lt;================== Don't forget about meeeee! frame.pack(); frame.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { if ("one".equals(e.getActionCommand())) { System.out.println("hello"); } } Also you should be following Java naming convention. Class names begin with capital letters. So mainFrame &rarr; MainFrame
has comment: http://stackoverflow.com/comment/35248798
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23019689

http://stackoverflow.com/comment/35230261
comment on: http://stackoverflow.com/a/23030989
type: Comment
has text: 1) am not using swing 2)read my question carefully...Am talking about only Applet...
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35244868
comment on: http://stackoverflow.com/q/23024629
score: 0
type: Comment
has text: This I am calling from a test web application. Before this we have only my local file name.
type: QuestionComment

http://stackoverflow.com/comment/35084634
has text: How could help me this video????
comment on: http://stackoverflow.com/q/22975503
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/126661889
comment on: http://stackoverflow.com/a/51144165
type: AnswerComment
has text: This answer is 100% true for the new version of Eclipse. I worked in old versions, and I never faced this issue. This saved me couple of days of my time. Thanks a million.
type: Comment
score: 1

http://stackoverflow.com/a/23024561
upvote count: 3
has comment: http://stackoverflow.com/comment/35173934
downvote count: 0
answers question: http://stackoverflow.com/q/23024512
type: Answer
score: 3
has body: if your number doesn't have a decimal part, you can simply do a bit operation If(MyBigNumber &amp; 0x1) { odd } else { even }

http://stackoverflow.com/comment/35073941
type: Comment
type: QuestionComment
score: 1
has text: The [Oracle JavaFX TableView tutorial](http://docs.oracle.com/javase/8/javafx/user-interface-tutorial/table-view.htm#CJAGAAEE) has sections focused on editing TableView data.
comment on: http://stackoverflow.com/q/22968595

http://stackoverflow.com/a/23107677
has comment: http://stackoverflow.com/comment/35333067
has comment: http://stackoverflow.com/comment/35334678
type: AcceptedAnswer
has body: I suspect your problem isn't actually a case of a missing comma (in my experience ORA errors are notorious for telling you the wrong thing). My suspicion is that your real issue is the use of " around the format string in your TO_CHAR call. To demonstrate, try this: SELECT TO_CHAR(SYSDATE, "dd/MM/YY") FROM DUAL; If I run the above I get an ORA-00904: "dd/MM/YY": invalid identifier error. If I change the quotes to apostrophes instead: SELECT TO_CHAR(SYSDATE, 'dd/MM/YY') FROM DUAL; I get 16/04/14. Double quotes are for identifiers, not strings: SELECT TO_CHAR(SYSDATE, 'dd/MM/YY') AS "The Date" FROM DUAL; // ^ This is an identifier prints: The Date -------- 16/04/14 EDIT: Sorry, I should have spotted this one sooner! You're using TO_CHAR in your columns list, which you can't do. The below example nicely produces an ORA-00917: missing comma error: CREATE TABLE JON_TEST (COL1 VARCHAR2(20)); COMMIT; INSERT INTO JON_TEST (TO_CHAR(COL1, 'DD/MM/YYYY')) VALUES (SYSDATE); Whereas this works: INSERT INTO JON_TEST (COL1) VALUES (TO_CHAR(SYSDATE, 'dd/MM/YYYY')); So you need to correct three things: You need to change TO_CHAR to TO_DATE, and You need to move the call to TO_DATE to your VALUES clause, and You need to ensure that you use ' instead of " with the format string. This is how Oracle define the syntax for INSERT statements: Notice that in the middle section that it only says column_name and not sql_expression. Try changing your query to the following: sqlStr.append("INSERT INTO DS_GOAL ") .append("(DS_SITE_CODE, DS_FINANCIAL_YEAR, DS_DEPARTMENT_CODE, DS_PLAN_ID, DS_GOAL_ID, ") .append("DS_DESC, DS_PLAN_END_DATE, ") .append("DS_CORP_OBJECTIVE, DS_CORP_OBJECTIVE_OTHER, DS_FOCUS, DS_FOCUS_OTHER, ") .append("DS_TOTAL, DS_EQUIPMENT, DS_RECRUIT, DS_FTE, ") .append("DS_CREATED_USER, DS_MODIFIED_USER, DS_GOAL_ORDER ) ") .append("VALUES ") .append("(?, ?, ?, ?, ?,") .append("?, TO_DATE(?, 'dd/MM/YY'),") .append("?, ?, ?, ?,") .append("?, ?, ?, ?,") .append("?, ?, ?)"); sqlStr_inse…
has comment: http://stackoverflow.com/comment/35334291
has comment: http://stackoverflow.com/comment/35335378
upvote count: 1
has comment: http://stackoverflow.com/comment/35333392
has comment: http://stackoverflow.com/comment/35335245
has comment: http://stackoverflow.com/comment/35333966
has comment: http://stackoverflow.com/comment/35335131
has comment: http://stackoverflow.com/comment/35335063
type: Answer
answers question: http://stackoverflow.com/q/23106911
downvote count: 0
has comment: http://stackoverflow.com/comment/35335266
accepted answer of: http://stackoverflow.com/q/23106911
score: 1

http://stackoverflow.com/comment/35300522
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23094533
has text: @buzzsawddog You're telling me that using two nested `for` loops and printing out the loop counter variables in the inner loop won't meet his requirement of `I need to use a nested for loop to get the output to look like this`? I was trying to lead the OP in the correct direction without spoonfeeding him the answer. Alexey posted the full solution below, you can run it for yourself and see that it works just fine.

http://stackoverflow.com/q/22970676
has answer: http://stackoverflow.com/a/22976873
tagged with: java
tagged with: equals-operator
has body: I saw some people wrote this Boolean equal in their code, I usually put constant at the right hand side of "==" operator. I notice 0 == a has faster operation than a == 0. Can someone explain why? And what's the best practice for it?
has answer: http://stackoverflow.com/a/22970742
type: Question
has answer: http://stackoverflow.com/a/22971354
has comment: http://stackoverflow.com/comment/35075309
has comment: http://stackoverflow.com/comment/35075447
has comment: http://stackoverflow.com/comment/35077417
has answer: http://stackoverflow.com/a/49444127
upvote count: 6
downvote count: 3
answer count: 7
has comment: http://stackoverflow.com/comment/35077223
favorite count: 0
possible better answer: http://stackoverflow.com/a/22971354
has answer: http://stackoverflow.com/a/22970721
accepted answer: http://stackoverflow.com/a/22970721
has title: Boolean equal: 0 == a, does operand order matter?
has comment: http://stackoverflow.com/comment/35075490
has answer: http://stackoverflow.com/a/22970816
has answer: http://stackoverflow.com/a/22970840
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/23028536
has answer: http://stackoverflow.com/a/43290816
favorite count: 0
has answer: http://stackoverflow.com/a/79271303
type: UnansweredQuestion
tagged with: package
has comment: http://stackoverflow.com/comment/119603869
has comment: http://stackoverflow.com/comment/119573493
score: 7
tagged with: java
upvote count: 7
has body: I am attempting to create a package for my project in IntelliJ IDEA. I am naming the package 'com.mydomain.switch' Switch being the project name, but as soon as I type 'switch' it shows an error. The only thing I can think of is that 'switch' is a Java keyword, is this the case? and if so what can I do about it?
type: Question
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/35180449
has title: Cannot create package IntelliJ IDEA
has answer: http://stackoverflow.com/a/23028607
answer count: 3
downvote count: 0

http://stackoverflow.com/a/23093851
has comment: http://stackoverflow.com/comment/35299426
has comment: http://stackoverflow.com/comment/35298988
has comment: http://stackoverflow.com/comment/35299214
has comment: http://stackoverflow.com/comment/35298906
has comment: http://stackoverflow.com/comment/35299790
has comment: http://stackoverflow.com/comment/35299088
has comment: http://stackoverflow.com/comment/35299763
has comment: http://stackoverflow.com/comment/35299097
has comment: http://stackoverflow.com/comment/35299146
has comment: http://stackoverflow.com/comment/35298866
has comment: http://stackoverflow.com/comment/35298930
answers question: http://stackoverflow.com/q/23093808
has comment: http://stackoverflow.com/comment/35299066
score: 1
has comment: http://stackoverflow.com/comment/35299016
has comment: http://stackoverflow.com/comment/35298839
type: Answer
has comment: http://stackoverflow.com/comment/35299202
has comment: http://stackoverflow.com/comment/35299540
has body: You are wrong However the above expression is also true for e.g. 123456. What do I need to change? Its false for 123456. Sample code: String s = "123456"; String regex = "\\d{5}"; if (s.matches(regex)) System.out.println("found"); else System.out.println("not found"); output not found Question has been edited. Now try with start and end in regex. String testString = "000000"; String myPattern = "^(\\d{5})$"; Pattern validCharacterPattern = Pattern.compile(myPattern); Matcher matcher = validCharacterPattern.matcher(testString); boolean b = matcher.find(); if (b) System.out.println("Valid"); else System.out.println("Invalid"); output: Invalid
upvote count: 3
downvote count: 2

http://stackoverflow.com/a/23012825
has comment: http://stackoverflow.com/comment/35151303
has comment: http://stackoverflow.com/comment/35152407
has comment: http://stackoverflow.com/comment/35152050
accepted answer of: http://stackoverflow.com/q/23012366
has comment: http://stackoverflow.com/comment/35151264
upvote count: 1
has body: Remove this line from your GridView. android:stretchMode="columnWidth" Change this android:stretchMode="none" UPDATE: set this property for your ImageView. imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setLayoutParams(new GridView.LayoutParams(70, 70)); Use: imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setLayoutParams(new GridView.LayoutParams(70, 70)); imageview.setpadding(8,8,8,8);
has comment: http://stackoverflow.com/comment/35151392
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23012366
has comment: http://stackoverflow.com/comment/35152463
has comment: http://stackoverflow.com/comment/35152320
has comment: http://stackoverflow.com/comment/35151926
type: Answer
has comment: http://stackoverflow.com/comment/35152031
has comment: http://stackoverflow.com/comment/35151615
has comment: http://stackoverflow.com/comment/35152075
score: 1
has comment: http://stackoverflow.com/comment/35151959
has comment: http://stackoverflow.com/comment/35152919

http://stackoverflow.com/comment/35124928
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22997804
has text: @Eric: I wasn't clear -- you can type in 33 because you type each number digit String one at a time, and each number digit String is validated **one at a time**. If you try to ***paste*** in "3", no problem, it gets validated fine, but if you try to ***paste*** "33" the validation fails due a bug in your validation method.

http://stackoverflow.com/a/23128906
score: 2
upvote count: 2
has body: Looks like you can call setActivationStyle on the ComboBoxCellEditor to set what happens on activation: cellEditor.setActivationStyle(ComboBoxCellEditor.DROP_DOWN_ON_KEY_ACTIVATION | ComboBoxCellEditor.DROP_DOWN_ON_MOUSE_ACTIVATION);
answers question: http://stackoverflow.com/q/23128556
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23128556
type: Answer

http://stackoverflow.com/comment/35326689
has text: Can you even do that with an efficient and not ridiculously long regex ?
score: 2
comment on: http://stackoverflow.com/q/23110334
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23040691
type: Answer
score: 0
has body: Now obj1 is an instance of class B which is superclass That is not true, obj1 is still an instance of A. You just happen to assign a pointer of the super class to an already existing pointer of class A. If you want an instance of class B just do this: B b = new B(); If you want an instance of class A you can do this: A a1 = new A(); or B a2 = new A(); The later, a2, is correct because A is of type B. However, a2 is still an instance of A, because we used new A().
answers question: http://stackoverflow.com/q/23040661

http://stackoverflow.com/comment/35263640
type: AnswerComment
comment on: http://stackoverflow.com/a/23051002
type: Comment
has text: Thank you i can't believe I was having such brain freeze. I accepted your answer because it was the clearest and most complete solution.
score: 0

http://stackoverflow.com/a/23080782
has body: Use the alternative version of String#split() that takes two arguments to achieve this: String abc = "a,b,c,d,,,"; String[] arr = abc.split(",", -1); System.out.println(arr.length); This prints 7 From the Javadoc linked above: If n is non-positive then the pattern will be applied as many times as possible and the array can have any length. If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded.
score: 9
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23080540
type: Answer
answers question: http://stackoverflow.com/q/23080540
has comment: http://stackoverflow.com/comment/35275153
upvote count: 9

http://stackoverflow.com/q/23100633
tagged with: design-patterns
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: error-handling
type: Question
score: 5
accepted answer: http://stackoverflow.com/a/23100789
has body: Keeping stacktrace out of it, lets say that the idea of 'error' is a problem that you didn't want to occur, but did. If I were to use a boolean system to check if the action successfully completed, it would look something like this: String[] array = new String[10]; int i = 0; public boolean accessValue(int id) { if(id &lt; array.length) { //do something return true; } return false; } while(true) { if(!accessValue(i++)) { //tend to situation } } If I were to use Exceptions, it would look like this: class InvalidAccessException extends Throwable { } public boolean accessValue(int id) throws InvalidAccessException { if(!id &lt; array.length || !id &gt;= 0) throw new InvalidAccessException(); //do something } while(true) { try { accessValue(i++); }catch(InvalidAccessException e) { //tend to situation } } The only thing that matters to me is that when a problem occurs, I'm notified in some way, and I will have an option to handle the situation. Which way is more practiced? Does it just depend on the situation, or are there reasons for picking one over the other?
tagged with: exception
has answer: http://stackoverflow.com/a/23100789
answer count: 1
has title: Recommended way to handle problems/errors in algorithms
favorite count: 0
upvote count: 5

http://stackoverflow.com/comment/35135537
has text: i plan to make an exactly similar keyboard as the stock windows 8 touchscreen keyboard except mine is platform independent custumizeable and semitransparent
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23004079

http://stackoverflow.com/q/23123354
tagged with: geometry
answer count: 2
downvote count: 2
tagged with: computational-geometry
upvote count: 1
linked to: http://stackoverflow.com/q/563198
has answer: http://stackoverflow.com/a/23137403
has body: Essentially I need to return a boolean if a line and a line segment intersect. For the line the information I have is the slope, xy coords for a random point, and xy for a y intercept. For the line segment I have the line segment and the two end point xy coordinates. Any ideas?
tagged with: math
tagged with: java
possible better answer: http://stackoverflow.com/a/23123541
accepted answer: http://stackoverflow.com/a/23137403
has answer: http://stackoverflow.com/a/23123541
has comment: http://stackoverflow.com/comment/35350761
type: Question
has comment: http://stackoverflow.com/comment/35376201
type: AnsweredQuestion
has title: Intersection of Line and Segment in Java
favorite count: 0
score: -1

regex
tags question: http://stackoverflow.com/q/22984782
tags question: http://stackoverflow.com/q/22997005
tags question: http://stackoverflow.com/q/23045804
tags question: http://stackoverflow.com/q/23035427
tags question: http://stackoverflow.com/q/22971519
tags question: http://stackoverflow.com/q/23091427
tags question: http://stackoverflow.com/q/23098111
tags question: http://stackoverflow.com/q/23094923
tags question: http://stackoverflow.com/q/23059509
tags question: http://stackoverflow.com/q/23031502
tags question: http://stackoverflow.com/q/22987988
tags question: http://stackoverflow.com/q/23097530
tags question: http://stackoverflow.com/q/23000258
tags question: http://stackoverflow.com/q/23104659
tag name: regex
tags question: http://stackoverflow.com/q/23089348
tags question: http://stackoverflow.com/q/23041132
tags question: http://stackoverflow.com/q/23036138
tags question: http://stackoverflow.com/q/23089090
tags question: http://stackoverflow.com/q/23013799
tags question: http://stackoverflow.com/q/23113221
tags question: http://stackoverflow.com/q/23084575
tags question: http://stackoverflow.com/q/23115132
tags question: http://stackoverflow.com/q/23028459
tags question: http://stackoverflow.com/q/23039756
tags question: http://stackoverflow.com/q/23066563
tags question: http://stackoverflow.com/q/23111808
tags question: http://stackoverflow.com/q/23122441
tags question: http://stackoverflow.com/q/22992260
tags question: http://stackoverflow.com/q/23048613
tags question: http://stackoverflow.com/q/23071246
tags question: http://stackoverflow.com/q/23098542
tags question: http://stackoverflow.com/q/23080540
tags question: http://stackoverflow.com/q/23129265
tags question: http://stackoverflow.com/q/22981716
tags question: http://stackoverflow.com/q/22993389
tags question: http://stackoverflow.com/q/23022083
tags question: http://stackoverflow.com/q/23118731
tags question: http://stackoverflow.com/q/23077692
tags question: http://stackoverflow.com/q/22997855
tags question: http://stackoverflow.com/q/23057573
tags question: http://stackoverflow.com/q/22994759
tags question: http://stackoverflow.com/q/23013617
tags question: http://stackoverflow.com/q/22971447
tags question: http://stackoverflow.com/q/23115165
tags question: http://stackoverflow.com/q/23060693
tags question: http://stackoverflow.com/q/23000150
tags question: http://stackoverflow.com/q/22981144
tags question: http://stackoverflow.com/q/23094532
tags question: http://stackoverflow.com/q/22999122
tags question: http://stackoverflow.com/q/23094452
tags question: http://stackoverflow.com/q/23069208
tags question: http://stackoverflow.com/q/23094942
tags question: http://stackoverflow.com/q/22975607
tags question: http://stackoverflow.com/q/22986634
tags question: http://stackoverflow.com/q/23119788
tags question: http://stackoverflow.com/q/23036971
tags question: http://stackoverflow.com/q/23125826
tags question: http://stackoverflow.com/q/23088559
tags question: http://stackoverflow.com/q/23093808
tags question: http://stackoverflow.com/q/23010060
tags question: http://stackoverflow.com/q/23069581
tags question: http://stackoverflow.com/q/23110334
tags question: http://stackoverflow.com/q/23017957
tags question: http://stackoverflow.com/q/23038502
tags question: http://stackoverflow.com/q/22989662
tags question: http://stackoverflow.com/q/23020090
tags question: http://stackoverflow.com/q/23035152
tags question: http://stackoverflow.com/q/23051678
tags question: http://stackoverflow.com/q/23077489
tags question: http://stackoverflow.com/q/23114875
tags question: http://stackoverflow.com/q/22987524
tags question: http://stackoverflow.com/q/23122712
tags question: http://stackoverflow.com/q/23056376
tags question: http://stackoverflow.com/q/23052884
tags question: http://stackoverflow.com/q/22971662
tags question: http://stackoverflow.com/q/23046897
tags question: http://stackoverflow.com/q/22996470
tags question: http://stackoverflow.com/q/23115514
tags question: http://stackoverflow.com/q/23059032

if-statement
tags question: http://stackoverflow.com/q/23021876
tags question: http://stackoverflow.com/q/23091373
tag name: if-statement
tags question: http://stackoverflow.com/q/23002077
type: Tag
tags question: http://stackoverflow.com/q/23095269
tags question: http://stackoverflow.com/q/23027305
tags question: http://stackoverflow.com/q/23006262
tags question: http://stackoverflow.com/q/23108121
tags question: http://stackoverflow.com/q/22977121
tags question: http://stackoverflow.com/q/23106203
tags question: http://stackoverflow.com/q/23052963
tags question: http://stackoverflow.com/q/23025735
tags question: http://stackoverflow.com/q/23007409
tags question: http://stackoverflow.com/q/23029262
tags question: http://stackoverflow.com/q/23042642
tags question: http://stackoverflow.com/q/22988604
tags question: http://stackoverflow.com/q/23050982
tags question: http://stackoverflow.com/q/23097696
tags question: http://stackoverflow.com/q/23093795
tags question: http://stackoverflow.com/q/22979939
tags question: http://stackoverflow.com/q/22970148
tags question: http://stackoverflow.com/q/23086789
tags question: http://stackoverflow.com/q/23118013
tags question: http://stackoverflow.com/q/23092361
tags question: http://stackoverflow.com/q/23005898
tags question: http://stackoverflow.com/q/22995710
tags question: http://stackoverflow.com/q/23123920
tags question: http://stackoverflow.com/q/22976998
tags question: http://stackoverflow.com/q/23057912
tags question: http://stackoverflow.com/q/23063750

http://stackoverflow.com/q/23034398
type: AnsweredQuestion
has body: Why am I getting only the last result from the mysql database it doesn't matter that whatever elements are there in the db? How can I retrieve my all database rows? Here`s the code: package database; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.simple.JSONObject; public class getData extends HttpServlet { private static final long serialVersionUID = 1L; Connection con; Statement stmt; ResultSet rs; Setzen setze = new Setzen(); int zeilen; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try{ Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ausgaben","***","***"); stmt = con.createStatement(); rs = stmt.executeQuery("SELECT * FROM ausgaben"); ResultSetMetaData meta = rs.getMetaData(); zeilen = meta.getColumnCount(); while(rs.next()) { setze.setAusgaben(rs.getString("Ausgaben")); setze.setVom(rs.getString("vom")); setze.setPreis(rs.getString("Preis")); } rs.close(); stmt.close(); con.close(); } catch(Exception e) { e.printStackTrace(); } System.out.println(setze.getAusgaben()); PrintWriter out = response.getWriter(); String data = "{\"sEcho\":" + 3 + ",\"iTotalRecords\":" + zeilen + ", \"iTotalDisplayRecords\":" + zeilen + ",\"aaData\":"+"\""+setze.getAusgaben()+"\""+","+"\""+setze.getVom()+"\""+","+"\""+setze.getPreis()+"\""+"}"; System.out.println(data); out.print(data); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } } Thankyou in advance.
tagged with: java
has answer: http://stackoverflow.com/a/23034539
type: Question
tagged with: database
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/23043704
possible better answer: http://stackoverflow.com/a/23034539
has title: while(rs.next) database result
has answer: http://stackoverflow.com/a/23043704

http://stackoverflow.com/comment/35143841
has text: thanks for reply but i don't know how and where to change encoding to "UTF-16" can u pls suggest me
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23008866
type: Comment

http://stackoverflow.com/a/23107532
answers question: http://stackoverflow.com/q/23107470
has comment: http://stackoverflow.com/comment/35322415
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/35322702
has body: You could pass the values as a parameter to any EJB method. For example in a typical create form you capture all the input from the user using the ManagedBean fields and then invoke your EJB through a service with these values. You could use java transfer object if the number of properties are large.
accepted answer of: http://stackoverflow.com/q/23107470
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35322868
downvote count: 0

http://stackoverflow.com/a/23292010
upvote count: 1
answers question: http://stackoverflow.com/q/23012785
has body: There are several possible solutions for this, which might be more or less preferrable for your deployment environment. Play gives you an "out-of-the-box" database connection, which you don't need to use. Drop the Play JDBC component from your build file (remove jdbc from your libraryDependencies) and setup your JDBC connections manually by yourself. For example, you can make a singleton TomcatConnectionPool that has a function getConnection() that gives you the JDBC connection you need for use in your Play actions. Write your own plugin specifically extending Play's DBPlugin interface so that it's a database plugin. Implement it like Play's BoneCPPlugin but make it use the Tomcat connection pool instead of BoneCP. Use someone else's already made custom Play Database Plugin, like this one that uses c3p0. I have some anecdotal evidence that c3p0 works well with Tomcat, but your mileage my vary.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23012785
type: Answer
score: 1

http://stackoverflow.com/comment/35155315
type: QuestionComment
comment on: http://stackoverflow.com/q/23014242
has text: @mangusta when i am sending the base64 string i am storing the whole string into one string variable. so when i am getting it back from server i am trying same, than why do i need to increase the heap size? just asking
score: 0
type: Comment

http://stackoverflow.com/a/23025878
answers question: http://stackoverflow.com/q/23025773
upvote count: 1
has body: Is this what you want ? for(int c = 0 ; c &lt; string.length ; c++ ) { for(int i = 1 ; i &lt;= string.length - c ; i++ ) { String sub = string.substring(c, c+i); //do something with sub } }
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/35296532
comment on: http://stackoverflow.com/a/23087417
type: AnswerComment
has text: @supercat: That's surely true, but zeroing the memory means bringing it in cache (and probably evicting more important data). Maybe doing it in blocks of a few KiB might be best. OTOH it makes sense to do it using otherwise idle cores.
score: 0
type: Comment

http://stackoverflow.com/a/23035438
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23035412
upvote count: 2
has body: Generics in java work on any type of object (e.g., Double). They are not supported for primitives (e.g., double).
type: Answer

http://stackoverflow.com/comment/35310704
has text: yes i am using java 7 C:\Users\IISU24>java -version java version "1.7.0_07" Java(TM) SE Runtime Environment (build 1.7.0_07-b11) Java HotSpot(TM) Client VM (build 23.3-b01, mixed mode, sharing)
comment on: http://stackoverflow.com/q/23100970
score: 0
type: Comment
type: QuestionComment

apache
tag name: apache
tags question: http://stackoverflow.com/q/23029657
tags question: http://stackoverflow.com/q/23108440
tags question: http://stackoverflow.com/q/23053866
tags question: http://stackoverflow.com/q/23082832
tags question: http://stackoverflow.com/q/23003617
tags question: http://stackoverflow.com/q/23008540
tags question: http://stackoverflow.com/q/22977931
tags question: http://stackoverflow.com/q/23004578
type: Tag
tags question: http://stackoverflow.com/q/23082466
tags question: http://stackoverflow.com/q/22992758
tags question: http://stackoverflow.com/q/23081944

http://stackoverflow.com/q/23070613
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35256930
has answer: http://stackoverflow.com/a/23070893
has comment: http://stackoverflow.com/comment/35257550
has comment: http://stackoverflow.com/comment/35257129
type: UnansweredQuestion
has body: Hey all so here is the problem that I'm asked to solve: Write a program that will read in a line of text and output a list of all the letters that occur in the text, along with the number of times each letter occurs. End the line with a period that serves as a sentinel value. The letters should be listed in alphabetical order when they are output. Use an array of base type int of length 26, so that each indexed variable contains the count of how many letters there are. Array indexed variable 0 contains the number of a’s, array indexed variable 1 contains the number of b’s and so forth. Allow both uppercase and lowercase letters as input, but treat uppercase and lowercase versions of the same letter as being equal. Here is my code so far import java.util.Scanner; public class Letters { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int letter[] = new int[26]; System.out.println("Enter in a list of letters"); String s = keyboard.nextLine(); String a = s.toUpperCase(); System.out.println(a); for(int i = 0; i&lt;s.length();i++){ switch (a.charAt(i)){ case 'A':letter[0]++; break; case 'B': letter[1]++; break; case 'C':letter[2]++; break; case 'D': letter[3]++; break; case 'E':letter[4]++; break; case 'F': letter[5]++; break; case 'G':letter[6]++; break; case 'H': letter[7]++; break; case 'I':letter[8]++; break; case 'J': letter[9]++; break; case 'K':letter[10]++; break; case 'L': letter[11]++; break; case 'M':letter[12]++; break; case 'N': letter[13]++; break; case 'O':letter[14]++; break; case 'P': letter[15]++; break; case 'Q':letter[16]++; break; case 'R': letter[17]++; break; case 'S':letter[18]++; break; case 'T': letter[19]++; break; case 'U':letter[20]++; break; case 'V': letter[21]++; break; case 'W':letter[22]++; break; case 'X': letter[23]++; break; case 'Y':letter[24]++; break; case 'Z': letter[25]++; break; } } } } Clearly, I'm not done. So I'm solving this problem one step at a time and the problem I'm having at the momen…
has comment: http://stackoverflow.com/comment/35256904
has title: Short cut in arrays?
has comment: http://stackoverflow.com/comment/35257517
tagged with: java
has comment: http://stackoverflow.com/comment/35257187
has answer: http://stackoverflow.com/a/23070837
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/23070656
has comment: http://stackoverflow.com/comment/35257553
has comment: http://stackoverflow.com/comment/35257498
linked to: http://stackoverflow.com/q/7443975

http://stackoverflow.com/comment/35137172
type: AnswerComment
score: 0
type: Comment
has text: same reason. If you ran java.exe or another .exe is should work
comment on: http://stackoverflow.com/a/23004898

http://stackoverflow.com/q/23112874
type: Question
upvote count: 102
has answer: http://stackoverflow.com/a/43056094
has comment: http://stackoverflow.com/comment/35331774
has comment: http://stackoverflow.com/comment/69964004
has answer: http://stackoverflow.com/a/60323950
downvote count: 0
has answer: http://stackoverflow.com/a/65584791
has title: Merge lists with stream API
favorite count: 0
score: 102
possible better answer: http://stackoverflow.com/a/43056094
has answer: http://stackoverflow.com/a/66857675
answer count: 5
has comment: http://stackoverflow.com/comment/35332201
tagged with: java-8
accepted answer: http://stackoverflow.com/a/23113085
type: AnsweredQuestion
tagged with: list
tagged with: java-stream
tagged with: java
has body: I have the following situation Map&lt;Key, ListContainer&gt; map; public class ListContainer { List&lt;AClass&gt; lst; } I have to merge all the lists lst from the ListContainer objects from a Map map. public static void main(String[] args) { List&lt;AClass&gt; alltheObjectsAClass = map.values().stream(). // continue.... } Any idea how, using Java 8 stream API?
has answer: http://stackoverflow.com/a/23113085

http://stackoverflow.com/a/23041852
has body: When you click on the submit button, it POSTs, not GETs. You servlet method is doGet(). Try putting something into the doPost().
answers question: http://stackoverflow.com/q/23041750
score: 0
has comment: http://stackoverflow.com/comment/35203871
type: Answer

http://stackoverflow.com/q/23016763
score: 0
accepted answer: http://stackoverflow.com/a/23017387
answer count: 1
tagged with: java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23017387
type: Question
has body: I'm developing a vehicle storage application. One feature is being able to store documents in different formats (word, excel, pdf) on a remote server WITHOUT having to map the server as separate drive. Everything works fine if the file to be opened is on the local hard drive (ie, "C:/Documents/FileToOpen.docx"), but I can't figure out the path structure for a path (ie, "C:/Documents/FileToOpen.docx" on server "SERVER06"). I've tried "//SERVER06/C/Documents/FileToOpen.docx" and permutations thereof, but no joy so far. public class Attachments extends javax.swing.JFrame { String docPath = "C:/Program Files/Microsoft Office/Office14/WINWORD.EXE"; String excelPath = "C:/Program Files/Microsoft Office/Office14/EXCEL.EXE"; String pdfPath = "C:/Program Files/Adobe/Reader 11.0/Reader/AcroRd32.exe"; /** * Creates new form Attachments */ public Attachments() { initComponents(); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); this.setResizable(false); } public void setList(Set attachmentList) { DefaultListModel model = new DefaultListModel(); Iterator i = attachmentList.iterator(); int counter = 0; while (i.hasNext()) { model.add(counter, (Attachment) i.next()); counter++; } listAttachments.setModel(model); } //form generation private void btnViewActionPerformed(java.awt.event.ActionEvent evt) { Attachment a = (Attachment) listAttachments.getSelectedValue(); String type = a.getAttachmentUrl().substring(a.getAttachmentUrl().indexOf(".")); String prog = ""; if (type.substring(0, 2).equals(".d")) { prog = docPath; } else if (type.substring(0, 2).equals(".p")) { prog = pdfPath; } else if (type.substring(0, 2).equals(".x")) { prog = excelPath; } String commandString = "\"" + prog + "\" \"" + a.getAttachmentUrl() + "\""; Runtime rt = Runtime.getRuntime(); try { rt.exec(commandString); } catch (IOException ex) { System.out.println(ex.getMessage()); ex.printStackTrace(); } } private void jButtonCloseActionPerformed(java.awt.event.ActionEvent evt) { this.setVisible(false…
has title: Open a file on remote server [path issue]
tagged with: ms-word
tagged with: command-line

http://stackoverflow.com/q/22982739
tagged with: java
has title: Disble the Maximize button in JFrame
type: Question
linked to: http://stackoverflow.com/q/5625436
has answer: http://stackoverflow.com/a/22982857
has comment: http://stackoverflow.com/comment/75829761
score: 0
has comment: http://stackoverflow.com/comment/35098619
has answer: http://stackoverflow.com/a/22983084
has answer: http://stackoverflow.com/a/22982819
tagged with: jframe
has answer: http://stackoverflow.com/a/22982866
type: UnansweredQuestion
tagged with: swing
has body: My JFrame opens in a minimized Mode but it can be maximized. I want to disable the maximize icon so that user cannot maximize the frame and can see it only in the minimized or default mode. Is it possible?
answer count: 4
has comment: http://stackoverflow.com/comment/35096544

http://stackoverflow.com/a/23055485
accepted answer of: http://stackoverflow.com/q/23055332
has comment: http://stackoverflow.com/comment/35229787
score: 0
has comment: http://stackoverflow.com/comment/35229907
type: AcceptedAnswer
has body: You have this sdf1.parse(pref.getString(START_TIME, "")); If the default value is returned its a empty string. So its natural you get java.text.ParseException: Unparseable date:"". You are parsing empty string public abstract String getString (String key, String defValue) Added in API level 1 Retrieve a String value from the preferences. Returns the preference value if it exists, or defValue
has comment: http://stackoverflow.com/comment/35229992
has comment: http://stackoverflow.com/comment/35229315
has comment: http://stackoverflow.com/comment/35230040
has comment: http://stackoverflow.com/comment/35229103
type: Answer
has comment: http://stackoverflow.com/comment/35229338
has comment: http://stackoverflow.com/comment/35229851
has comment: http://stackoverflow.com/comment/35229528
answers question: http://stackoverflow.com/q/23055332

http://stackoverflow.com/q/23055332
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/23055485
answer count: 1
has title: android unparseble date Exception?
tagged with: date
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23055485
type: Question
has body: I am making an application in which i am using date functionality,but looking after several existing posts, I am still not able to get my SimpleDateFormat parser working. Here is the code: public class GPSDemo extends Activity { public static String TAG = "Abhi's Log"; public static String IMEII = "imei"; public static String START_TIME = "startTime"; public static String WORKING_STATUS = "workingStatus"; public static String ADDRESS = "address"; public static int level = 0; Button stop, hide; SharedPreferences pref; Editor edit; Date d1 = null; Date d2 = null; String startingTime; String currentTime; Context ctx = this; TextView txt_start_time, txt_total_time, txt_total_distance, txt_address; @SuppressLint("NewApi") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.demoooo); pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); edit = pref.edit(); ConnectivityManager connectivityManager = (ConnectivityManager)getSystemService(getBaseContext().CONNECTIVITY_SERVICE); this.registerReceiver(this.batteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); txt_start_time = (TextView) findViewById(R.id.txt_start_time); txt_total_time = (TextView) findViewById(R.id.txt_total_time); txt_total_distance = (TextView) findViewById(R.id.txt_total_distance); txt_address = (TextView) findViewById(R.id.txt_address); try { TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); Editor edit = PreferenceManager .getDefaultSharedPreferences( getApplicationContext()).edit(); edit.putString(IMEII, mTelephonyMgr.getDeviceId()); edit.commit(); Log.i(TAG, "IMEI Stored Sucessfully : " + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString(IMEII, "")); } catch (Exception e) { Log.d(TAG, "Exception While Storin Data : " + e); } // turnGPSOn(this); // turnGPSOn(); if(!isInternetOn()) { try { Method method = connectivityMan…
tagged with: android

http://stackoverflow.com/comment/35079213
has text: Did you try to replace new `TypeToken<Collection<User>>` with `new TypeToken<List<User>>`?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22970618
type: Comment

http://stackoverflow.com/q/23027888
score: 0
has comment: http://stackoverflow.com/comment/35179425
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23027920
answer count: 2
has answer: http://stackoverflow.com/a/23027933
tagged with: db2
has body: Java DB2 Sql command throws an error if i have a ' in my String i tried to replace it with a escape sequence but it would not work on the DB2 end any help ? I want the ' to be present in the String. Error com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-10, SQLSTATE=42603, SQLERRMC=', DRIVER=3.63.123 Java String FUNC_VP = "Chris O'Connor/Henry/George"; String myQuery = "SELECT DISTINCT(VICE_PRES) FROM EMP_HC WHERE FUNC_VP ='"+funcvp_name.replace("'", "/'")+"'";
possible better answer: http://stackoverflow.com/a/23027933
has title: Java select query throws an error on DB2 database?
has answer: http://stackoverflow.com/a/23027920

http://stackoverflow.com/a/23052212
has body: Your major problem is a small detail in public boolean equals(Node node) { return (this.x == node.getX() &amp;&amp; this.y == node.getY() &amp;&amp; this.parent.equals(node.getParent())); } in conjunction with if(!openset.contains(n)) { n.setParent(current); openset.add(n); } It's hard to spot and it took me a while to figure it out. ArrayList&lt;&gt;().contains(Object o) internally uses (with the help of indexOf) the method Object().equals(Object o), which takes an Object as a parameter. Your Node().equals(Node n) method uses a Node parameter, thus not overwriting the Object().equals(Object o) method you want to overwrite. To solve this you should change your method to: public boolean equals(Object o) { if(!(o instanceof Node)) return false; return (this.x == node.getX() &amp;&amp; this.y == node.getY() &amp;&amp; this.parent.equals(node.getParent())); } I don't know if there are more problems with your code since I have not a real clue about how you call it and how your Path class looks like and so on. I tried it from (0, 0) to (3, 2) and at least it terminated and the sizes seemed to be smaller after the fix. Some NullPointerExceptions occured when I was calling Node().getParent() though, maybe you should have a look at that. For example in your equals(Object o) this.parent might be null, you should check it beforehand. Good luck!
answers question: http://stackoverflow.com/q/23050009
has comment: http://stackoverflow.com/comment/35390404
has comment: http://stackoverflow.com/comment/35390472
score: 0
type: Answer

http://stackoverflow.com/comment/35181213
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23029048
type: AnswerComment
has text: I like your completeness. Given that, you have missed static initialization block.

double
tags question: http://stackoverflow.com/q/23008862
tags question: http://stackoverflow.com/q/23026392
tag name: double
type: Tag
tags question: http://stackoverflow.com/q/23042246
tags question: http://stackoverflow.com/q/23043631
tags question: http://stackoverflow.com/q/23038875
tags question: http://stackoverflow.com/q/23031587
tags question: http://stackoverflow.com/q/22970240
tags question: http://stackoverflow.com/q/23050018
tags question: http://stackoverflow.com/q/23124637
tags question: http://stackoverflow.com/q/22988792
tags question: http://stackoverflow.com/q/22992589

http://stackoverflow.com/q/23123134
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35350454
type: Question
has answer: http://stackoverflow.com/a/23123207
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/23123207
has comment: http://stackoverflow.com/comment/35350479
answer count: 1
has title: I need to make this code work, but cannot figure out what is wrong. It is a System.out.format() issue
has body: I cannot seem to get this code to format. I keep getting this error: Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method format(String, Object[]) in the type PrintStream is not applicable for the arguments (String, int, double) at org.lineware.learningjava.Root2.main(Root2.java:9) Here is the code: public class Root2 { public static void main(String[] args) { int i = 2; double r = Math.sqrt(i); System.out.format("The square root of %d is %f.%n", i, r); } }
has comment: http://stackoverflow.com/comment/35350431
tagged with: system.out

http://stackoverflow.com/q/23117797
tagged with: jsp
favorite count: 0
possible better answer: http://stackoverflow.com/a/23117955
has answer: http://stackoverflow.com/a/23250975
accepted answer: http://stackoverflow.com/a/23250975
tagged with: maven
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23243665
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35344847
has comment: http://stackoverflow.com/comment/35565133
type: Question
has answer: http://stackoverflow.com/a/23117955
has body: I am trying to run a springMVC application but its showing blank page to me. In my controller class I have @Controller public class LoginController extends CommonController { @RequestMapping("/login") public ModelAndView login(HttpSession session, HttpServletResponse response, HttpServletRequest request, Model model) { logger.info("something"); // printing something in logs return new ModelAndView("login");//But failing here not loading login.jsp } } Its coming inside login method as if I print something before return its printing but failing at return statement and i am not getting any exception Inside my spring-servlet.xml. I have <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> <context:annotation-config /> <context:component-scan base-package="com.jemmmedia.organise" /> <mvc:annotation-driven /> -------- ------- <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" /> </beans> and my login.jsp is at /core/src/main/webapp/WEB-INF/jsp/login.jsp and inside pom.xml I have <spring.version>3.0.7.RELEASE</spring.version> org.springframework.security spring-security-web 3.1.1.RELEASE org.springframework.security spring-security-config 3.1.1.RELEASE org.springframework spring-context ${spring.version} org.springframework spring-web ${spring.version} o…
answer count: 3
has comment: http://stackoverflow.com/comment/35345144
upvote count: 1
has title: new ModelAndView not working

http://stackoverflow.com/a/23111154
has body: In that SDK, it has a Service. I am going to interpret this as meaning "in that SDK, it has a Java class that extends Service, and I am expecting that this Service will be registered in the app's manifest, whether manually or automatically (e.g., via manifest merging of an AAR)". Let's say appA and appB integrates with my SDK, if appA and appB starts the Service, is there going to be 2 Services running or just one? There will be zero, one, or two instances of the service. Zero would be if both developers screwed up and failed to add the service to their manifests, in which case it will never run. Two would be if both developers added the service to their manifests and are starting that service via an explicit Intent. There are various scenarios in which only one service will run (e.g., one developer screws up and doesn't add the service to the manifest, while the other one does and uses an explicit Intent). Is there a way to make sure only one Service can be ran? Not easily. For starters, unless you are the developer of both appA and appB, those developers can do what they want, and they may not want other apps talking to their copy of your service (e.g., security reasons). You also have to deal with the case where appA is installed but not appB, or appB is installed and not appA. And you have to deal with the case where first appA and appB are both installed, and they elect to use appA's service, then the user uninstalls appA, -- now appB will not longer have access to the data that service managed on appA's portion of internal storage. Or is it not a good idea to distribute the service in the SDK? There is nothing intrinsically wrong with distributing a service in a JAR or AAR. Trying to force multiple apps to use the same service instance, from just one of those apps, is tricky at best and risky at worst, so I would try to avoid that requirement.
has comment: http://stackoverflow.com/comment/35328998
accepted answer of: http://stackoverflow.com/q/23110815
downvote count: 0
type: AcceptedAnswer
upvote count: 2
answers question: http://stackoverflow.com/q/23110815
type: Answer
has comment: http://stackoverflow.com/comment/35328624
score: 2

http://stackoverflow.com/comment/35361943
score: 0
comment on: http://stackoverflow.com/a/23129492
type: AnswerComment
type: Comment
has text: @Joffrey True, I didn't get that part of the question. Your answer is better then, upvoting.

http://stackoverflow.com/comment/35245443
score: 0
comment on: http://stackoverflow.com/q/23060366
type: Comment
type: QuestionComment
has text: A bit confused then, here: "I want to retrieve this kind of map for all terms in one query." What query? Do you want to enumerate terms for a query, or do you want to enumerate all terms across the entire index?

http://stackoverflow.com/a/22985475
score: 0
type: Answer
has body: When you do this: public class SpinnerActivity extends Activity implements OnItemSelectedListener You dont really have to write spin.setAdapter(aa); Just override the following methods in your class public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos, long id) { // An item was selected. You can retrieve the selected item using // parent.getItemAtPosition(pos) } public void onNothingSelected(AdapterView&lt;?&gt; parent) { // Another interface callback }
answers question: http://stackoverflow.com/q/22985298

http://stackoverflow.com/q/23119603
has body: I'm trying to send a large java buffer byte[] (e.g. 460800) to C++ function using JNI. Below is the sample code: JNIExport void JNICALL XXXXXX_onRecvData(JNIEnv *env, jclass class, jbyteArray data) { jbyte *pData = NULL; pData = env-&gt;GetByteArrayElements(data, NULL); // call some function here Method((UINT8 *) pData, (UINT16)(env-&gt;GetArrayLength(data)); env-&gt;ReleaseByteArrayElements(data, pData, 0); } Where Method(uint8_t* buf, uint32_t buf_size) { // print buf_size } When I print buf_size, I get some small value e.g.2048. It means I'm not receiving full buffer in JNI function. Is there any restriction on the size of buffer that I can send using JNI? Any idea why it might be happening?
answer count: 1
tagged with: android
has answer: http://stackoverflow.com/a/23119653
accepted answer: http://stackoverflow.com/a/23119653
tagged with: c++
type: AnsweredQuestion
tagged with: java
type: Question
has title: JNI - Send a large byte[] buffer to C++
tagged with: java-native-interface
tagged with: jnienv
score: 0

http://stackoverflow.com/q/23060792
has answer: http://stackoverflow.com/a/23060897
downvote count: 2
has body: I have some TextView and each have an OnClickListener. I would like get information in this method to TextView TextView tv2 = new TextView(this,(String)book.get(i),this); tv2.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(Contact.this,Discution.class); //String str = this.getText(); //like this startActivity(intent); } }); How can I do : this.getText(); in an OnClickListener ?
has comment: http://stackoverflow.com/comment/35238728
tagged with: android
tagged with: textview
has title: Android, How can I get text from TextView in OnClick
favorite count: 0
has comment: http://stackoverflow.com/comment/35239334
answer count: 5
has answer: http://stackoverflow.com/a/23060849
score: 6
possible better answer: http://stackoverflow.com/a/23060885
has answer: http://stackoverflow.com/a/23060885
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35238965
tagged with: onclick
has answer: http://stackoverflow.com/a/23060848
tagged with: java
accepted answer: http://stackoverflow.com/a/23060848
upvote count: 8
type: Question
has comment: http://stackoverflow.com/comment/35239041
has answer: http://stackoverflow.com/a/62946270

http://stackoverflow.com/comment/35384713
type: AnswerComment
comment on: http://stackoverflow.com/a/23114599
has text: I had some more problems til the complete job, but jsoup really solved this one. BTW, I choose Flying-Saucer. Thx.
score: 0
type: Comment

http://stackoverflow.com/a/23091261
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35331322
has body: This code snippet should fix your problem; NumberPicker np = (NumberPicker) findViewById(R.id.numberPicker1); String[] numbers = new String[200/5]; for (int i=0; i&lt;numbers.length; i++) numbers[i] = Integer.toString(i*5+5); np.setDisplayedValues(numbers); np.setMaxValue(numbers.length-1); np.setMinValue(0); np.setWrapSelectorWheel(false); np.setOnValueChangedListener(new OnValueChangeListener() { @Override public void onValueChange(NumberPicker picker, int oldVal, int newVal) { int newValue = newVal * 5 + 5; } });
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/35330613
has comment: http://stackoverflow.com/comment/35416991
has comment: http://stackoverflow.com/comment/35334935
upvote count: 5
has comment: http://stackoverflow.com/comment/35330466
accepted answer of: http://stackoverflow.com/q/23089868
has comment: http://stackoverflow.com/comment/35331074
answers question: http://stackoverflow.com/q/23089868
has comment: http://stackoverflow.com/comment/35416080

http://stackoverflow.com/a/23076271
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/35267474
has body: yes you need some locking over here. because I can see is both different function is called by different threads and you are using myObj in getSomething() method. Now assume when your child thread is executing getSomething() and at the same time your main thread have change myObj then your program will be victim of the race condition and you may not get the desired output. but though it depends on the overall program you write. hope this helps
answers question: http://stackoverflow.com/q/23076177
downvote count: 1
has comment: http://stackoverflow.com/comment/35267350
score: 0
has comment: http://stackoverflow.com/comment/35267264

http://stackoverflow.com/q/22989091
tagged with: sockets
has answer: http://stackoverflow.com/a/22989645
tagged with: java
answer count: 3
type: UnansweredQuestion
tagged with: websocket
type: Question
has answer: http://stackoverflow.com/a/23004376
has body: This is my code function sendMessage() { if(textMessage.value!=="close") { if(searchid==="John" &amp;&amp; login_id==="Mary" || searchid==="Mary" &amp;&amp; login_id==="John") { webSocket.send(textMessage.value); textMessage.value=""; } } else { webSocket.close(); } } I am making a chat application and getting response from server.Firstly the server was sending response to all the clients connected to it.But now I am converting it into one to one client based chat but the problem is if john is chatting with mary these values are placed in database and I can only one time get the data from database via scriplet when page is loaded so how to implement it when user want to chat with say dave.Then I can't get the values from database.
has title: How to cancel response from server?
has answer: http://stackoverflow.com/a/22989525
score: 0

http://stackoverflow.com/comment/35205387
type: Comment
score: 1
has text: And how does that prevent you from using your debugger?
type: QuestionComment
comment on: http://stackoverflow.com/q/23042655

http://stackoverflow.com/a/23128456
answers question: http://stackoverflow.com/q/23128219
type: Answer
has comment: http://stackoverflow.com/comment/35362076
score: 0
has body: version with BufferedReader as wrote above String line=""; BufferedReader r = new BufferedReader(new FileReader(file)); while((line = r.readline) != null){ List&lt;String&gt; columns = Arrays.asList(line.split(" ")); }

http://stackoverflow.com/a/23030435
type: Answer
accepted answer of: http://stackoverflow.com/q/23029328
downvote count: 0
has comment: http://stackoverflow.com/comment/35183891
score: 1
has body: If I understand correctly what you are trying to do, a good solution would be the following: @Component public class MainBean { @Autowired private MyTaskFactory myTaskFactory @Autowired private TaskScheduler taskScheduler public void start() { String str = "Print something to console"; taskScheduler.execute(myTaskFactory.getTask(str)); } } public class MyTaskFactory { public MyTask getTask(String str) { return new MyTask(str); } } @Configuration public class MyTaskFactoryConfig { @Bean public MyTaskFactory myTaskFactory() { return new MyTaskFactory(); } } Note that MyTask will then be changed to: public class MyTask implements Runnable { private String str; public MyTask(String str) { this.str = str; } @Override public void run() { System.out.println(str); } }
has comment: http://stackoverflow.com/comment/35184146
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23029328

http://stackoverflow.com/comment/35331740
has text: You are trying to you an smtp server on localhost. Do you really have SMTP server locally?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23081392
type: QuestionComment

http://stackoverflow.com/comment/97572726
type: Comment
comment on: http://stackoverflow.com/a/35318079
type: AnswerComment
has text: I am also getting same compile error at return sendMessage(message, ctx.newPromise()); line
score: 0

http://stackoverflow.com/comment/35300137
type: QuestionComment
comment on: http://stackoverflow.com/q/23069291
score: 0
has text: BFS has to keep the whole trackback in memory, try to use DFS
type: Comment

http://stackoverflow.com/q/23111928
type: Question
has body: I'm getting the exception: Exception in thread "main" org.apache.jasper.JasperException: File "/struts-tags" not found at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116) at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:160) at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:386) at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:449) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1396) at org.apache.jasper.compiler.Parser.parse(Parser.java:130) at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255) at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:185) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:347) at org.apache.jasper.JspC.processFile(JspC.java:1192) at org.apache.jasper.JspC.execute(JspC.java:1341) at com.google.appengine.tools.development.LocalJspC.main(LocalJspC.java:35) Error while executing: C:\Program Files\Java\jdk1.7.0_51\bin\javaw.exe -classpath /C:/Users/... here is my login.jsp file: <%@ page language="java" contentType="text/html; charset=windows-1255" pageEncoding="windows-1255"%> <%@ taglib prefix="s" uri="/struts-tags" %> login <s:form action="/login"> <s:textfield label="email address" key="emailAddress" /> <s:password label="password" key="password" /> <s:submit /> </s:form> I've downloaded the struts2gwtplugin-1.02.jar How it's possible to use struts 2 and GWT?
has comment: http://stackoverflow.com/comment/35333000
tagged with: jsp
tagged with: struts2
score: 0
has title: GWT and struts2 exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35331271
has comment: http://stackoverflow.com/comment/35329673
tagged with: gwt
answer count: 0
tagged with: java

jdbc-odbc
tags question: http://stackoverflow.com/q/22984438
tag name: jdbc-odbc
tags question: http://stackoverflow.com/q/23014853
tags question: http://stackoverflow.com/q/22986667
tags question: http://stackoverflow.com/q/23030792
type: Tag

http://stackoverflow.com/comment/35095229
type: AnswerComment
comment on: http://stackoverflow.com/a/22981829
score: 0
type: Comment
has text: @DanP. I think I messed up the inner for loop, I had to check against `token` not `' '`. Fixed that. But there are other bugs.. I'll redo that one -.-

http://stackoverflow.com/comment/35268555
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23077064
has text: Do you have a main method in your PR class?

http://stackoverflow.com/comment/35426913
comment on: http://stackoverflow.com/q/23096654
type: Comment
score: 2
type: QuestionComment
has text: I don't see Command pattern as applicable here, but I could be misunderstanding. Ask your teammate how he'd use Command pattern and let us know so we can comment on that!

http://stackoverflow.com/q/23036265
has comment: http://stackoverflow.com/comment/35194269
has comment: http://stackoverflow.com/comment/35194688
score: 0
answer count: 1
has title: Getting rid of ugly casts
favorite count: 0
has comment: http://stackoverflow.com/comment/35194823
has body: Add.java public class Add implements Value, Reducible{ Value left; Value right; public Add(Value left, Value right){ this.left = left; this.right = right; } @Override public String toString(){ return (left + " + " + right); } @Override public Value reduce(Machine environment) { Value val = new Add(left, right); if(left instanceof Reducible){ ((Add)val).left = ((Reducible) ((Add)val).left).reduce(environment); } else if(right instanceof Reducible){ ((Add)val).right = ((Reducible) ((Add)val).right).reduce(environment); }else{ val = new VNumber(((VNumber)((Add)val).left).getValue() + ((VNumber)((Add)val).right).getValue()); } return val; } } Value.java public interface Value { public abstract String toString(); } Reducible.java public interface Reducible { public abstract Value reduce(Machine environment); } Add.reduce is really ugly. It's perfect code that follows regulations, but it's almost unreadable. Is there a way to get rid of those ugly casts?
has comment: http://stackoverflow.com/comment/35194439
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23036854
tagged with: java
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/23036854
type: Question
tagged with: casting

http://stackoverflow.com/comment/35256038
type: QuestionComment
comment on: http://stackoverflow.com/q/23034024
has text: Even if the list "addresses" has been initiated, exception NullPointerExcetpion is throw when iterate list.
score: 0
type: Comment

http://stackoverflow.com/comment/35140389
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23006647
has text: No, they said "we're NOT going to have pointers". Then they misnamed one exception class.
score: 0

http://stackoverflow.com/comment/35241718
has text: possible duplicate of [Job fails with "Input resource must exist (reader is in 'strict' mode): class path resource \[data/job1-2014-01-02/data.txt\]"](http://stackoverflow.com/questions/23058880/job-fails-with-input-resource-must-exist-reader-is-in-strict-mode-class-pa)
type: QuestionComment
comment on: http://stackoverflow.com/q/23062293
type: Comment
score: 0

http://stackoverflow.com/a/23138009
accepted answer of: http://stackoverflow.com/q/23109768
score: 0
has body: here mistake was POST method, we should not use post method instead we should always use GET method while writing program for download. @RequestMapping(value = "download", method=RequestMethod.GET) public @ResponseBody void download(HttpServletRequest request, HttpServletResponse response){ String fileName="/home/test/Testing.xlsx"; PrintWriter out=null; try{ System.out.println(fileName.substring(fileName.lastIndexOf('/')+1)+"fileName"); response.setContentType("application/vnd.ms-excel"); response.setHeader("Cache-Control", "must-revalidate"); response.setHeader( "Pragma", "public" ); response.setHeader("Content-Disposition", "attachment; filename=" + fileName.substring(fileName.lastIndexOf('/')+1) ); out = response.getWriter(); int i; FileInputStream inputStream = new FileInputStream(fileName); while ((i = inputStream.read()) != -1) { out.write(i); } inputStream.close(); out.close(); } catch(Exception e){ System.out.println(e); } }
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23109768

http://stackoverflow.com/a/23086860
downvote count: 0
has body: Remove this eu.doInBackground(myUri); You already have eu.execute(myUri); When you call execute AsyncTask in invoked and doInbackground does background computation
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23086805

http://stackoverflow.com/a/23096221
has comment: http://stackoverflow.com/comment/62777180
has comment: http://stackoverflow.com/comment/35306972
type: Answer
upvote count: 17
has body: A quick glance at the documentation suggests that what you're trying to do with that signature is not possible: ...if a null value needs to be passed, the Class object for the parameter type must be passed instead If that's the case, then pass in the Class object as well as the instance. Deencapsulation.invoke(tap, "parseResponse", String.class);
accepted answer of: http://stackoverflow.com/q/23096026
answers question: http://stackoverflow.com/q/23096026
downvote count: 0
has comment: http://stackoverflow.com/comment/53410065
score: 17
has comment: http://stackoverflow.com/comment/53410534
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35336617

http://stackoverflow.com/comment/35303916
has text: Hi salk31, the short answer is - because this is how I was advised to do it in a reply to another question. Can you please provide a sample of an alternative way of doing this please. I have been thinking about this and reading up on it. My guess is that once I have created the page once then I need to set a flag so I do not create the widgets on it again. Each time I enter I just need to empty (clear) the data. I will try this. Thanks for your help. Regards, Glyn.
comment on: http://stackoverflow.com/q/23026969
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/52546328
type: Comment
has text: Why did you use as a starting point this "new Point(j,i)"?So you calling FloodFill for each Pixel again
comment on: http://stackoverflow.com/q/23107123
score: 0
type: QuestionComment

http://stackoverflow.com/q/23045859
accepted answer: http://stackoverflow.com/a/23045953
has title: Generating two lists in a single iteration of a large XML document
tagged with: http://stackoverflow.com/tag/xml
tagged with: return
type: AnsweredQuestion
tagged with: list
tagged with: java
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/23045953
score: 0
has body: Given a list of IDs, I need to iterate over a large OSM (Open Street Map) file (example), and collect two separate types of info for the corresponding nodes: coordinates, and user names (not important for them to be associated once I extract it - i.e. I don't need to know which user corresponds to which coordinates) That is, I need to check each node in the file to see if they match one of the ID's in the list I'm given, and if they do, I want to keep the coordinates (latitude and longitude) and the user info (the person who contributed the node) and return the data. In Java, I can't return two separate lists in a single method. In a world of no constraints, I would iterate over the document twice - the first time to get coordinates data, and the second time to get the user data. However, this is not practical in this case because the OSM files I'm dealing with can be huge - often in the gigabytes! So my question is, what's the best way to iterate ONCE but generate multiple lists of data you want to extract?
answer count: 1

http://stackoverflow.com/q/23041964
has comment: http://stackoverflow.com/comment/35204957
has body: I'm using JPA 2.1 sample application with Hibernate 4.3.x implementation. <?xml version="1.0" encoding="UTF-8"?> org.hibernate.jpa.HibernatePersistenceProvider net.roseindia.model.Product <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/common"/> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/> <property name="hibernate.connection.username" value="root"/> <property name="hibernate.connection.password" value="root"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> In pom.xml I have the following dependency. org.hibernate hibernate-entitymanager 4.3.5.Final The sample command line application works normally (t is very simple) but I get the following warning message when I start it. Apr 13, 2014 1:12:43 PM org.hibernate.ejb.HibernatePersistence logDeprecation WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead. So, Is it the problem my wrong configuration (and can I avoid it?), or it is an issue in Hibernate implementation? UPDATED Here is the code which I use: import net.roseindia.model.Product; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; public class AppTest { private static final String PERSISTENCE_UNIT_NAME = "unit1"; private static EntityManagerFactory factory; public class AppTest { private static final String PERSISTENCE_UNIT_NAME = "unit1"; private static EntityManagerFactory factory; public static void main(String[] args) { factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME); EntityManager em = factory.createEntityManager(); em.getTransaction().begin(); Product product = new Product(); product.setProductName("JPA 2.1 Book"); product.s…
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/29986399
has answer: http://stackoverflow.com/a/27301641
has title: JPA 2.1/Hibernate 4.3 deprecation warning
has comment: http://stackoverflow.com/comment/35204810
has answer: http://stackoverflow.com/a/23898684
type: Question
linked to: http://stackoverflow.com/q/737496
has comment: http://stackoverflow.com/comment/35205061
score: 7
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35206075
answer count: 3
tagged with: jpa-2.1
has comment: http://stackoverflow.com/comment/35206223
upvote count: 7
tagged with: jpa
favorite count: 0
has comment: http://stackoverflow.com/comment/35204646

http://stackoverflow.com/comment/35366071
has text: Have added the ant target above
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23128048
score: 0

http://stackoverflow.com/comment/104025042
score: 0
type: Comment
has text: Seems like a good answer but I am not seeing how `ctx.writeAndFlush(message).addListener();` actually does anything (perhaps the API changed since this was written but there is no empty addListener() method and this branch does nothing to the promise. :-(
comment on: http://stackoverflow.com/a/35318079
type: AnswerComment

http://stackoverflow.com/q/23048956
type: Question
has title: Java OpenCL FFT for batch processing
tagged with: java-native-interface
tagged with: java
has answer: http://stackoverflow.com/a/23071746
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/1556421
tagged with: jna
tagged with: opencl
has body: I'm working on an Open Source Java imaging system. Most of the heavy lifting and number crunching is done by OpenCL via JavaCL. However, I need to do batch FFTs which doesn't seem to fit the built in JavaCL FFT algorithm. Can anyone offer advice on: OpenCL FFT library for Java Advice on whether JNA or JNI would be better choice to implement a C++ OpenCL FFT library (most likely clAmdFFT).
type: UnansweredQuestion

http://stackoverflow.com/a/22973460
accepted answer of: http://stackoverflow.com/q/22972947
type: AcceptedAnswer
has body: The persistence.xml file needs to go into the War's WEB-INF/classes/META-INF/ directory. The best way to accomplish this is to put it into src/main/resources/META-INF/. If you also want this to work in tests (which run off class directories rather than a Jar or War), you additionally need to configure: sourceSets.all { output.resourcesDir = output.classesDir } Above configuration is required because JPA expects to find the persistence.xml file and the corresponding entity classes in the same class directory or archive, but Gradle defaults to using different output directories for classes and resources. PS: I assume the main directory is under src, not a sibling of src as shown in your first diagram.
has comment: http://stackoverflow.com/comment/89679199
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/35081169
score: 4
answers question: http://stackoverflow.com/q/22972947

http://stackoverflow.com/q/22995385
type: Question
has title: How to establish dependency on 2 maven project on Eclipse?
tagged with: java
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/35119999
has body: I have 2 projects, project A has the dao and pojo classes (to be used on several projects) and project B has the business rules, controllers and JSPs. I'm migrating them to a maven structure now. How do I establish on project B that it depends on A? Before maven this dependency was defined on P at Properties > Deployment Assembly. How can I solve this? Thanks in advance,
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35121485
has comment: http://stackoverflow.com/comment/35119768
has comment: http://stackoverflow.com/comment/35120300
answer count: 0
tagged with: maven

http://stackoverflow.com/comment/96054352
type: Comment
score: 8
has text: Just to point out - if you're using kotlin, you need to put your reference in quotes & escape the `$` eg `root: "\${LOGGING_LEVEL_ROOT:info}"`
type: AnswerComment
comment on: http://stackoverflow.com/a/23027709

http://stackoverflow.com/comment/35314633
has text: would be overkill , need a very simple thing
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23103315

http://stackoverflow.com/a/23126941
has body: To get the array: byte[] bytes = new byte[byteArray.length()]; byteArray.readBytes(bytes);
has comment: http://stackoverflow.com/comment/35357335
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23126842
accepted answer of: http://stackoverflow.com/q/23126842
upvote count: 2

http://stackoverflow.com/q/23031528
has title: RoboGuice provision errors
tagged with: roboguice
has body: I am using RoboGuice Providers to injecting custom dependencies. I have two providers the first provides a Facebook AccessToken and second provides a Facebook instance which requires a access token therefore I inject it using the first provider. public class FacebookAccessTokenProvider implements Provider&lt;AccessToken&gt;{ @Inject FBAccountDao dao; public AccessToken get() { List&lt;FacebookAccount&gt; accounts = null; dao.open(); accounts = dao.findAll(); dao.close(); if (accounts != null &amp;&amp; !accounts.isEmpty()) { FacebookAccount account = accounts.get(0); return new AccessToken(account.getToken(), account.getExpires()); } return null; } } public class FacebookProvider implements Provider&lt;Facebook&gt;{ @Inject private AccessToken accessToken; public Facebook get() { if (accessToken != null) { Facebook facebook = new FacebookFactory().getInstance(); facebook.setOAuthAppId(AppCredentials.FACEBOOK_APP_ID,AppCredentials.FACEBOOK_APP_SECRET); facebook.setOAuthPermissions(AppCredentials.FACEBOOK_PERMISSION); facebook.setOAuthAccessToken(accessToken); return facebook; } return null; } } Module: public void configure(Binder binder) { binder.bind(FBAccountDao.class).toProvider(FBAccountDaoProvider.class); binder.bind(TwitterAccountDao.class).toProvider(TwitterAccountDaoProvider.class); binder.bind(TwitterFriendDao.class).toProvider(TwitterFriendDaoProvider.class); binder.bind(FeedDao.class).toProvider(FeedDaoProvider.class); binder.bind(Facebook.class).toProvider(FacebookProvider.class); binder.bind(Token.class).toProvider(TwitterAccessTokenProvider.class); binder.bind(Twitter.class).toProvider(TwitterProvider.class); binder.bind(AccessToken.class).toProvider(FacebookAccessTokenProvider.class); } The problem is when I run the application it crashs and displays the following error: java.lang.RuntimeException: Unable to start service com.soulfeed.service.FeedService@422368d8 with Intent { cmp=com.soulfeed/.service.FeedService (has extras) }: com.google.inject.Pro…
score: 2
tagged with: guice
downvote count: 0
has answer: http://stackoverflow.com/a/23031656
type: AnsweredQuestion
tagged with: android
favorite count: 0
type: Question
upvote count: 2
answer count: 1
accepted answer: http://stackoverflow.com/a/23031656
tagged with: java

http://stackoverflow.com/q/23065904
tagged with: drag-and-drop
has title: Drag and drop ZK TreeModel issue
tagged with: zk
has answer: http://stackoverflow.com/a/23157152
accepted answer: http://stackoverflow.com/a/23157152
tagged with: tree
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I'm having problems with drag and drop, I wouldn't like to allow one node to be moved within one own subnode, for example: 1-- |--2 |--3 the node 2 can't be moved to node 3, if this happen node 3 has a new subnode but has no parent. The same can't happen with the node 1 that can't be moved to node 2. Is there a way to prevent this without to implement a method in my viewmodel? or this is a bug in the compnent. I'm using AbstractTreeModel, because my tree can become very big and I want it to be loaded on demand, the most examples on the web are about DefaultTreeModel and I can't adapt this examples to my solution. I'm using ZK 7.0.0 and any help I will apreciate. bellow is the code used to implement: .zul file : <separator height="10px" /> Here is code of my Abstract tree model : public class UnidadeTreeModel extends AbstractTreeModel{ private static final long serialVersionUID = 3854683349236034878L; private UnidadeServiceImpl unidadeService; public UnidadeTreeModel(Unidade unidade) { super(unidade); unidadeService = (UnidadeServiceImpl) SpringUtil.getBean("unidadeService"); } public boolean isLeaf(Unidade node) { Unidade newNode = unidadeService.atualizar(node); return newNode.getUnidades() == null || newNode.getUnidades().size() == 0; } public Unidade getChild(Unidade parent, int index) { Unidade newParent = unidadeService.atualizar(parent); if ((newParent).getUnidades() != null && ((Unidade) newParent).getUnidades().size() > index) { return (newParent).getUnidades().get(index); } else { return null; } } public int getChildCount(Unidade parent) { Unidade newParent = unidadeService.atualizar(parent); return ((newParent).getUnidades() != null) ? ((Unidade) newParent).getUnidades().size() : 0; } public int getIndexOfChild(Unidade parent, Unidade child) { Unidade newParent = unidadeService.atualizar(parent); for (int i = 0; i < newParent.getUnidades().size(); i++) { if (child.equals(newParent.getUnidades().get(i))) { return i; } } return -1; } } And Finally part of th…
has comment: http://stackoverflow.com/comment/35248620
type: Question
has comment: http://stackoverflow.com/comment/35252005
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35324091

apache-flex
tags question: http://stackoverflow.com/q/23126842
type: Tag
tag name: apache-flex

http://stackoverflow.com/a/23095091
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23094602
type: Answer
has body: Here is what I interpreted as what you are asking for: for(int i = 0; i &lt; ar.length; i++) { if(ar[i] != null) s += ar[i].getTypeName()+"\n"; for(int j = 1; j &lt; ar.length; j++) { if(ar[i] != null &amp;&amp; ar[j] != null &amp;&amp; ar[i].getTypeName().equals(ar[j].getTypeName())) { duplicate += i+" has the same name as "+j+"\n"; } } } System.out.println("These are the roomtypes: \n"+s+"\n"); System.out.println(duplicate);
answers question: http://stackoverflow.com/q/23094602
score: 0

http://stackoverflow.com/comment/35302978
score: 0
type: Comment
has text: You have to think again and redesign as per swing application. For more info look at [A Visual Guide to Layout Managers](http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html)
comment on: http://stackoverflow.com/a/23095715
type: AnswerComment

formatting
tags question: http://stackoverflow.com/q/22976634
tags question: http://stackoverflow.com/q/23077916
tag name: formatting
tags question: http://stackoverflow.com/q/22998260
tags question: http://stackoverflow.com/q/22993209
tags question: http://stackoverflow.com/q/23105062
type: Tag
tags question: http://stackoverflow.com/q/23118422

http://stackoverflow.com/comment/35123135
score: 0
type: AnswerComment
type: Comment
has text: As I added in my second edit: could you point out an example of a simple, clear swing timer so I can figure out how to use it? The java tuts one is quite confusing.
comment on: http://stackoverflow.com/a/22997093

http://stackoverflow.com/q/22985701
has comment: http://stackoverflow.com/comment/35103576
score: 0
answer count: 2
tagged with: xml-parsing
has comment: http://stackoverflow.com/comment/35101975
possible better answer: http://stackoverflow.com/a/22986051
favorite count: 0
linked to: http://stackoverflow.com/q/1647512
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22986321
tagged with: java
has answer: http://stackoverflow.com/a/22986051
accepted answer: http://stackoverflow.com/a/22986321
has title: Most efficient way to read and edit an xml file
has body: I have an xml template file, some fields are blank and need to be filled by my application. This has to result in an xml string representation of that file which will be given to another routine. So, let's take this simple xml as example: &lt;root&gt; &lt;name anAttr=""&gt;&lt;/name&gt; &lt;age&gt;&lt;/age&gt; &lt;/root&gt; As you can see I'd have to read the xml and, in the parsing process, add some contents to it. I though about using a sax parser and in the handler I would do something like this: StringBuilder finalXml = new StringBuilder(); DefaultHandler handler = new DefaultHandler(){ public void startElement(String uri, String localName,String qName, Attributes attributes) throws SAXException { finalXml.append("&lt;"+qName+"&gt;"); if(qName.equals("name")){ finalXml.append("donald"); } } would it be correct/efficient this way? Or is there a better way?
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/comment/35109903
score: 0
type: QuestionComment
type: Comment
has text: I want all the methods/fields on my form class to be mocked, EXCEPT the calls to my setter/getter and the call to the `validate()` method. As I dig through the documentation, its looking like I need to use a `spy`.
comment on: http://stackoverflow.com/q/22988420

http://stackoverflow.com/q/23126247
has answer: http://stackoverflow.com/a/23126305
has body: With java I can write something like that public &lt;T extends Enum&gt; getValue (Class&lt;T&gt; clazz) {} Is there a way to parametrize not from Enum, but from Annotation? So example I want write something like this: public &lt;T extends @interface&gt; getValue (Class&lt;T&gt; clazz) {} My goal is to be insure during compilation time that clazz variable is annotation. Any ideas? (except call class.isAnnotation inside a method)
downvote count: 0
answer count: 1
tagged with: inheritance
favorite count: 0
accepted answer: http://stackoverflow.com/a/23126305
type: AnsweredQuestion
tagged with: annotations
upvote count: 1
type: Question
score: 1
tagged with: java
has title: How parametrize annotation?

http://stackoverflow.com/comment/35162351
has text: How could I do that without extending JPanel and JFrame? I thought I could only extend from one class and I'm already extending from GenericClass
score: 0
comment on: http://stackoverflow.com/q/23018404
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23052662
linked to: http://stackoverflow.com/q/4367539
has answer: http://stackoverflow.com/a/23052709
has title: Handling I/O on 16-bit characters
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35223771
has body: Which one is used to handle I/O on 16-bit unicode characters in java - FileInputStream/FileOutputStream or Readers/Writers? What is the difference between them?
tagged with: java
has comment: http://stackoverflow.com/comment/35223816
duplicate of: http://stackoverflow.com/q/4367539
has comment: http://stackoverflow.com/comment/35223838
type: Question
score: 0
answer count: 1

http://stackoverflow.com/q/23111368
has comment: http://stackoverflow.com/comment/35348020
answer count: 1
tagged with: speech-recognition
favorite count: 0
has comment: http://stackoverflow.com/comment/35353160
has answer: http://stackoverflow.com/a/27475159
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35347782
has comment: http://stackoverflow.com/comment/35348460
has comment: http://stackoverflow.com/comment/43385138
tagged with: processing
score: 1
has comment: http://stackoverflow.com/comment/35329659
tagged with: java
has title: array out of bound exception:0
upvote count: 1
has comment: http://stackoverflow.com/comment/35329348
type: Question
has body: i have a code for controlling led on-off through voice. In the following processing 1.2 code, an array out of bound exception error is occurring please help me to get ride of this error is in initialize function 2 line... String words; String s; String str1= "on"; String str2= "off"; void setup () { initialize () ; } void draw () { listen () ; } void respond (String input) { if(input.length()&gt;0) { //user speaks any commands voce.SpeechInterface.setRecognizerEnabled(false) ; //stop //Listening, decode and send command to robot String [ ] words = split (input," "); tts.speak(input) ; //Play the spoken words if(words[0].equals(str1)==true) { robot.write ("A") ; } if(words[0].equals(str2)==true) { robot.write ("B") ; } voce.SpeechInterface.setRecognizerEnabled(true); } } /*void mousePressed () { } */ //Speech Function: //import the libraries import guru.ttslib.*; import processing.serial.*; //give our instances names Serial robot; TTS tts; public void initialize() { voce.SpeechInterface.init("libraries/voce-0.9.1/lib",true,true,"libraries/voce- 0.9.1/lib/gram","digits"); println(Serial.list()); robot = new Serial(this, Serial.list()[0],9600) ; //start serial port and also tts tts = new TTS() ; //the following settings control the voice sound tts.setPitch ( 90 ) ; tts.setPitchRange ( 90 ) ; } void listen () { if(voce.SpeechInterface.getRecognizerQueueSize()&gt;0 ) { //if voce recognizes anything being said s = voce.SpeechInterface.popRecognizedString(); //assign the string that computer heard to the variable s println("you said: " + s) ; //print what was heard to the debug window. respond (s); } }
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/35349289

http://stackoverflow.com/comment/35198708
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23038554
has text: [Here's](http://docs.oracle.com/javase/7/docs/api/java/io/DataInputStream.html) the javadoc. Yes, it does read the next byte. You're writing an `int` for the `x` position but reading only a `byte`. Do you see how those are not equivalent?

http://stackoverflow.com/comment/35457954
comment on: http://stackoverflow.com/a/23069367
type: Comment
has text: Thanks Gary, with your answer my code is 58 times faster. I wrote out my full code in the original post
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35084361
comment on: http://stackoverflow.com/q/22975449
has text: Read the [`String`](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html) API, there are some methods there that will do just what you need. (P.S. I would _not_ use `split`.)
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/35266621
type: AnswerComment
score: 0
type: Comment
has text: The problem is that everytime you launch the app, the variable is set to `true` so it assumes that every launch is the first launch. That is why you have to save the value of this boolean variable either in SharedPreferences or in a file and update it as necessary.
comment on: http://stackoverflow.com/a/23056295

http://stackoverflow.com/a/36976930
downvote count: 0
has body: Set the default compiler to 1.6 or 1.7 Hope this will solve your issue
answers question: http://stackoverflow.com/q/22975413
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/65413896
score: 2

http://stackoverflow.com/a/23095357
type: Answer
score: 1
has body: A regex could work, to match words containing "this" (say, (.*)(this)(.*)) But without more semantic information, you could be removing random this's. Ever worse, you might change the meaning of the code. Why do you want to do this?
downvote count: 0
answers question: http://stackoverflow.com/q/23095305
upvote count: 1

http://stackoverflow.com/comment/35329286
comment on: http://stackoverflow.com/q/22985846
type: Comment
type: QuestionComment
has text: @CodeChimp The same document opens properly with Firefox. So, i dont think there is any issue with the document. However, http://www.saronicferries.gr/content/pdfFiles/sample.pdf is the document.
score: 0

http://stackoverflow.com/q/23098022
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23098177
has title: How to check if List<E> meets requirements of another List<E>
type: Question
has answer: http://stackoverflow.com/a/23098182
has answer: http://stackoverflow.com/a/23098177
score: 0
accepted answer: http://stackoverflow.com/a/23098164
has body: Is there a way that I can check if one list meets the requirements of another? I have a list source and a list destination. The types aren't known yet, which is why they're generic. I'm trying to find a way where it could check if the elements in source would match the type of destination. If so, then the element would be added to destination. public interface UnaryPredicate&lt;E&gt; { public List&lt;E&gt; copyIf( List&lt;E&gt; source,List&lt;E&gt; destination); } . public class Copy&lt;E&gt; implements UnaryPredicate{ public List copyIf( List source, List destination) { for (List temp: source) { //if source meets requirement, destination.add(temp); } } public static void main(String[] args) { } }
has answer: http://stackoverflow.com/a/23098164
has answer: http://stackoverflow.com/a/23098104
answer count: 4

http://stackoverflow.com/q/23044423
tagged with: arrays
has body: I need to implement a method public int insert (int x) which inserts x in the "elements" array keeping it ordered, and returns the index to which it is entered; if the element is already present, don't insert x and returns -1; if the array is full, it reallocates "elements" array in an array of double size and then insert the item x. I know that there are probably similar methods already in the API but rather implement it. I wrote this, but I do not know how to complete it... public int insert(int x) { if(numElements == elements.length) { //code } int pos = binarySearch(x); if(pos != -1) return -1; if(elements[-(pos + 1)] != null) { for(int i = numElements; i &gt;= -(pos + 1); i--) elements[i + 1] = elements[i]; } elements[-(pos + 1)] = x; numElements++; return -(pos + 1); } I do not know if what I wrote is correct, however, and I miss the case of a full array. Can anyone help me? Thanks private int binarySearch(int x) { int inf = 0; int sup = numElements - 1; if(sup == -1 || elements[0] &gt; x) return -1; if(elements[sup] &lt; x) return -(numElements + 1); //Invariante di ciclo: se x in a, allora x in a[inf...sup] while(inf &lt;= sup) { int i = (inf + sup) &gt;&gt;&gt; 1; //divide per due if(elements[i] &gt; x) sup = i - 1; else if(elements[i] &lt; x) inf = i + 1; else return i; } return -(inf + 1); }
accepted answer: http://stackoverflow.com/a/23044519
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23044519
tagged with: insert
has title: Inserts an element into an array and returning the index reallocating the array in case of full array
tagged with: indexing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35208674
has comment: http://stackoverflow.com/comment/35208749
type: Question

http://stackoverflow.com/q/23025527
answer count: 2
upvote count: 1
tagged with: android-fragments
tagged with: java
has title: Access objects from FragmentActivity inside Fragments?
has answer: http://stackoverflow.com/a/23025669
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
has body: I'm using objects from my main activity in some of my fragments, one of these is the SpeechHelper which is defined in my MainActivity and used in all fragments. I know two methods to use this object in my fragments: -The first one is to pass it to the Fragment in it's constructor. -The second one is to do this: ((MainActivity) getActivity()).speechHelper.speak(getString(R.string.flashlight),TextToSpeech.QUEUE_FLUSH); I'm not sure how this method works, morover it crashes my app early on MainActivity lifecycle. I'd like to know what ways exist to do this and what's the preferred method to access objects from my MainActivity (FragmentActivity) in my Fragments.
tagged with: android
possible better answer: http://stackoverflow.com/a/23026521
has answer: http://stackoverflow.com/a/23026521
accepted answer: http://stackoverflow.com/a/23025669

http://stackoverflow.com/comment/35135214
has text: Can you post the complete code? My guess is you have a mistake like `Color[][] rgbArray;` declared as a field in the class and in the constructor you have `Color[][] rgbArray = new Color[height][width];` (which is a new declaration and hides the field) but it's impossible to tell with such a small snippet.
comment on: http://stackoverflow.com/q/23003753
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/29290864
type: Answer
accepted answer of: http://stackoverflow.com/q/23057678
score: 5
upvote count: 5
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23057678
has body: With Objectify you can do it like this. For example, let's declare our BooksEndpoint as follows: @Api( name = "books", version = "v1", namespace = @ApiNamespace(ownerDomain = "backend.example.com", ownerName = "backend.example.com", packagePath = "") ) public class BooksEndpoint { @ApiMethod(name = "saveBook") public void saveBook(Book book, User user) throws OAuthRequestException, IOException { if (user == null) { throw new OAuthRequestException("User is not authorized"); } Account account = AccountService.create().getAccount(user); ofy().save() .entity(BookRecord.fromBook(account, book)) .now(); } } To test it, you would need following dependencies: testCompile 'com.google.appengine:appengine-api-labs:1.9.8' testCompile 'com.google.appengine:appengine-api-stubs:1.9.8' testCompile 'com.google.appengine:appengine-testing:1.9.8' testCompile 'junit:junit:4.12' Now, test will look as follows: public class BooksEndpointTest { private final LocalServiceTestHelper testHelper = new LocalServiceTestHelper( new LocalDatastoreServiceTestConfig() ); private Closeable objectifyService; @Before public void setUp() throws Exception { testHelper.setUp(); objectifyService = ObjectifyService.begin(); // required if you want to use Objectify } @After public void tearDown() throws Exception { testHelper.tearDown(); objectifyService.close(); } @Test public void testSaveBook() throws Exception { // Create Endpoint and execute your method new BooksEndpoint().saveBook( Book.create("id", "name", "author"), new User("example@example.com", "authDomain") ); // Check what was written into datastore BookRecord bookRecord = ofy().load().type(BookRecord.class).first().now(); // Assert that it is correct (simplified) assertEquals("name", bookRecord.getName()); } } Note, I'm using BookRecord and Book here - those are my Entity and POJO, nothing special.

http://stackoverflow.com/comment/35146307
has text: I guess you can use a Spliterator to convert an Iterator to a Stream, but returning a Collection from getUserIDs would be nicer. Updated my answer with a sample.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23010107
type: Comment

http://stackoverflow.com/comment/35138655
score: 0
type: QuestionComment
type: Comment
has text: Is this Android? Eclipse supports many UI toolkits and if you don't say which one you are using you are unlikely to get much help
comment on: http://stackoverflow.com/q/23005613

http://stackoverflow.com/q/23069187
answer count: 1
has body: At the moment the below code displays all the rows in the database but I want to change it to only show the last and latest column. What do I need to add and change to do this? public String getData() { // TODO Auto-generated method stub String[] columns = new String[] {KEY_ROWID, KEY_FNAME, KEY_SNAME, KEY_HOURS, KEY_REG, KEY_CPARK, KEY_TIMESTAMP}; Cursor c = ourDatabase.query(DATABASE_TABLE, columns, null, null, null, null, null); String result = " "; int iRow = c.getColumnIndexOrThrow(KEY_ROWID); int iFname = c.getColumnIndexOrThrow(KEY_FNAME); int iSname = c.getColumnIndexOrThrow(KEY_SNAME); int iHours = c.getColumnIndexOrThrow(KEY_HOURS); int iReg = c.getColumnIndexOrThrow(KEY_REG); int iCpark = c.getColumnIndexOrThrow(KEY_CPARK); int iTime = c.getColumnIndexOrThrow(KEY_TIMESTAMP); for(c.moveToFirst(); !c.isAfterLast(); c.moveToNext()){ result = result + c.getString(iRow) + " " + c.getString(iFname) + " " + c.getString(iSname) + " " + c.getString(iHours) + " " + c.getString(iReg) + " " + c.getString(iCpark) + " " + c.getString(iTime) + "\n"; } return result; }
tagged with: android
has answer: http://stackoverflow.com/a/23069309
tagged with: sqlite
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23069309
has comment: http://stackoverflow.com/comment/35254552
tagged with: java
tagged with: database
has title: How can I only show the last row?
score: 0

http://stackoverflow.com/q/22991128
tagged with: swing
accepted answer: http://stackoverflow.com/a/22991257
type: AnsweredQuestion
has title: How to turn off a JButton using another JButton
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35387309
tagged with: user-interface
favorite count: 0
has answer: http://stackoverflow.com/a/22991257
score: 0
possible better answer: http://stackoverflow.com/a/22991321
has comment: http://stackoverflow.com/comment/35113247
has answer: http://stackoverflow.com/a/22991321
has body: I would just like to preface this post by informing you that this is my first time posting, so if there are any mistakes, let me know. I am attempting to code a blackjack game for my high school computer math (programming) class and I have a multitude of errors, but the one that is really annoying is this one. My GUI has 2 JButtons, a hit me button, "Hit Me," and a stand button, "Stand." Hit Me uses Math.random to give the player a card and also tracks to see if they go bust. The Stand button needs to disable the Hit Me button when the player clicks it. I searched this site for answers and the one I got was using the setEnabled method and setting it to HitMe.setEnabled(false). I also found people who said the JButtons need to be set to final such that : final JButton name = new JButton(""); So, I set the JButtons to final and inserted the setEnabled method in the code for the ActionListeners as such private class StandListener implements ActionListener { public void actionPerformed(ActionEvent e) { HitMe.setEnabled(false); } } and final JButton HitMe = new JButton("Hit Me"); The set.Enabled(false) does not work inside the ActionListener code. The "final" identifier does not work either. I really need help with this, so any assistance as soon as possible is appreciated. I will post some more problems later. :) EDIT 17 April 2014: I am writing this because I just realized that, if anyone looks at this page, they may be able to diagnose the errors I got. I am using jGrasp for my java coding if that has an effect on your answers. Here are the errors: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at PlayerBoxClubs$StandListener.actionPerformed(PlayerBoxClubs.java:105) 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(…
has comment: http://stackoverflow.com/comment/35111913
upvote count: 2
downvote count: 2

http://stackoverflow.com/a/22981731
has comment: http://stackoverflow.com/comment/35094878
upvote count: 11
has comment: http://stackoverflow.com/comment/35099758
has comment: http://stackoverflow.com/comment/35095244
has comment: http://stackoverflow.com/comment/35095361
has comment: http://stackoverflow.com/comment/35095350
has comment: http://stackoverflow.com/comment/35094863
has comment: http://stackoverflow.com/comment/35095237
score: 1
has comment: http://stackoverflow.com/comment/35095111
downvote count: 10
has comment: http://stackoverflow.com/comment/35095379
has comment: http://stackoverflow.com/comment/35095307
answers question: http://stackoverflow.com/q/22981673
has comment: http://stackoverflow.com/comment/35095173
type: Answer
has body: You are implementing a recursive mutex. i.e. the same thread can enter the synchronisation block, but not other threads.

http://stackoverflow.com/a/23025726
score: 3
has body: The default location of hadoop streaming jar is /usr/lib/hadoop/contrib/streaming/hadoop-streaming-*.jar. If you cannot find the jar in the above mentioned location. you could download hadoop-streaming-*.jar from the following Hortonworks repository: http://repo.hortonworks.com/content/repositories/releases/org/apache/hadoop/hadoop-streaming/
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/23024960
type: Answer

http://stackoverflow.com/q/23089773
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23161577
has title: Implementation for Custom AuthenticationManager
score: 0
answer count: 1
has body: I am trying implementing in a simple application a full customized login based on the spring security, which will serve to me as base for a more complex project. In the moment, I need write a custom AuthenticationManager. In other topic here from StackOverflow, Ilhave learned that "the AuthenticationManager delegates the fetching of persistent user information to one or more AuthenticationProviders". I already have one AuthenticationProvider for get the user data from database. I also read in other place (i can't find the link anymore), i could configure my MethodSecurityConfig together with my CustomPermissionEvaluator in this class (but how I lost the link, I can't be sure). The problem is that I have no idea how I should put all this in the code in this minimal structure: public class CustomAuthenticationManager implements AuthenticationManager { @Override public Authentication authenticate(Authentication arg0) throws AuthenticationException { // TODO Auto-generated method stub return null; } } Anyone can just point me a direction of how to do this? A link for some tutorial, or github project which contain a class like that, or anything of this nature will be of great help. ps.: my classes from security package are: https://github.com/klebermo/webapp2/tree/master/src/com/spring/webapp/lojavirtual/config/security UPDATE Ok, I need correct the third paragraph above: in fact, I include the AuthenticationManager because when I try run the application, after I include the method: protected MethodSecurityExpressionHandler createExpressionHandler() { DefaultMethodSecurityExpressionHandler expressionHandler = new DefaultMethodSecurityExpressionHandler(); expressionHandler.setPermissionEvaluator(new CustomPermissionEvaluator()); return expressionHandler; } to my securityconfig, i face an error in the console of eclipse, where says that I NEED an AuthenticationManager. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'privadoController…
tagged with: spring-security
accepted answer: http://stackoverflow.com/a/23161577
tagged with: spring

http://stackoverflow.com/a/23120309
downvote count: 0
answers question: http://stackoverflow.com/q/23119788
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/23119788
upvote count: 1
has body: You can do it this way, using look-behind and look-ahead assertions to locate your groups of subject and numbers and then use matching groups to extract individual parts for each match: Pattern p = Pattern.compile("(?=[^@])(.+?)#(\\d)#(\\d)(?=@)"); Matcher m = p.matcher("Matematika 1#1#0@Fizika 1#1#6@Osnovi na injenernoto proektirane 1#1#5@PIK 1#1#6@Matematika 2#2#6@Fizika 2#2#6@Osnovi na injenernoto proektirane 2#2#4@"); while(m.find()) { if (m.groupCount() == 3) { System.out.println(m.group(1)); System.out.println(m.group(2)); System.out.println(m.group(3)); } }
type: AcceptedAnswer

http://stackoverflow.com/a/23100427
answers question: http://stackoverflow.com/q/23100275
accepted answer of: http://stackoverflow.com/q/23100275
has body: Contrary to other answers here, (Math.max(0,(y.atk-x.def)) has an extra parenthesis, at the beginning. Remove it: Math.max(0,(y.atk-x.def)) You can indeed put an extra pair around the whole thing, as you have started to do, and as other answers appear to insist is necessary, but it isn't. It's redundant.
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/35146732
has text: Best answer: clean, no comment, resolve problem and elegant, thanks
type: Comment
comment on: http://stackoverflow.com/a/23010155
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35369128
type: AnswerComment
has text: Can you show how to do it? The solution which I told is not working correctly.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23115257

http://stackoverflow.com/comment/35361909
comment on: http://stackoverflow.com/q/23129402
type: Comment
type: QuestionComment
has text: @Ordous that would be wonderful , how do i go about doing it
score: 0

http://stackoverflow.com/q/23041673
has comment: http://stackoverflow.com/comment/35204650
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35203631
has body: I have a Sons class which load and play sounds. And an adhd class which contain the main and uses this Sons class. All my classes are in the package "adhd" and my sounds in the jar, are like this : 1.wav is in SoundN which is in the jar. (ADHD.jar/SoundN/1.wav). When I run the code in Eclipse it works, but when I run the jar it doesn't. It is important for me to keep the sounds "loading" because I need my program to read my sounds quickly, as I am using timers. What do you suggest me to do? Here is the code of my class Sons which load sounds in instances of singletons. Sons package adhd; import java.io.File; import java.io.IOException; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.UnsupportedAudioFileException; import java.applet.Applet; import java.applet.AudioClip; import java.net.URL; public class Sons { private static String PATH=null; private static Sons instance; private final Map&lt;String, Clip&gt; sons; private boolean desactive; Sons(String path) { PATH = path; sons = new HashMap&lt;String, Clip&gt;(); } public void load(String nom) throws UnsupportedAudioFileException, IOException, LineUnavailableException { Clip clip = AudioSystem.getClip(); clip.open(AudioSystem.getAudioInputStream(getClass().getResourceAsStream(PATH + nom))); sons.put(nom, clip); } public void play(String son) { if(!desactive) try { Clip c = getSon(son); c.setFramePosition(0); c.start(); } catch(Exception e) { System.err.println("Impossible to play the sound " + sound); desactive = true; } } } Here is the adhd class which contain the main that uses sounds Main class : adhd public static void main(String[] args) { Sons sonN= new Sons("/SoundN/"); try { sonN.load("1.wav"); } catch (UnsupportedAudioFileException |…
linked to: http://stackoverflow.com/q/23041513
has answer: http://stackoverflow.com/a/23044038
has comment: http://stackoverflow.com/comment/35204272
tagged with: clip
has comment: http://stackoverflow.com/comment/35206652
has comment: http://stackoverflow.com/comment/35204886
has comment: http://stackoverflow.com/comment/35207328
has comment: http://stackoverflow.com/comment/35204695
has comment: http://stackoverflow.com/comment/35207407
score: 0
accepted answer: http://stackoverflow.com/a/23044038
has comment: http://stackoverflow.com/comment/35206381
answer count: 1
has title: Path to read a sound out of my package
has comment: http://stackoverflow.com/comment/35204969
linked to: http://stackoverflow.com/q/15725871
has comment: http://stackoverflow.com/comment/35203988
has comment: http://stackoverflow.com/comment/35204245
has comment: http://stackoverflow.com/comment/35204508
has comment: http://stackoverflow.com/comment/35204526
has comment: http://stackoverflow.com/comment/35206485
has comment: http://stackoverflow.com/comment/35206418
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35207194
tagged with: audio

http://stackoverflow.com/comment/35153658
type: QuestionComment
score: 2
has text: Time to install that JDK...
comment on: http://stackoverflow.com/q/23014037
type: Comment

http://stackoverflow.com/a/23207119
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23056090
downvote count: 0
has body: Here is one way to get a transparent mask. GradientMask.java: import Utilities.*; import javax.swing.*; import javax.imageio.*; import java.awt.*; import java.awt.image.*; import java.io.*; public class GradientMask { public static void main(String[] args) throws Exception{ JFrame Main = new JFrame("Gradient Mask"); JLabel imageLayer = new JLabel(); JLabel maskLayer = new JLabel(); BufferedImage image = ImageIO.read(new File("C:\\Users\\"+System.getenv("username")+"\\Desktop\\Cat Image.jpg")); BufferedImage gradientMask = new GradientImage(image.getWidth(), image.getHeight(), new Color[]{new Color(255, 255, 255, 125), Color.BLACK}, GradientImage.RADIAL_FROM_CENTER).getImage(); Main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Main.setBounds(100, 50, image.getWidth(), image.getHeight()); imageLayer.setBounds(0, 0, Main.getWidth(), Main.getHeight()); maskLayer.setBounds(0, 0, Main.getWidth(), Main.getHeight()); imageLayer.setIcon(new ImageIcon((Image) image)); maskLayer.setIcon(new ImageIcon((Image) gradientMask)); Main.getContentPane().add(imageLayer); imageLayer.add(maskLayer); Main.setVisible(true); } } GradientImage.java: package Utilities; import java.awt.*; import java.awt.image.*; public class GradientImage { public final static int LINEAR_LEFT_TO_RIGHT = 1; public final static int LINEAR_RIGHT_TO_LEFT = 2; public final static int LINEAR_TOP_TO_BOTTOM = 3; public final static int LINEAR_BOTTOM_TO_TOP = 4; public final static int LINEAR_DIAGONAL_UP = 5; public final static int LINEAR_DIAGONAL_DOWN = 6; public final static int RADIAL_FROM_TOP_LEFT_CORNER = 7; public final static int RADIAL_FROM_BOTTOM_LEFT_CORNER = 8; public final static int RADIAL_FROM_TOP_RIGHT_CORNER = 9; public final static int RADIAL_FROM_BOTTOM_RIGHT_CORNER = 10; public final static int RADIAL_FROM_CENTER = 11; public final static int RADIAL_FROM_CORNERS = 12; public final static int PATH_FROM_CENTER = 13; public final static int PATH_FROM_TOP_LEFT_CORNER = 14; public final static int PA…

http://stackoverflow.com/q/22980917
downvote count: 0
score: 1
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/22981134
type: Question
answer count: 2
has body: I am trying to concatenate two ID numbers together but add a comma between them to separate from each other. I know the mysql statement to use but I am having difficulty translating this to a string in my java program. I can get it to work without the comma but I can't seem to figure out the syntax for adding the comma. Here is my attempt: query = "UPDATE table SET idColumn = concat(idColumn, ','"+idNum+") WHERE word = '"+wordVariable+"' "; To clarify, I have a word table which contains a word column and an ID number column. As an example, my ID column might contain a single number as the ID but after multiple concatenations it might look like: 2,5,4,7,1
possible better answer: http://stackoverflow.com/a/22981134
upvote count: 1
favorite count: 0
has title: Mysql concat string with comma in java
has answer: http://stackoverflow.com/a/22981126
accepted answer: http://stackoverflow.com/a/22981126
type: AnsweredQuestion

http://stackoverflow.com/q/23078119
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23078392
tagged with: eofexception
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35270467
type: Question
answer count: 2
tagged with: network-programming
downvote count: 0
has title: Why is this exception thrown and how to recover from it?
tagged with: java-io
has answer: http://stackoverflow.com/a/23078392
favorite count: 0
possible better answer: http://stackoverflow.com/a/23078330
has body: I am creating a remote-desktop screenshot application. I have two methods on the server 1) To read the Image from client 2) to read the list of task running on the client). But everytime I try to read the client's input stream an EOF excetion is thrown. The stakctrace of the exception is java.io.EOFException at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2323) at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2792) at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:799) at java.io.ObjectInputStream.(ObjectInputStream.java:299) at remoteserverclient.original.ScreenServer$ServerThread.run(ScreenServer.java:254) Here is the code on the server where the exception is thrown ObjectInputStream in = new ObjectInputStream(client.getInputStream()); Object obj = in.readObject(); if (obj instanceof Rectangle) { CaptureScreen(obj, in); } else if (obj instanceof String) { CaptureList(in); } Here is the complete code for the client public class ScreenClient { static Socket server; public static void main(String[] args) throws Exception { try { while (true) { server = new Socket("localhost", 5494); BufferedReader bf = new BufferedReader(new InputStreamReader(server.getInputStream())); String s; s = bf.readLine(); System.out.println(s); if (s.contains("execute")) { new ClientMessageThread().start(); } if (s.contains("getProcessList")) { new ClientFetchProcessThread().start(); } } } catch (Exception e) { System.err.println("Disconnected From server -&gt;" + e.getMessage()); } } public static class ClientMessageThread extends Thread { Socket server; public ClientMessageThread() { try { server=new Socket("localhost",5494); } catch (Exception ex) { ex.printStackTrace(); } } @Override public void run() { try { BufferedImage screen; Robot robot = new Robot(); Rectangle size = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); screen = robot.createScreenCapture(size); int[] rgbData = new int[(int) (s…
has comment: http://stackoverflow.com/comment/35270578
has answer: http://stackoverflow.com/a/23078330
has comment: http://stackoverflow.com/comment/35270696
tagged with: sockets
upvote count: 1

http://stackoverflow.com/q/23028630
tagged with: http://stackoverflow.com/tag/svg
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23033685
tagged with: java
type: Question
answer count: 1
has body: I am trying to make an animation by displaying a series of SVG images uisng Java language. Here is a part of my code. for(int i = 0; i &lt; svgDocList.size(); i++) { try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } svgCanvas.setDocument(svgDocList.get(i)); } When I run this, the canvas displayed only the first image of the list but did not get update with other images of the list. What could be wrong? or Any other ways of displaying a series of svg images?
score: 0
has title: Displaying a sequence of SVG Images

http://stackoverflow.com/comment/35278485
type: Comment
has text: see edit, sorry for that cannot test the code right now
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23082184

http://stackoverflow.com/comment/59457894
has text: @gandra404 That *you* have experience problems shows nothing, without further evidence. Perhaps *you* made a mistake, which shows up in a manner that you incorrectly interpret as being the result of a `RestTemplate` not being thread-safe.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22989501
type: Comment

http://stackoverflow.com/a/23028597
answers question: http://stackoverflow.com/q/23028342
has body: Try anyone of the fllowing: 1.Mention the full path in your file constructor. 2.Or you are going to write something in your file right?? Just do this.. FileOutputStream jsonfile = new FileOutputStream("newjson.json"); which will create the file in your current working project.
type: Answer
score: 0

http://stackoverflow.com/q/23051671
favorite count: 0
has answer: http://stackoverflow.com/a/23051724
has body: I have done much more complicated problems with no issues for my course, but this is giving me fits! My problem is simple, I cannot brighten or change the color of my jpanels. I feel I a missing something crucial in how my extended jpanel class interacts with my overridden paint component as well as my other classes. The mission is simple, when one jpanel is clicked it's color should brighten, while the other two colors dim. Run down: I extended Jframe and added 3 panels to it. I have added a mouse listener to each. When each is pressed the mouse listener does work "print statements confirmed". However it does not change the objects color. I thought that by including my mouse adapter in my TrafficLight class I would be able to change the color and call repaint. I have played with in all the ways I can think, is my organization wrong? import java.awt.*; import javax.swing.*; import java.awt.event.*; class TrafficLight3 extends JFrame { //class variables public JPanel red; public JPanel yellow; public JPanel green; public Color r; public Color y; public Color gr; public static void main ( String [] args ) { TrafficLight3 tl = new TrafficLight3 ( ); } // Constructor public TrafficLight3( ) { setTitle( "Traffic Light" ); setLayout ( new GridLayout ( 3, 1 ) ); setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE ); r = Color.RED; red = new StopLightPanel( 100, r ); red.setPreferredSize( new Dimension ( 120, 120 ) ); red.addMouseListener ( new MouseClicked( ) ); add( red ); y = Color.YELLOW; yellow = new StopLightPanel( 100, y ); yellow.setPreferredSize( new Dimension ( 120, 120 ) ); yellow.addMouseListener ( new MouseClicked( ) ); add( yellow ); gr = Color.GREEN; green = new StopLightPanel( 100, gr ); green.addMouseListener ( new MouseClicked( ) ); green.setPreferredSize( new Dimension ( 120, 120 ) ); add ( green ); pack(); setLocationRelativeTo(null); setVisible( true ); } class MouseClicked extends MouseAdapter { @Override public void mouseClicked ( MouseEvent me ) { if (me…
type: AnsweredQuestion
score: 1
upvote count: 1
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/23051724
tagged with: java
has title: Java swing: Extended jpanel class will not brighten upon repainting.
tagged with: mouseevent
answer count: 2
possible better answer: http://stackoverflow.com/a/23051718
tagged with: user-interface
downvote count: 0
has answer: http://stackoverflow.com/a/23051718

http://stackoverflow.com/comment/35198064
type: Comment
comment on: http://stackoverflow.com/a/23038179
has text: It would explain why he is isn't writing to the file, if FileOutputStream was buffered, which it isn't, but it doesn't explain why he isn't reading from the console. You're quite right to say he should close the file, but it doesn't answer the question.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23059407
upvote count: 2
accepted answer: http://stackoverflow.com/a/23059536
type: Question
tagged with: java
has body: I have a method that takes a string of text, chops it up and makes buttons out of all the words in the string. I add these to a horizontal Linear Layout like this: for (int x = 0; i &lt; string.length; x++) { Button word = new Button(context); word.setText(string[x]+""); myLinearLayout.addView(word); } The problem is that if the string is too long, the buttons will go off screen. How do I make it so that the buttons appear on a line below instead of jumping off screen? I've been looking for a solution all day but couldn't find an answer. Thanks!
has title: How do I make my buttons fit on screen in Android?
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23059536
favorite count: 0
has comment: http://stackoverflow.com/comment/35236493
tagged with: android
score: 2
type: AnsweredQuestion
tagged with: view

http://stackoverflow.com/q/23119230
has body: When I run junit tests on my project I receive the following error when trying to test that my project can build a url correctly. I am not sure what I am doing wrong below is the trace of the failed test run as well as the distancematrixconnection class and test class. It is producing a blank output when trying to compile the url string. org.junit.ComparisonFailure: expected:&lt;[http://maps.googleapis.com/maps/api/distancematrix/xml?origins=albany&amp;destinations=albany%20in&amp;language=en-EN&amp;sensor=false&amp;language=en-EN&amp;units=imperial]> but was:&lt;[]> at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at edu.bsu.cs222.gascalculator.tests.GoogleUrlTests.testAlbanyNYtoAlbanyINURL(GoogleUrlTests.java:26) public class GoogleDistanceMatrixConnection { String startLocation; String endLocation; final String urlString = "http://maps.googleapis.com/maps/api/distancematrix/xml?origins=" + startLocation +"&amp;destinations=" + endLocation +"&amp;language=en-EN&amp;sensor=false&amp;language=en-EN&amp;units=imperial"; private static String XMLFile; public String makeXMLFile(String start, String end) throws IOException { startLocation = start; endLocation = end; URL url = new URL(urlString); URLConnection connection = url.openConnection(); connection.connect(); BufferedReader reader = new BufferedReader( new InputStreamReader( connection.getInputStream())); for(String line = reader.readLine(); line != null; line = reader.readLine()) { setXMLFile(line); } return getXMLFile(); } // public static void main(String[] args) throws IOException{ // GoogleDistanceMatrixConnection c = new GoogleDistanceMatrixConnection(); // } public static String getXMLFile() { return XMLFile; } public static void setXMLFile(String xMLFile) { XMLFile = xMLFile; } public boolean doesPageExist() { if(XMLFile == null) return true; else return false; } } public class GoogleUrlTests { private GoogleDistanceMatrixConnection urlString = new GoogleD…
has comment: http://stackoverflow.com/comment/35390594
accepted answer: http://stackoverflow.com/a/23119628
type: AnsweredQuestion
tagged with: java
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/35344041
type: Question
has comment: http://stackoverflow.com/comment/35366049
tagged with: tdd
has answer: http://stackoverflow.com/a/23119628
score: 0
answer count: 1
tagged with: junit
has comment: http://stackoverflow.com/comment/35343759
has comment: http://stackoverflow.com/comment/35343748
has title: Receiving null output for tdd url test
has comment: http://stackoverflow.com/comment/35343809

http://stackoverflow.com/comment/35101026
type: Comment
type: QuestionComment
has text: maybe are you using some singleton objects?
score: 0
comment on: http://stackoverflow.com/q/22981586

http://stackoverflow.com/a/22992278
has comment: http://stackoverflow.com/comment/35143163
downvote count: 0
has comment: http://stackoverflow.com/comment/35532314
has comment: http://stackoverflow.com/comment/35152978
has body: You should use a Calendar and add 1 to Calendar.Day until your date is reached in a loop String dateA = "2014-02-02"; String dateB = "2014-02-06"; SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd"); Date dateStart = null; Date dateEnd = null; dateStart = formater.parse(dateA); dateEnd = formater.parse(dateB); Calendar c = GregorianCalendar.getInstance(); c.setTime(dateStart); List&lt;Date&gt; dates = new ArrayList&lt;Date&gt;(); while (!c.getTime().after(dateEnd)) { dates.add(c.getTime()); c.add(Calendar.DAY_OF_YEAR, 1); } for (Date element: dates) { System.out.println("The date is " + element); }
type: Answer
has comment: http://stackoverflow.com/comment/35528835
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35114543
answers question: http://stackoverflow.com/q/22992142
has comment: http://stackoverflow.com/comment/35117969

http://stackoverflow.com/q/23037462
upvote count: 4
answer count: 2
tagged with: android-logcat
has body: I'm using ACRA for crash reporting in my app. (In brief, ACRA is a tool for sending crash reports to the developer.) Even in release builds, I can see its logs in the device's logcat (for example when it sends a crash report, it sends many log lines with "ACRA" tag). Is there a way to disable its logging? Based on the comments below, let me emphasize again: I'm asking to disable the logging of ACRA itself. The question has nothing to do with ACRA's crashing or with the system logcat during app crashes. I think the best is to provide an example about what I mean: 04-13 02:33:50.980: D/ACRA(4560): Using custom Report Fields 04-13 02:33:51.170: I/ACRA(4560): READ_LOGS not allowed. ACRA will not include LogCat and DropBox data. 04-13 02:33:51.170: D/ACRA(4560): Writing crash report file 1667311131000.stacktrace. 04-13 02:33:51.200: D/ACRA(4560): About to start ReportSenderWorker from #handleException 04-13 02:33:51.200: D/ACRA(4560): Waiting for Toast + worker...
favorite count: 0
accepted answer: http://stackoverflow.com/a/24606000
tagged with: android
tagged with: logging
has answer: http://stackoverflow.com/a/23037497
type: AnsweredQuestion
score: 2
has title: How to disable the logging of ACRA
has comment: http://stackoverflow.com/comment/35196822
tagged with: java
tagged with: acra
downvote count: 2
possible better answer: http://stackoverflow.com/a/23037497
type: Question
has comment: http://stackoverflow.com/comment/35197262
has comment: http://stackoverflow.com/comment/35198615
has answer: http://stackoverflow.com/a/24606000

http://stackoverflow.com/comment/35271389
score: 0
type: Comment
type: QuestionComment
has text: Remove multiple occurrences of -Xms, and try -Xms512m -Xmx1028m -XX:MaxPermSize=512m
comment on: http://stackoverflow.com/q/23078660

http://stackoverflow.com/comment/35363339
type: Comment
comment on: http://stackoverflow.com/a/23127470
has text: I do not know the C++ very well, but I think that yes. It is very similar, but I am not sure. This question should be answered by someone who knows both languages (Java and C++).
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35197846
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22986474
has text: See this question http://serverfault.com/questions/587839/is-there-a-way-to-manually-check-for-openssl-cve-2014-0160-vulnerability
type: QuestionComment

http://stackoverflow.com/comment/35101507
type: Comment
has text: you have to edit your question for potential answer(s) to `1)I need a code that will fire for every selection of item in the combo box ???` --> what, where, how, this event ended inside JTable or `2)I need a code that will allow me to dynamically update the contents of the combobox that is inserted in the table` --> do you meaning editable JComboBox or
comment on: http://stackoverflow.com/q/22985023
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35244219
type: Comment
comment on: http://stackoverflow.com/a/23062992
score: 0
type: AnswerComment
has text: I am looking for an implementation which generates a constant value for several executions like md5 value for an unmodified file.

http://stackoverflow.com/q/23011070
type: Question
has body: I am working on a Java application which has a custom build java tree, which QTP though able to identify, but not able to use JavaTable methods such as GetCellData. In order to fetch cell data I did some googling and came to know if I am able to directly call the Java method which in my case is getDisplayedtextAt(int, int) then I am able to achieve the task. Does anyone have any idea how can I make a call from QTP to Java methods?
answer count: 1
has answer: http://stackoverflow.com/a/25770462
tagged with: qtp
score: 0
tagged with: hp-uft
accepted answer: http://stackoverflow.com/a/25770462
type: AnsweredQuestion
tagged with: java
has title: call java methods from QTP/vbscript
tagged with: vbscript

http://stackoverflow.com/a/23036702
score: 0
answers question: http://stackoverflow.com/q/23036337
has body: Here's another way of doing it. public class FileParser { public void scan() { try { File list = new File("randomizedList.txt"); Scanner scan = new Scanner(list); String temp; Scanner line; while (scan.hasNext()) { line = new Scanner(scan.nextLine()); temp = line.nextLine(); if (temp.startsWith("reviewers:")) { System.out.println(temp.split(":",2)[1]); } if (temp.startsWith("name:",1)) { System.out.println(temp.split(":",2)[1]); } if (temp.startsWith("open:")) { System.out.println(temp.split(":",2)[1]); } if (temp.startsWith("city:")) { System.out.println(temp.split(":",2)[1]); } if (temp.startsWith("category:")) { System.out.println(temp.split(":",2)[1]); } } scan.close(); } catch(FileNotFoundException e){ System.out.println("File's MISSIN!"); } catch(NoSuchElementException e){ System.out.println("NoSuchElementException dangus."); } } public static void main(String[] args) { new FileParser().scan(); } } Check the line with startsWith to find the introductory key word. Then use split the string around the : which returns an array of two strings. The second string in the returned array is reached by [1] and this produces the above output There are further improvements that can be made to this code though. The if statements should be refactored and extracted as a separate method. The strings constants should extracted and each line should only be checked once. Once a match is made you should move on to the next line.
type: Answer

http://stackoverflow.com/comment/35225468
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23053031
has text: In that case, ask that in your post. Because now it is definitely not clear from your post what you want us to answer.

http://stackoverflow.com/comment/35276478
has text: Can you post the whole code?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23081428

http://stackoverflow.com/comment/35226371
has text: when I am trying with `usePlatformMBeanServer` it gives me an error `[...] org.springframework.beans.factory.BeanCreationException: Error creating bean with name "beanPublisher" [...] Bean property 'setUsePlatformMBeanServer' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?` . I changed `sipmle jmx` version to `1.9`
type: AnswerComment
comment on: http://stackoverflow.com/a/23047186
score: 0
type: Comment

http://stackoverflow.com/q/23035030
has answer: http://stackoverflow.com/a/23039816
tagged with: rest
possible better answer: http://stackoverflow.com/a/23036016
linked to: http://stackoverflow.com/q/6267021
has answer: http://stackoverflow.com/a/23036016
tagged with: spring
has body: I am developing a project using Spring REST web services, where I need to show graceful error messages when an exception/error occurs. I followed this tutorial (http://www.javacodegeeks.com/2013/02/exception-handling-for-rest-with-spring-3-2.html) for exception handling using SpringREST. I get the proper output when there is no exception/error i.e. in form of an XML. The issue arises when an exception occurs. Here is part of the code base where an exception occurs if I do not pass the testId in localhost:8080/test?testId= The class outputs a response in form of a XML, so when an exception occurs, instead of showing the error message as figure 1 below, it shows error message as figure 2. If I do "View Page Source", I get the correct exception message (as figure 1). But I need the exception message directly. Could anyone, please suggest a solution? @RequestMapping(value = "/test", method = RequestMethod.GET, produces = "application/xml") public @ResponseBody String testResource( @RequestParam(value="testId", required=true) String testId) throws CustomRestException{ if (testId == null || testId.equals("")) { LOG.error( "testResource(): " + TestUtilsException.NULL_TEST_ID_ERROR_MSG ); //The error message is: The test Id is required and cannot be null or empty throw new CustomRestException(TestUtilsException.NULL_TEST_ID_ERROR_MSG); } } Figure 1 Figure 2 Other helper classes: @ControllerAdvice public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionHandler { public RestResponseEntityExceptionHandler() { super(); } @ExceptionHandler(value = { CustomRestException.class }) @ResponseBody protected ResponseEntity&lt;Object&gt; handleNotFound(final RuntimeException ex, final WebRequest request) { final String bodyOfResponse = ex.getMessage(); return handleExceptionInternal(ex, bodyOfResponse, new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request); } } public class CustomRestException extends RuntimeException { public CustomRestException() { super(…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23039816
type: Question
tagged with: spring-mvc
tagged with: spring-boot
tagged with: java
score: 0
answer count: 2
has title: Error message in URL using Spring REST

http://stackoverflow.com/comment/35144064
has text: You have a problem with your read loop starting line 182 (and which is in the extract above): you don't grab the number of bytes which were actually written. You should `int count; while ((count = bzstream.read(bytes)) != -1) xmlFile.write(bytes, 0, count);`
comment on: http://stackoverflow.com/q/23006515
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23009963
upvote count: 4
answers question: http://stackoverflow.com/q/23009891
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23009891
type: AcceptedAnswer
score: 4
type: Answer
has body: getContext() Returns the context the view is currently running in. . Activity. getBaseContext() : If you need access to a Context from within another context, you use this

http://stackoverflow.com/comment/35123411
type: AnswerComment
comment on: http://stackoverflow.com/a/22997096
has text: And now you just taught me a Java syntax I didn't know about.
type: Comment
score: 0

http://stackoverflow.com/comment/35194280
type: AnswerComment
comment on: http://stackoverflow.com/a/23036083
type: Comment
has text: So your R.layout.rss does contain an EditText with id SearchBox?
score: 0

http://stackoverflow.com/q/22989412
has comment: http://stackoverflow.com/comment/35142329
has answer: http://stackoverflow.com/a/22989636
has title: How can I solr case insensitive search for a Text data
tagged with: java
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/8240329
tagged with: solrj
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22990742
has comment: http://stackoverflow.com/comment/35834946
tagged with: solr
has comment: http://stackoverflow.com/comment/35397530
has body: I have used solr4.7 and I have multiple record in DB , I have search successfully for case sensitive data that is lowercase. I have lots of try to solve this , I am very tired, my one of the code is schema.xml file code as below <schema name="springExample" version="1.5"> <field name="name" type="text_general" indexed="true" stored="true" required="true" /> <tokenizer class="solr.WhitespaceTokenizerFactory" /> <filter class="solr.LowerCaseFilterFactory" /> <tokenizer class="solr.WhitespaceTokenizerFactory" /> <filter class="solr.LowerCaseFilterFactory" /> and also configure the config.xml file for dataSource and document. <dataSource driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/koupon" user="root" password="root" /> <field column="name" name="name"/> and java code for Fetching Specific data like that solrParams = new ModifiableSolrParams(); solrParams.add("q","name:TE*"); solrParams.add("wt","json"); solrParams.add("indent","true"); queryResponse = server.query(solrParams); solrParams.clear(); System.out.println(queryResponse.getResults()); and I am searching for 'name' field like Testing Category,Testing, TEst. How can I solve this?
type: Question

http://stackoverflow.com/q/23094674
score: 0
has title: Can't add target Android version for Android Project in Eclipse
answer count: 1
has body: I just had this happen to me while importing a project from existing code and I didn't see the answer here. I hope someone finds this helpful. I was getting '...cannot be resolved...' errors as if I was missing the Android SDK even though I had it installed. Lots of them pertained to 'android.*' imports. Adding the .jar files to the build path did not resolve the issue either. I then went to 'MY_PROJECT' > Properties > Android and found that Eclipse ignored me when I selected a target version and clicked 'Apply'. There were no errors, but nothing happened.
tagged with: android
accepted answer: http://stackoverflow.com/a/23094675
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23094675

http://stackoverflow.com/comment/35338873
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23115419
type: Comment
has text: add a break point on start of onCreate method then start your app in debug mode then check is your pushMe button is null or you getting some other object null on that you trying to perform some action.

http://stackoverflow.com/a/23015910
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23015778
upvote count: 3
score: 3
has body: You should consider SimpleDateFormat date and time patterns: link For example, something like this: formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
answers question: http://stackoverflow.com/q/23015778

http://stackoverflow.com/comment/35144994
type: Comment
has text: @Ramakrishnan: Does not compute. Need more input.
comment on: http://stackoverflow.com/a/23006169
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35123209
type: AnswerComment
has text: @TedHopp then what is `obj4` supposed to be? Whatever you want it to be, define it in a new line.
type: Comment
comment on: http://stackoverflow.com/a/22997096
score: 0

http://stackoverflow.com/q/22980579
type: AnsweredQuestion
tagged with: jsf
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22982719
answer count: 1
has title: How to clear form fields and rerender form with RichFaces
tagged with: richfaces
has body: I'm stuck at pretty simple task: I have a search form where the search criteria are stored is SearchCriteriaSession bean, so it could be remembered and pre-filled. And I want to add reset button to that form that would: 1) clear the criteria from bean, therefore call clearSearchCriteria() method of the bean 2) rerender the form, so the fields would be empty Here's my code and I have no idea why it's not working: search.xhtml ... <h:form id="criteriaForm"> <h:inputText type="text" id="testName" value="#handlingBean.criteria.testName}" /> //more input fields but with same format <r:commandButton action="#searchCriteriaSession.clearSearchCriteria}" value="Reset" render="@form :criteriaForm" /> </h:form> ... The searchCriteriaSession.clearSearchCriteria just clears criteria. When I debug it I see it correctly cleared. Even when I refresh the page the form clears, so the problem is that the render attribute is not working correctly, I guess. Does anybody can please help me? P.S.: I'm using RichFaces, this maven artifact: org.richfaces.compat richfaces-components-rich 4.5.0.Alpha2
accepted answer: http://stackoverflow.com/a/22982719

http://stackoverflow.com/q/23110334
answer count: 3
possible better answer: http://stackoverflow.com/a/23110766
tagged with: replaceall
downvote count: 0
has title: Regex to check for all letters in the alphabet
favorite count: 0
has comment: http://stackoverflow.com/comment/35326788
has comment: http://stackoverflow.com/comment/35326948
has comment: http://stackoverflow.com/comment/35327036
upvote count: 2
accepted answer: http://stackoverflow.com/a/23110953
has answer: http://stackoverflow.com/a/23110888
tagged with: regex
type: AnsweredQuestion
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35327049
type: Question
has comment: http://stackoverflow.com/comment/35326689
tagged with: expression
has answer: http://stackoverflow.com/a/23110953
has comment: http://stackoverflow.com/comment/35327504
has answer: http://stackoverflow.com/a/23110766
has comment: http://stackoverflow.com/comment/35326896
has body: I'm currently brushing up on my coding skills and working through some easy problems I've found online. The particular task is to input a txt file that contains any number of lines, and to have the program check each line and return "True" or "False" depending on whether that line contains all 26 letters of the alphabet. I feel like I'm almost finished, but my regular expression to match the string to [a-z] returns false no matter what I do. I've tried changing the string to lowercase, removing spaces, and nothing seems to work. Here's a link to the project as well. The text I have in my text file currently is "The quick brown fox jumps over the lazy dog." package easy139; import java.io.FileReader; import java.io.IOException; import java.util.Scanner; import java.util.regex.Pattern; import java.util.regex.Matcher; public class easy139 { public static void main(String[] args) { try { Scanner in = new Scanner(new FileReader("input.txt")); while (in.hasNextLine()) { String line = in.nextLine(); System.out.println(line); String noSpaces = line.replaceAll(" ",""); if (noSpaces.matches("[a-z]")) { System.out.println("True"); } else { System.out.println("False"); } } in.close(); } catch (IOException e) { } } }

http://stackoverflow.com/a/23057585
accepted answer of: http://stackoverflow.com/q/22968893
answers question: http://stackoverflow.com/q/22968893
type: Answer
has body: After googling I got the answer to my question. This article is very helpful to understand how merging in maven wokrs. Very helpful command mvn help:effective-pom fired form parent level. Basically for my question the answer is. The parent pom will have configuration defined in profile, but when we define in profile configuration for plugin in tag &lt;pluginManagement&gt; it will be inherited to all children(even if they do not define their plugin configuration in profile, but they define it in simple plugin ->configuration space in default build tag) and merged with theirs configuration according to above article and strategy that we apply in children's poms. I home it will someday help somebody with the same issue.
score: 0
type: AcceptedAnswer

task
type: Tag
tags question: http://stackoverflow.com/q/22971222
tag name: task

http://stackoverflow.com/q/23080805
has comment: http://stackoverflow.com/comment/35275758
tagged with: java
type: Question
tagged with: blob
has title: java blob to byte array conversion error issue
score: 0
has comment: http://stackoverflow.com/comment/35275004
has comment: http://stackoverflow.com/comment/35275429
has comment: http://stackoverflow.com/comment/35274868
type: UnansweredQuestion
has body: I am getting error in converting. We are using hibernate here. Please suggest how we can resolve the issue.. blob = (Blob) resultList.get(i); int blobLength = (int) blob.length(); topublishedFile = blob.getBytes(1, blobLength); The error which we are getting is as follows. 2014-04-15 15:34:54,880 INFO DB2Interceptor.onPrepareStatement - IN INTERCEPTOR CLASS [4/15/14 15:34:54:881 IST] 00000025 SystemOut O Hibernate: select STD_BLOB_PDF FROM estd.tbadress where std_number = ? with ur for fetch only [4/15/14 15:39:47:515 IST] 00000025 SystemErr R com.ibm.db2.jcc.b.SqlException: [jcc][10120][11936][3.50.152] Invalid operation: Lob is closed. ERRORCODE=-4470, SQLSTATE=null [4/15/14 15:39:47:515 IST] 00000025 SystemErr R at com.ibm.db2.jcc.b.wc.a(wc.java:55) [4/15/14 15:39:47:515 IST] 00000025 SystemErr R at com.ibm.db2.jcc.b.wc.a(wc.java:93) [4/15/14 15:39:47:515 IST] 00000025 SystemErr R at com.ibm.db2.jcc.b.rd.d(rd.java:67) [4/15/14 15:39:47:515 IST] 00000025 SystemErr R at com.ibm.db2.jcc.b.rd.r(rd.java:56) [4/15/14 15:39:47:515 IST] 00000025 SystemErr R at com.ibm.db2.jcc.b.rd.length(rd.java:41)
answer count: 0

http://stackoverflow.com/q/23035619
type: Question
has answer: http://stackoverflow.com/a/23035683
has answer: http://stackoverflow.com/a/23035737
has answer: http://stackoverflow.com/a/23035677
tagged with: dictionary
score: 0
has body: Map&lt;String, Integer&gt; successors = new HashMap &lt;String, Integer&gt; (); // I have added some elements into the successors. Collection&lt;Integer&gt; uniqueValues = successors.values(); Is there a way for me to find out in java if uniqueValues can show me that all the values in it are the same? I planned on using the if(uniqueValues.contains(1))statement. But I just could not figure it out. Since this statement will say true if 1 is present and other values different from 1 are also present. I just want it to return true if 1 is the only value in the collections. eg; {1,1,1,1,1,1,1,1,1,1,1,1,1} should return true. But {1,2,1,3,1,4,2,4,22,1,1,1,4} should return false. Some code along the lines of "Contains if and only if." This will be of great help. Thanks in advance.
tagged with: java
tagged with: collections
tagged with: hashmap
type: UnansweredQuestion
answer count: 3
has title: Contains if and only if in the Collection class- Java
has comment: http://stackoverflow.com/comment/35193210

http://stackoverflow.com/comment/35311336
has text: Prove? There is a language specification. Multiple inheritance is not in there.
type: QuestionComment
comment on: http://stackoverflow.com/q/23101389
score: 10
type: Comment

http://stackoverflow.com/q/23061528
accepted answer: http://stackoverflow.com/a/23061939
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/10740021
upvote count: 1
answer count: 1
has body: Hi i am try to develop spring and hibernate app with transactions , i am using spring 4.x and hibernate 4.x , here is my code snippet applicationContext.xml <tx:annotation-driven /> <context:annotation-config /> <context:component-scan base-package="com.xyx.service" /> <context:component-scan base-package="com.xyz.dao" /> <import resource="conf/spring/persistence.xml" /> servlet-context.xml <context:component-scan base-package="com.xyx.webservice.components" /> <mvc:annotation-driven /> persistance.xml org.hibernate.dialect.MySQLDialect true false </beans> and finnaly meservice look like this @Transactional(propagation=Propagation.REQUIRED,rollbackFor=RuntimeException.class) public Object loadCategories(UserContactsInputVO inputVo) { User user= getUserObject(inputVo); userDAO.saveOrUpdateForTrancasction(user); System.out.println(user.getUserId()); //getAudioFilesBasedOnCategories(); try{ return getAudioFilesBasedOnCategories(); }catch (RuntimeException e) { e.printStackTrace(); } return new CategoryResponseVo(); } and @Transactional(propagation=Propagation.REQUIRED) public CategoryResponseVo getAudioFilesBasedOnCategories() { try{ if(true) throw new RuntimeException(); }finally{ } return vo; } here runtime exception occurs but db records are not rolled backed.
has answer: http://stackoverflow.com/a/23061939
type: AnsweredQuestion
has title: spring transaction not working?
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/comment/35303207
type: Comment
type: QuestionComment
has text: If you provide the body of the `listAll()` method, we might be able to give you more specific help.
comment on: http://stackoverflow.com/q/23096163
score: 0

http://stackoverflow.com/comment/35336921
has text: @PrathikPuthran, The given solution works for the input you provided, but if you require a space before the word to make sure it is sitting alone, that is still cheaper computationally than a regex.
type: Comment
comment on: http://stackoverflow.com/a/23098679
score: 0
type: AnswerComment

http://stackoverflow.com/a/23122460
has body: Issue one: The Square sometimes bounces off an edge. Other times it sinks, and I can't figure out why. You'll hate yourself for this, but } else if (yPosit &gt; height - SQUARE_SIZE) { xPosit = height - SQUARE_SIZE; xSpeed = -SPEED_OF_SQUARE; } Should be... } else if (yPosit &gt; height - SQUARE_SIZE) { yPosit = height - SQUARE_SIZE; ySpeed = -SPEED_OF_SQUARE; } You were using xPosyit and xSpeed instead of yPosyit and ySpeed... Issue two: I'm not sure how to change the color of the square when it hits the edge. Basically, whenever you detect a edge collision and change direction, simple change the panel's foreground color to something else... This might require you to have a list of colors from which you can randomly pick or simply randomly generate the color Then in your paintComponent method, simple use g.setColor(getForeground()) before you fill the rect... ...ps... To make life easier, you could just write a method that either generates a random color or sets the foreground to a random color, for example... protected void randomiseColor() { int red = (int) (Math.round(Math.random() * 255)); int green = (int) (Math.round(Math.random() * 255)); int blue = (int) (Math.round(Math.random() * 255)); setForeground(new Color(red, green, blue)); } Issue three: I'm trying to learn how to make a JFRAME fullscreen. And not just fullscreen on my screen but on anyone's. Take a look at Full-Screen Exclusive Mode API
answers question: http://stackoverflow.com/q/23122370
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 6
accepted answer of: http://stackoverflow.com/q/23122370
upvote count: 6

http://stackoverflow.com/q/23018553
tagged with: macos
favorite count: 0
has answer: http://stackoverflow.com/a/24071897
has answer: http://stackoverflow.com/a/26970589
has comment: http://stackoverflow.com/comment/35172799
has comment: http://stackoverflow.com/comment/37127134
possible better answer: http://stackoverflow.com/a/24071897
type: AnsweredQuestion
has title: Disable hidden files using FileChooser from JavaFX
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/45204511
type: Question
score: 12
upvote count: 12
accepted answer: http://stackoverflow.com/a/26970589
downvote count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35219210
has body: I'm developing a Java app using JavaFX for it's user interface. When I use the FileChooser class to load a CSV file from the computer hard drive in Os X Mavericks the dialog shows me all the files and folders, even the hidden one creating a lot of noise and making really hard to find the desired file. This screenshot illustrates what I'm talking about: I think this could be more a OS X issue, but I don't understand how to fix, at least I don't understand how I can fix it with JavaFX FileChooser class. Here's my code: Stage stage = new Stage(); FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Open File"); fileChooser.getExtensionFilters().addAll( new FileChooser.ExtensionFilter("Comma-Separated Values (CSV)", "*.csv") ); fileChooser.setInitialDirectory( new File(System.getProperty("user.home")) ); File selectedFile = fileChooser.showOpenDialog(stage); Update This is the Google Chrome modal to open files.
has comment: http://stackoverflow.com/comment/60672306

http://stackoverflow.com/q/23082539
has title: How to set the endian of a byte array in c#
answer count: 1
has body: I've got some java codes like this: ByteBuffer buffer = ByteBuffer.allocate(length * 2); buffer.order(java.nio.ByteOrder.LITTLE_ENDIAN); for (short s : data) buffer.putShort(s); How to convert it to C# code? basically, I don't know the how to work buffer.order(java.nio.ByteOrder.LITTLE_ENDIAN); out in C#. Any help is appreciate!
linked to: http://stackoverflow.com/q/9618608
tagged with: java
has comment: http://stackoverflow.com/comment/35278522
upvote count: 1
tagged with: c#
has answer: http://stackoverflow.com/a/23082796
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35278021
accepted answer: http://stackoverflow.com/a/23082796
type: Question

http://stackoverflow.com/q/23125695
type: UnansweredQuestion
has title: when i open the eclipse, there is a exception: Caused by: java.util.zip.ZipException: zip file is empty
has body: After I reinstall ubuntu, i download the eclipse from eclipce site, but when I first open the eclipse , it occur a exception. I can not find the right answer by google, so i come here for help.\
has comment: http://stackoverflow.com/comment/35355937
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35355007
score: 0
has comment: http://stackoverflow.com/comment/35355635
answer count: 0

http://stackoverflow.com/a/23058416
has comment: http://stackoverflow.com/comment/35235030
type: Answer
has body: Named windows start empty and the "create window OrderEventWindow.win:keepall() as OrderEvent" just defines the type of the rows in the named window, in your case they are the same row type as OrderEvent. You'd want to insert all order events into the named window using "insert into OrderEventWindow select * from OrderEvent" if that is what you want to insert.
downvote count: 0
answers question: http://stackoverflow.com/q/23057480
score: 1
accepted answer of: http://stackoverflow.com/q/23057480
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/23126783
score: 2
has comment: http://stackoverflow.com/comment/35357566
has comment: http://stackoverflow.com/comment/35356954
has comment: http://stackoverflow.com/comment/35357087
has comment: http://stackoverflow.com/comment/35356983
answers question: http://stackoverflow.com/q/23126689
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/35357038
type: Answer
has body: You really want to use new to allocate that memory before you start using references. I also think you can do away with the x = x and x = 1; then you can stop your loop with a break. That should be quicker. Something like for (int y = 2; y &lt; x; y++) if (x % y == 0) { result = true; break; } How to find number of prime numbers between two integers

http://stackoverflow.com/comment/86891452
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23058748
has text: Consider using MediaType.APPLICATION_OCTET_STREAM.
type: AnswerComment

http://stackoverflow.com/a/75904037
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23107944
has body: If u want to open session each action(CRUD) u should put Session session = sessionFactory.openSession() in try catch like this : Try(Session session = sessionFactory.openSession()) , then session will auto close whenever it done the job, this may basic concept but it took me 1 hour to figure out

http://stackoverflow.com/comment/35341209
type: QuestionComment
has text: How could you run GoolgeMap v2 on the emulator becouse it's not supported at all!!!!
comment on: http://stackoverflow.com/q/23117749
score: 0
type: Comment

http://stackoverflow.com/comment/35344018
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23109549
has text: No its not about oauth2. Hes showing a google page in an iframe and for that there is no need for oauth. Not sure how you detect the logged-out situation but for sure you wont be able to iframe the google login page for security reasons (when you type your google password google wants you to see the window url starts with a google domain)

http://stackoverflow.com/comment/35274970
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23080673
type: AnswerComment
has text: This is not the case here, although it works, it complicates the case with regex - specific operator

http://stackoverflow.com/a/23116690
answers question: http://stackoverflow.com/q/23116086
accepted answer of: http://stackoverflow.com/q/23116086
upvote count: 5
has body: In other programming languages, there is some kind of zip function, that takes several iterables, and returns an iterator that aggregates elements from each of the iterables. See for example the function zip in the Python Library. Although it would be possible to make a similar function in Java, it's hard to implement it in such a way, that it supports efficient parallel execution. However, there is a commonly used pattern in Java, that is a bit different. In your case, it might look as follows: public static double covariance(double[] xs, double[] ys) { double xmean = mean(xs); double ymean = mean(ys); return IntStream.range(0, Math.min(xs.length, ys.length)) .parallel() .mapToDouble(i -&gt; { double numerator = (xs[i] - xmean) * (ys[i] - ymean); double denominator = ...; return numerator / denominator; }) .sum(); } Instead of combining two streams, you create an IntStream with all indexes, and you access the elements of the different collections by index. That works pretty well as long as the collections support random access operations.
has comment: http://stackoverflow.com/comment/35341236
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35341553
type: Answer

http://stackoverflow.com/comment/35076409
comment on: http://stackoverflow.com/q/22971158
score: 0
has text: Have you tried doing `System.out.println(descriptionText);` just before setting the label text to see if that string contains what you expect? Also try putting the result of the `format` call into a String variable so you can print that out for confirmation also.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/31392215
type: Answer
has body: Jersey (jax-rs) is a very solid alternative to ASP.NET Web API in the Java World. Jersey RESTful Web Services framework is open source, production quality, framework for developing RESTful Web Services in Java... It's an annotation based approach to the problem. I think it's a very well thought and productive environment. You can customize all sorts of stuff and that contains sane defaults.
upvote count: 5
score: 5
answers question: http://stackoverflow.com/q/23057456
downvote count: 0

http://stackoverflow.com/a/23106197
score: 0
answers question: http://stackoverflow.com/q/23104274
type: Answer
has comment: http://stackoverflow.com/comment/35323017
has body: Refer the link Hibernate Auto Increment ID You can use GenerationType.AUTO to create . For details refer link above

http://stackoverflow.com/a/23114857
accepted answer of: http://stackoverflow.com/q/23078954
score: 3
upvote count: 3
has body: Based on what I found in the unit test code here, the following sample code seems to work. It exports only the first three (3) columns of the table named [Members]: package jackcessTest; import java.io.File; import java.util.*; import com.healthmarketscience.jackcess.*; import com.healthmarketscience.jackcess.util.ExportFilter; import com.healthmarketscience.jackcess.util.ExportUtil; import com.healthmarketscience.jackcess.util.SimpleExportFilter; public class JackcessTest { public static void main(String[] args) { try (Database db = DatabaseBuilder.open( new File("C:/Users/Public/mdbTest.mdb"))) { ExportFilter eFilter = new SimpleExportFilter() { private List&lt;Column&gt; _cols = new ArrayList&lt;Column&gt;(); private int _colIdx = 0; @Override public List&lt;Column&gt; filterColumns(List&lt;Column&gt; columns) { for (Column c : columns) { if (_colIdx++ &lt; 3) _cols.add(c); } return _cols; } }; ExportUtil.exportFile( db, "Members", new File("C:/Users/Public/zzzJdump.csv"), true, ",", '"', eFilter); } catch (Exception e) { e.printStackTrace(System.out); } } }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23078954
has comment: http://stackoverflow.com/comment/35359666
type: Answer

http://stackoverflow.com/comment/35284123
has text: I never claimed to be civilized, yet I explain my downvotes. Besides, I didn't delete it, I was just trying to find out how it disappeared.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23085665

http://stackoverflow.com/q/23054032
type: Question
tagged with: java
score: 0
has title: How to fetch data from another website?
answer count: 1
tagged with: selenium-webdriver
type: AnsweredQuestion
has body: I am trying to fetch data from a web site and I am able to do this but my problem is that when I fetch data of different commodity from site then I have to change every time in my code and I want to fetch data of following commodity at once how can I achieve my output commodity 'Rice' 'Jwar' 'Corn' 'Matar' 'Chana' Here is my code import com.gargoylesoftware.htmlunit.BrowserVersion; import java.util.StringTokenizer; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; import org.openqa.selenium.support.ui.Select; public class Getdata1 { public static void main(String args[]) throws { int j=0; WebDriver driver = new HtmlUnitDriver(BrowserVersion.getDefault()); String sDate = "27/03/2014"; String commodity="Jo"; String url="http://www.upmandiparishad.in/commodityWiseAll.aspx"; driver.get(url); Thread.sleep(5000); new Select(driver.findElement(By.id("ctl00_ContentPlaceHolder1_ddl_commodity"))).selectByVisibleText(commodity); driver.findElement(By.id("ctl00_ContentPlaceHolder1_txt_rate")).sendKeys(sDate); Thread.sleep(3000); driver.findElement(By.id("ctl00_ContentPlaceHolder1_btn_show")).click(); Thread.sleep(5000); WebElement findElement = driver.findElement(By.id("ctl00_ContentPlaceHolder1_GridView1")); // WebElement find=driver.findElement(By.id("ctl00_ContentPlaceHolder1_ddl_commodity")); String htmlTableText = findElement.getText(); htmlTableText=htmlTableText.replace("S.No.DistrictMarketPrice",""); htmlTableText= htmlTableText.replaceAll("\\s(\\d+\\s[A-Z])", "\n$1"); htmlTableText = htmlTableText.replaceAll("(?=(.*?[ ]){4,}).*?[\n\r]", ""); System.out.println(htmlTableText); driver.close(); driver.quit(); } }
has answer: http://stackoverflow.com/a/23054102
accepted answer: http://stackoverflow.com/a/23054102
tagged with: selenium
linked to: http://stackoverflow.com/q/21194057

swagger-ui
tag name: swagger-ui
type: Tag
tags question: http://stackoverflow.com/q/23128303

http://stackoverflow.com/q/23038570
has comment: http://stackoverflow.com/comment/35199851
tagged with: cmd
has answer: http://stackoverflow.com/a/23038771
tagged with: processbuilder
tagged with: windows
has answer: http://stackoverflow.com/a/23038592
type: UnansweredQuestion
tagged with: java
has title: Creating a Java program to compile a source file using cmd
type: Question
has body: I am working on something which requires me to use cmd for compiling my source files. I am a java novice i have been trying to find out a way to compile my source files using cmd as we know that we can compile, see output and errors on cmd. A lot of search and efforts have brought me on the conclusion that using ProcessBuilder class i can manipulate running cmd. I need a bit guidance on the process through which i am able to make a Java program which can command compilation, read output and errors back. I have been thinking of reading and writing from cmd, if there is any other way more efficient than this, please do guide.
tagged with: compilation
has answer: http://stackoverflow.com/a/23041206
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35198699

http://stackoverflow.com/q/23103347
has title: How to set attributes in URL to call a servlet in gwt + java?
type: Question
has comment: http://stackoverflow.com/comment/35314986
has answer: http://stackoverflow.com/a/23103709
tagged with: servlets
score: 0
answer count: 1
tagged with: download
tagged with: gwt
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23103709
tagged with: java
has body: I want to open a file stored on server on click of a button on client side. On click handler I added code- String url="../../downloadServlet?fileName="+fileN+"?recodId="+recoId; Window.open(url, "", ""); In this url , I want to add 2 diffrent parameters- FileName and RecordId. Above implementation is not working for this. How can i pass more parameters in a request? Thanks

http://stackoverflow.com/comment/35333838
has text: Very good point, @forgivenson. I cannot believe how much Eclipse has increased my productivity. At first I was worried about the learning curve, but it has paid off sooooo many times over, it's unreal! Definitely a must-have. I would be very frustrated if I ever had to do without it again... (Aside: IntelliJ or NetBeans are probably equivalent. I ended up choosing Eclipse more by accident as GWT was built for it.)
type: Comment
comment on: http://stackoverflow.com/a/23113997
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35219465
comment on: http://stackoverflow.com/q/23050097
score: 4
type: Comment
type: QuestionComment
has text: You can use lambda expressions as a replacement for anonymous inner class implementations that use *functional interfaces*. Functional interfaces can only have one explicitly declared abstract method.

testng
tags question: http://stackoverflow.com/q/23116556
tags question: http://stackoverflow.com/q/23085971
tags question: http://stackoverflow.com/q/23095382
tags question: http://stackoverflow.com/q/22995038
tag name: testng
tags question: http://stackoverflow.com/q/22996542
type: Tag

http://stackoverflow.com/comment/35210583
type: QuestionComment
has text: Ok, I made a jar-file and it works when I run it on my computer but when i want to run it on my html-file I get a RuntimeException, do you know why?
comment on: http://stackoverflow.com/q/23045017
score: 0
type: Comment

eofexception
tags question: http://stackoverflow.com/q/23078119
tags question: http://stackoverflow.com/q/23064917
type: Tag
tag name: eofexception

http://stackoverflow.com/q/23039281
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has body: I am new in cordova 3.4. I want to write send sms app. I get SMSPlugin from github but i want to write this myself. I write a html file like this and copy in root/www and i write a java script file in root/www/js. but when i run the app, i don't see button in the page! Why? What is problem? How can i write this app? And i change name of java file(Activity) from AndroidManifest manually to my class, this is not a problem, Yes? and i changed 'id' in widget tag from config.xml to my package manually. index.html: Hello World Plugin Example DeviceInfo.js: var DeviceInfo = function () { }; DeviceInfo.callMethod = function (methodName, content, success, fail) { return PhoneGap.exec(function (args) { success(args); }, function (args) { fail(args); }, 'DeviceInfo', methodName, [content]); } DeviceInfo.GetPhoneNumber = function (content, success, fail) { return DeviceInfo.callMethod('getPhoneNumber', content, success, fail); }; DeviceInfo.SendSMS = function (content, success, fail) { return DeviceInfo.callMethod('SendSMS', content, success, fail); }; DeviceInfo.SendConsole = function (content, success, fail) { return DeviceInfo.callMethod('SendConsole', content, success, fail); }; Thanks for advises
answer count: 1
downvote count: 0
has title: Send sms in Cordova 3.4
has answer: http://stackoverflow.com/a/23041035
tagged with: android
tagged with: http://stackoverflow.com/tag/html
favorite count: 0
tagged with: cordova
upvote count: 1
accepted answer: http://stackoverflow.com/a/23041035

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/23083606
tags question: http://stackoverflow.com/q/23045017
tags question: http://stackoverflow.com/q/23000791
tags question: http://stackoverflow.com/q/23005424
tags question: http://stackoverflow.com/q/23112753
tags question: http://stackoverflow.com/q/22976378
tags question: http://stackoverflow.com/q/23103804
tags question: http://stackoverflow.com/q/23001910
tags question: http://stackoverflow.com/q/23063175
tags question: http://stackoverflow.com/q/23123345
tags question: http://stackoverflow.com/q/23005392
tags question: http://stackoverflow.com/q/22985909
tags question: http://stackoverflow.com/q/22984521
type: Tag
tags question: http://stackoverflow.com/q/23002479
tags question: http://stackoverflow.com/q/23029749
tags question: http://stackoverflow.com/q/22971158
tags question: http://stackoverflow.com/q/23012795
tags question: http://stackoverflow.com/q/23023010
tags question: http://stackoverflow.com/q/23096881
tags question: http://stackoverflow.com/q/23114806
tags question: http://stackoverflow.com/q/23075673
tags question: http://stackoverflow.com/q/23009268
tags question: http://stackoverflow.com/q/22982635
tags question: http://stackoverflow.com/q/23120971
tags question: http://stackoverflow.com/q/23121059
tags question: http://stackoverflow.com/q/23039281
tags question: http://stackoverflow.com/q/23017620
tags question: http://stackoverflow.com/q/23057561
tags question: http://stackoverflow.com/q/23082392
tags question: http://stackoverflow.com/q/23003271
tags question: http://stackoverflow.com/q/23022083
tags question: http://stackoverflow.com/q/22994647
tags question: http://stackoverflow.com/q/23124499
tags question: http://stackoverflow.com/q/23023213
tags question: http://stackoverflow.com/q/23045566
tags question: http://stackoverflow.com/q/23048048
tags question: http://stackoverflow.com/q/23011934
tags question: http://stackoverflow.com/q/23075000
tags question: http://stackoverflow.com/q/23099950
tag name: html
tags question: http://stackoverflow.com/q/22992602
tags question: http://stackoverflow.com/q/23122608
tags question: http://stackoverflow.com/q/23092767
tags question: http://stackoverflow.com/q/23053426
tags question: http://stackoverflow.com/q/23128121
tags question: http://stackoverflow.com/q/23100688
tags question: http://stackoverflow.com/q/23038388
tags question: http://stackoverflow.com/q/23050210
tags question: http://stackoverflow.com/q/23058650

http://stackoverflow.com/a/23007279
has body: In XML, &lt; and > characters are reserved for XML tags. You will need to protect them by replacing them with special encoding characters. You can use &amp;gt; for > and &amp;lt; for &lt; (edit) Eomm answer is right, CDATA does this as well, and more simple Also, to use HTML coding in TextView, you will need to use Html.fromHtml() method For instance : tarifa2.setText(Html.fromHtml(builder.toString()));
has comment: http://stackoverflow.com/comment/35142651
has comment: http://stackoverflow.com/comment/35141440
has comment: http://stackoverflow.com/comment/35142055
has comment: http://stackoverflow.com/comment/35141382
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35142013
answers question: http://stackoverflow.com/q/23006506
has comment: http://stackoverflow.com/comment/35141679

http://stackoverflow.com/comment/35337939
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23115927
has text: Any idea on how to get the encoding of byteArray obtained by doing a string.getBytes() ?
score: 0

http://stackoverflow.com/a/58966810
downvote count: 0
has body: tl;dr Use modern java.time class LocalDate. LocalDate.of( 2020 , Month.MARCH , 25 ).plusDays( 1 ) Avoid legacy date-time classes You are using the terrible date-time classes that were years ago supplanted by the modern java.time classes. java.time.LocalDate Seems you only care about the date, not the time-of-day nor time zone. So use the LocalDate class. ZoneId z = ZoneId.of( "America/Montreal" ) ; LocalDate today = LocalDate.now( z ) ; Add days. LocalDate tomorrow = today.plusDays( 1 ) ; LocalDate dayAfterTomorrow = tomorrow.plusDays( 1 ) ; Collect in a list. List&lt; LocalDate &gt; dates = new ArrayList&lt;&gt;( 3 ) ; dates.add( today ) ; dates.add( tomorrow ) ; dates.add( dayAfterTomorrow ) ; Or use new List.of for a non-modifiable list. List&lt; LocalDate &gt; dates = List.of( today , tomorrow , dayAfterTomorrow ) ; If you want to start with a specific day, use the LocalDate.of factory methods. LocalDate localDate = LocalDate.of( 2020 , Month.MARCH , 25 ) ; Then proceed with your date math. for( int i = 0 ; i &lt; 7 ; i ++ ) { list.add( localDate.plusDays( i ) ) ; } 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 Most of the java.time functionality is back-ported to Java 6 &amp; 7 in ThreeTen-Backport. Android La…
answers question: http://stackoverflow.com/q/23112915
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/23018796
type: Question
tagged with: hidden
tagged with: javascript
has comment: http://stackoverflow.com/comment/35164394
score: 0
has comment: http://stackoverflow.com/comment/35173523
has body: Good Morning all. I have an issue that I am trying to solve but I am stuck, partially due to me not having a full understanding of JSP/ Java platform, and not having a full understanding of what/ how to implement my code in the right way. I do have an ASP background, so I am a bit familiar with some concepts. The issue I am running into is: I am trying to populate a dynamic label and text box to appear on a webpage (JSP). I have successfully been able to populate the textboxes with a piece of JavaScript code, however, when I submit the form (on Postback) my dynamic controls are gone but all of my static controls are still present. I need to find a way to keep my information in the dynamic control on submit as well. The form does not submit when I have errors but when the form finish rendering all information and dynamic text are all lost. My Solution: I have decided to use hidden fields to hold this information but I am unable to fire off the hidden fields after form submit: Please have a look below First Name Eligible Not Eligible Other: What I am trying to do is select the "Not Eligible" option and type some text in the text box 'mytext' then press submit. Once I press submit, and if the First Name textbox is not filled in, then I want to trigger my hidden textbox so that I won't loose my information in my dynamically created textbox. I hope this makes sense. I am not sure of how to do in JSP. Can someone give guidance on how to get my expected results? Keeping dynamic controls after Postback? Thanks in advance.
answer count: 1
has title: How to keep dynamicly added controls ater postback? Javascript, JSP
tagged with: jsp
has answer: http://stackoverflow.com/a/23019788
accepted answer: http://stackoverflow.com/a/23019788
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/23038811
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: How about java.util.regex, will this cache the compiled patterns? Not in Java 6 or 7 ... according to the source code. My memory was that the static Pattern.compile(...) methods did implement a small cache, but presumably that feature was removed in / by Java 6. If you want to implement Pattern caching in Java, you can do it yourself in a variety of ways. (Alternatively, Googling for "java regex cache" gave me some useful hits ...)
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23038502
answers question: http://stackoverflow.com/q/23038502

http://stackoverflow.com/comment/35466208
has text: This would be better as: list.stream().min(Comparator.comparingInt(Obj::getField))
score: 5
comment on: http://stackoverflow.com/a/23109899
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23047200
type: Question
has title: Convert String To Java.sql.Date
tagged with: java
tagged with: date
has body: After looking through many of the threads in stackoverflow and cant seem to find the correct method im looking for. If anyone could shine a bit of light it would be great. So I populated a JCombo Box with SQL Dates but in doing so I formatted them to using SimpleDateFormat which converted them into a string with the format dd/MM/yyyy. When the program is running he can select a certain date to query the database and so here the problem Ive managed to make a String with a format of yyyy/MM/dd using string.split saving it into an array and ordering them in another string Is There A Way To Convert This String (2014/04/13) into an SQL Date so I can query my database OR am I going about it incorrect Thank You,
answer count: 3
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23047233
tagged with: string
favorite count: 0
tagged with: jdbc
upvote count: 2
has answer: http://stackoverflow.com/a/23047232
type: UnansweredQuestion
tagged with: mysql
has answer: http://stackoverflow.com/a/53313114

http://stackoverflow.com/q/23050564
score: 0
has title: how to return the original value first?
answer count: 1
accepted answer: http://stackoverflow.com/a/23050601
tagged with: java
has answer: http://stackoverflow.com/a/23050601
type: AnsweredQuestion
has body: How can I return the value I input when I first call stream.next()? &gt; StringStream stream= new StringStream("pez"); &gt; stream.next() "pfa" &gt; stream.next() "pfb" for instance, when I first call stream.next(), it should be "pez",and "pfa" should appear until the second time I call stream.next(). import java.io.*; //the class produces a continuous sequence of strings that consist of lower case letters. public class StringStream extends stream { //@param FirtsV is the first value we input private String FirstV; //the constructor that represents the first value returned by the stream. public StringStream(String FirstV) { this.FirstV = FirstV; } //the method returns the next value of the stream. public String next() { StringBuilder sb = new StringBuilder(FirstV); int l = sb.length(); if(sb.charAt(l-1) &lt; 'z') { sb.setCharAt(l-1, (char)(sb.charAt(l-1) + 1)); FirstV = sb.toString(); }else{ if(sb.charAt(l-1) == 'z') { sb.setCharAt(l-1, 'a'); sb.setCharAt(l-2, (char)(sb.charAt(l-2) + 1)); FirstV = sb.toString(); } } return FirstV; } @Override public String data() { return FirstV; } }
type: Question

http://stackoverflow.com/comment/48391015
type: Comment
score: 2
has text: Here is similar question http://stackoverflow.com/questions/30130720/method-overload-ambiguity-with-java-8-ternary-conditional-and-unboxed-primitives/30137369#30137369
type: AnswerComment
comment on: http://stackoverflow.com/a/23030789

http://stackoverflow.com/q/23042675
answer count: 2
accepted answer: http://stackoverflow.com/a/23730781
downvote count: 0
possible better answer: http://stackoverflow.com/a/23054469
tagged with: uirepeat
has title: Why does <ui:repeat> not work with java.util.Iterator?
favorite count: 0
has body: Why does JSF2/Facelet's ui:repeat not accept java.util.Iterator's for value? One can hide so much implementation and memory conservation behind an Iterator since length need not be known, it would be so useful to have. But instead I need to convert my Iterators to Lists and throw away all my advantages in order to ui:repeat. There are probably phase or timing or Serializable reasons, but my skimming of the docs that are available do not give those reasons. Do we not yet have the science to make this impossibility possible?
has answer: http://stackoverflow.com/a/23730781
type: AnsweredQuestion
tagged with: facelets
tagged with: jsf
has answer: http://stackoverflow.com/a/23054469
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: jsf-2

http://stackoverflow.com/comment/35271246
has text: You should show your configuration anyway. The StackTrace says: **Ensure you have used @EnableWebSecurity and @Configuration**. `demo.Application` and others config classes.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23077137

http://stackoverflow.com/comment/35315440
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23103694
has text: See this discussion too: [Are static methods inherited in Java?](http://stackoverflow.com/questions/10291949/are-static-methods-inherited-in-java). This disagrees with your final paragraph.
type: AnswerComment

http://stackoverflow.com/a/23002484
answers question: http://stackoverflow.com/q/23002372
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: If the file is in the desktop, then the path must be specified relative to the current user's home directory, like this: /Users/&lt;user&gt;/Desktop/ReadData.xls Where &lt;user&gt; is your user name in the Mac. Or alternatively, you can use this shorter form: ~/Desktop/ReadData.xls

http://stackoverflow.com/a/23512333
has comment: http://stackoverflow.com/comment/36061705
has comment: http://stackoverflow.com/comment/63203072
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36410205
type: Answer
has body: I have managed it to work, any recalculations can happen only after transition is stopped so we cannot set its cycleCount to Timeline.INDEFINITE. My requirement was that I could change text inside component so there are fxml wirings: @FXML private Text node; // text to marquee @FXML private Pane parentPane; // pane on which text is placed The code which works is: transition = TranslateTransitionBuilder.create() .duration(new Duration(10)) .node(node) .interpolator(Interpolator.LINEAR) .cycleCount(1) .build(); transition.setOnFinished(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent actionEvent) { rerunAnimation(); } }); rerunAnimation(); where rerunAnimation() is: private void rerunAnimation() { transition.stop(); // if needed set different text on "node" recalculateTransition(); transition.playFromStart(); } and recalculateTransition() is: private void recalculateTransition() { transition.setToX(node.getBoundsInLocal().getMaxX() * -1 - 100); transition.setFromX(parentPane.widthProperty().get() + 100); double distance = parentPane.widthProperty().get() + 2 * node.getBoundsInLocal().getMaxX(); transition.setDuration(new Duration(distance / SPEED_FACTOR)); }
has comment: http://stackoverflow.com/comment/36403246
score: 5
accepted answer of: http://stackoverflow.com/q/23062430
upvote count: 5
answers question: http://stackoverflow.com/q/23062430

http://stackoverflow.com/q/22996846
has answer: http://stackoverflow.com/a/22997575
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/41959332
has answer: http://stackoverflow.com/a/71271349
has comment: http://stackoverflow.com/comment/35123674
has comment: http://stackoverflow.com/comment/35123506
has comment: http://stackoverflow.com/comment/35123552
has answer: http://stackoverflow.com/a/67303213
upvote count: 2
has body: It's been 3 hours now and I still didn't find a solution, even though I seem to have read all related questions already. I am building an Android application and I just want to create a couple of simple Unit Tests that test my basic functions. I don't need to test any Android related logic or activity features. So I have created a new directory in my solution in which I have created a new JUnit Test Case. To keep things simple my test methods are not testing much yet, but even when doing a Right Click > Run As > JUnit Test, it's not doing anything. As you can see in my screenshot the JUnit pane on the left shows my test is terminated but does not show any test that has been executed. I have created a simple Unit Test in a new Java Project and then it's working. If I repeat the same steps in a new Android Application Project it's not working. What do I need to do to run my simple Unit Tests?! Thanks! (My Compiler Compliance Level is 1.6)
type: UnansweredQuestion
has title: Why is my JUnit test not running in Eclipse?
tagged with: unit-testing
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35124394
has comment: http://stackoverflow.com/comment/35123907
tagged with: eclipse
score: 2
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/22996958
favorite count: 0
has comment: http://stackoverflow.com/comment/35123853

http://stackoverflow.com/comment/35174378
score: 0
type: Comment
type: QuestionComment
has text: You got the error because the name you said the class has is not the name that the class file actually contains -- the package name is different.
comment on: http://stackoverflow.com/q/23024734

atomic
type: Tag
tag name: atomic
tags question: http://stackoverflow.com/q/22983899
tags question: http://stackoverflow.com/q/23122321
tags question: http://stackoverflow.com/q/22980568
tags question: http://stackoverflow.com/q/23120811

http://stackoverflow.com/a/23004324
has comment: http://stackoverflow.com/comment/35136892
has comment: http://stackoverflow.com/comment/35136038
has comment: http://stackoverflow.com/comment/35137097
has comment: http://stackoverflow.com/comment/35137260
has comment: http://stackoverflow.com/comment/35136071
has comment: http://stackoverflow.com/comment/35136260
has comment: http://stackoverflow.com/comment/35137330
score: 0
has comment: http://stackoverflow.com/comment/35136561
has body: Access your all the Button click listener using single click listener and use the id of your buttons and implement each click events as below: @Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()) { case R.id.Item1Button: //write your logic break; case R.id.Item2Button: //write your logic break; case R.id.Item3Button: //write your logic break; } }
has comment: http://stackoverflow.com/comment/35136667
has comment: http://stackoverflow.com/comment/35136404
answers question: http://stackoverflow.com/q/23004068
has comment: http://stackoverflow.com/comment/35136945
type: Answer
has comment: http://stackoverflow.com/comment/35136132
has comment: http://stackoverflow.com/comment/35136724
has comment: http://stackoverflow.com/comment/35137482
has comment: http://stackoverflow.com/comment/35136774
has comment: http://stackoverflow.com/comment/35136424

http://stackoverflow.com/comment/43767161
type: Comment
has text: Ah yeah figured as much but it doesn't seem to be the problem I'm struggling with apparently ;) Thanks anyways for getting back!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23103087

http://stackoverflow.com/comment/35321183
type: QuestionComment
type: Comment
has text: ... do you not know for sure? Try getting _just_ that record. It looks like the character should be an apostrophe (`'`), contextually (I don't know what's actually encoded). Are you allowed to fix the database if there's something wrong with the data?
comment on: http://stackoverflow.com/q/23099975
score: 0

http://stackoverflow.com/comment/35182077
comment on: http://stackoverflow.com/a/23029570
has text: I want to create only one object, depending on choice of user. this will copy the content. I want to make object of other class point to the variables of first class Possible ?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35297107
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23091812
has text: @durbnpoisn The constructor _must_ be named the same as the class, as it is here. The variable `phone` is not named the same as the class and therefore there is no conflict.

http://stackoverflow.com/q/23053891
tagged with: primefaces
tagged with: java
type: Question
tagged with: jsf-2
has body: In my JSF-page i have a similar situation like this: &lt;h:form&gt; ... &lt;p:messages id="messagedId" for="messagesWidget" autoUpdate="true" /&gt; &lt;p:pickList validator="pickListValidator" ... /&gt; ... &lt;/h:form&gt; The "for"-Tag is very important and can not be removed, because i use this tag to determine the target message-widget from the backing bean. But how is it possible to determine where the pickList validator message should be shown (in this case "messagesWidget")? I could use FacesContext context = FacesContext.getCurrentInstance(); FacesMessages msg = FacesMessage(FacesMessages.SEVERITY_ERROR, "short", "long"); context.addMessage("messagesWidget", msg); inside the validator and additionally throw a ValidatorException, but in my opinion this could not be the best solution.
has answer: http://stackoverflow.com/a/23054204
tagged with: message
score: 0
tagged with: validation
answer count: 1
accepted answer: http://stackoverflow.com/a/23054204
has title: Determine the messages-widget to display validator message in JSF (Primefaces)
type: AnsweredQuestion

http://stackoverflow.com/comment/35324232
has text: Are you expecting the response to be a json response?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23108832

http://stackoverflow.com/a/23124894
score: 3
has comment: http://stackoverflow.com/comment/35353538
has comment: http://stackoverflow.com/comment/35353573
type: AcceptedAnswer
downvote count: 0
has body: You can't use super directly since it only exists inside of B. But you can do it indirectly: public B extends A { public void method1() { // B's method 1 } public void superMethod1() { super.method1(); } } So if a class uses a B variable, then they can call the superMethod1() and get A's method1. But having said this, this won't work on A variables, as your code is currently set up, not without casting. i.e., you could do: B b = new B(); b.superMethod1(); But this won't work for your set up: A a = new B(); // not without casting ((B)a).superMethod(); // ugh... ugly! AND dangerous! Note that your question, while itself not bad, suggests possibly a bad program design and code needing this has at least for me, a bad code smell.
has comment: http://stackoverflow.com/comment/35353606
has comment: http://stackoverflow.com/comment/35354481
answers question: http://stackoverflow.com/q/23124861
type: Answer
has comment: http://stackoverflow.com/comment/35353526
accepted answer of: http://stackoverflow.com/q/23124861
upvote count: 3
has comment: http://stackoverflow.com/comment/35353739
has comment: http://stackoverflow.com/comment/35353536

http://stackoverflow.com/q/23045460
has title: Edited: How can I change date format of Date object?
has body: I have created table in SQLite database using this query: create table table_name( id integer primary key autoincrement, name varchar(450) not null, date date) And I'm inserting values via this code (simplified for question): SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); Date tmpDate = dateFormat.parse("2014/01/12"); values.put(columnKey, tmpDate.toString()); db.insert("table_name", null, values); and after getting again value of row 'date' from database I'm getting this error: java.text.ParseException: Unparseable date: "Sun Jan 12 00:00:00 EST 2014" (at offset 0) If I save date with format yyyy/MM/dd shouldn't it be stored with the same format? Thanks from advice. Edit: I have no idea why but after this: DatePicker tmpDatePicker = (DatePicker) dateDialog.findViewById(R.id.date_picker); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date tmpDate = dateForma.parse("2014-01.12"); tmpDate.toString(); Output is Sun Jan 12 00:00:00 EST 2014. How can I change it?
has answer: http://stackoverflow.com/a/23048068
score: 0
accepted answer: http://stackoverflow.com/a/23069123
has comment: http://stackoverflow.com/comment/35212570
tagged with: android
has answer: http://stackoverflow.com/a/23069123
possible better answer: http://stackoverflow.com/a/23048068
type: AnsweredQuestion
tagged with: java
tagged with: date
type: Question
answer count: 2

http://stackoverflow.com/a/22986837
type: Answer
answers question: http://stackoverflow.com/q/22986554
has comment: http://stackoverflow.com/comment/35115858
score: 0
has body: Apache Velocity is not a language, it is a template engine with a distinct syntax.
has comment: http://stackoverflow.com/comment/35116973

http://stackoverflow.com/q/22990092
answer count: 1
downvote count: 0
score: 1
has title: How can I open Jboss port 4447?
favorite count: 0
tagged with: port
type: UnansweredQuestion
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22990647
tagged with: jboss6.x
has body: I have a Jboss 6.1 server and I'd like to use remote EJB connection from a remote client. But JBoss port 4447 is always closed, connection is refused. How can I open this port?

http://stackoverflow.com/comment/35082011
has text: You only do one pass over the array. [Bubblesort](http://en.wikipedia.org/wiki/Bubble_sort) is not O(n) it's O(n^2). You seem to be missing another loop. Have a look at the linked pseudocode in the wikipedia article and compare to your code.
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/22973903

http://stackoverflow.com/q/23004606
type: Question
has comment: http://stackoverflow.com/comment/35189860
score: 0
has answer: http://stackoverflow.com/a/23037500
answer count: 1
has title: LDAP application account authentication using Java
tagged with: java
has body: Would like to know if we can authenticate an applicationName &amp; password against LDAP. In our LDAP system, I can see 'Applications' branch apart from 'Groups', 'People' etc..Need to do this check to do some action. I'm looking for documentation or sample code to do it in Java. Thank you,
type: UnansweredQuestion
tagged with: ldap

http://stackoverflow.com/comment/35155748
comment on: http://stackoverflow.com/q/23015083
score: 0
type: Comment
has text: @AntonH I've wrote code snippet, like to compare the ip with ip in this white list , but you know it does not have the versatility
type: QuestionComment

http://stackoverflow.com/comment/35111829
type: AnswerComment
score: 0
type: Comment
has text: @Sanjay: What is `#{program.lkpProgType == lookupManager.lkpIdByName('MOVIE') }` ??? You mean probably `if (program.lkpProgType == lookupManager.lkpIdByName('MOVIE')) { ... }`? Just remove any `if` and change the label unconditionally. You will see that the problem which you have is in the wrong `if` condition which you use and not in the `setLabel` method.
comment on: http://stackoverflow.com/a/22987431

http://stackoverflow.com/q/23048888
tagged with: rendering
has title: setRenderer has already been called for this instance
tagged with: java
has answer: http://stackoverflow.com/a/23049450
accepted answer: http://stackoverflow.com/a/23049450
type: Question
downvote count: 0
tagged with: android
answer count: 1
has body: I know there are already answers for this error message but none of those solutions helped my problem. I'm trying to do a Sierpinski Triangle and I have a MySurfaceView class that extends GLSurfaceView and a MyRenderer class that extends Activity and implements Renderer. Here are the classes: import android.content.Context; import android.opengl.GLSurfaceView; import android.view.MotionEvent; public class MySurfaceView extends GLSurfaceView { private MyRenderer renderer; private float prevX; private float prevY; private float ROTATION_FACTOR = 1.0f; public MySurfaceView(Context context) { super(context); // TODO Auto-generated constructor stub } public MySurfaceView(Context context, MyRenderer renderer) { super(context); this.renderer = renderer; this.setRenderer(renderer); this.setRenderMode(RENDERMODE_WHEN_DIRTY); } @Override public boolean onTouchEvent(MotionEvent event) { switch(event.getAction()){ case MotionEvent.ACTION_MOVE: float x = event.getX(); float y = event.getY(); float dx = x-prevX; float dy = y-prevY; prevX = x; prevY = y; float distance = (float) Math.sqrt((double) (dx*dx+dy*dy)); float angle = distance*ROTATION_FACTOR; if(dy&gt;0){ renderer.increaseRotationAngle(angle); }else{ renderer.increaseRotationAngle(-angle); } this.requestRender(); } return true; } } import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; import android.app.Activity; import android.opengl.GLSurfaceView.Renderer; public class MyRenderer extends Activity implements Renderer { private Triangle mTriangle; private float rotationAngle = 0; private int level; private int mFill; public MyRenderer(int level, int mFill) { this.level = level; this.mFill = mFill; mTriangle = new Triangle(5, "WireFrame"); } @Override public void onDrawFrame(GL10 gl) { gl.glClear(GL10.GL_COLOR_BUFFER_BIT|GL10.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); gl.glRotatef(rotationAngle, 0, 0, 1); mTriangle.onDrawFrame(gl); // TODO Auto-generated method stub } @Override …
tagged with: glsurfaceview
tagged with: opengl-es
favorite count: 0
upvote count: 2
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/22971088
favorite count: 0
has comment: http://stackoverflow.com/comment/35076307
has title: Why would ClassLoader.getResourceAsStream() return null?
has answer: http://stackoverflow.com/a/22991535
has answer: http://stackoverflow.com/a/22971541
type: AnsweredQuestion
tagged with: cxf
accepted answer: http://stackoverflow.com/a/22991535
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/35076689
linked to: http://stackoverflow.com/q/3139532
upvote count: 7
possible better answer: http://stackoverflow.com/a/22971541
tagged with: classpath
type: Question
answer count: 2
has body: Having the following code broken deliberately to identify the source of a NullPointerException in something that should have been very simple but turns out to drive me nuts: Properties properties = new Properties(); Thread currentThread = Thread.currentThread(); ClassLoader contextClassLoader = currentThread.getContextClassLoader(); InputStream propertiesStream = contextClassLoader.getResourceAsStream("resource.properties"); if (propertiesStream != null) { properties.load(propertiesStream); // TODO close the stream } else { // Properties file not found! } I get the "Properties file not found!" error, i.e. contextClassLoader.getResourceAsStream("resource.properties"); returns null. This is a CXF-based client and I verified that the "resource.properties" file is in the current directory in which the client's jar resides (and runs). I also verified the absolute path by including the following diagnostic code: File file = new File("resource.properties"); System.out.println(file.getAbsolutePath()); The absolute path points to where the client's jar is. I also tried finding out the context of the class loader, using: System.out.println(Thread.currentThread().getContextClassLoader()); but instead some directory structure as demonstrated here, all I get is: com.simontuffs.onejar.JarClassLoader@1decdec Why would ClassLoader.getResourceAsStream() return null? What am I missing?
downvote count: 0
tagged with: jar
tagged with: onejar

breakout
type: Tag
tag name: breakout
tags question: http://stackoverflow.com/q/23119954

http://stackoverflow.com/comment/35111401
type: Comment
has text: The reason I have two different inner Node classes if because their compareTo functions, among others, differ. Can/should I extend an inner class?
type: AnswerComment
comment on: http://stackoverflow.com/a/22990879
score: 0

http://stackoverflow.com/comment/35351437
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23123683
has text: if its compiling in eclipse its fine.Now a days there are lots of IDE's available which makes our work easy.Why you are going for command prompt.I would suggest you to always use IDE
score: 0

http://stackoverflow.com/comment/35293418
has text: I wouldn't call this a newbie question. It arises amongst beginners, sure, but it's tough to answer :p
comment on: http://stackoverflow.com/a/23090755
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35191723
score: 0
type: QuestionComment
type: Comment
has text: Yes, they expands the same base class
comment on: http://stackoverflow.com/q/23033916

http://stackoverflow.com/comment/35258606
type: Comment
has text: actually isnt here asked to raplace Umlaute (ä, ö, ü) with the html escapingcodes ? how much i see that method does opposite..
type: AnswerComment
comment on: http://stackoverflow.com/a/23067848
score: 0

http://stackoverflow.com/q/23122955
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35350393
has comment: http://stackoverflow.com/comment/35350394
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23123154
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35350188
has comment: http://stackoverflow.com/comment/35350216
has comment: http://stackoverflow.com/comment/35350358
tagged with: reverse
favorite count: 0
has title: How to reverse my linked list?
tagged with: linked-list
has answer: http://stackoverflow.com/a/23123154
upvote count: 1
linked to: http://stackoverflow.com/q/12943720
has body: I need to know how to reverse my linked list. I will post my Node and LinkedList classes. The other two are the driver (which creates an instance of my TUI class and my TUI class which asks the user which word to add to the LinkedList and then prints the list and reverses it (by calling the reverse method in LinkedList which is what I need help on) I don't know what to write for reverse method in my LinkedList Node Class: public class Node { private String data; private Node next; public Node(String data, Node next) { this.data = data; this.next = next; } public Node(String data) { this.data = data; this.next = null; } public String getData() { return this.data; } public Node getNext() { return this.next; } public void setNext(Node nextNode) { this.next = nextNode; } public String toString() { return this.data; } } Linked List class: public class LinkedList { private Node head; private Node tail; public LinkedList() { this.head = null; this.tail = null; } public void prepend(String data) { Node newNode = new Node(data, this.head); if (this.head == null) { this.head = newNode; this.tail = newNode; } else { this.head = newNode; } } public void printList() { Node current = this.head; while (current != null) { System.out.println(current.getData()); current = current.getNext(); } } public void append(String data) { Node newNode = new Node(data); if (this.head == null) { this.head = newNode; this.tail = newNode; } else { this.tail.setNext(newNode); this.tail = newNode; } } public void reverse() { } }

element
tags question: http://stackoverflow.com/q/22969067
type: Tag
tags question: http://stackoverflow.com/q/23031886
tags question: http://stackoverflow.com/q/23058789
tag name: element

miglayout
tags question: http://stackoverflow.com/q/23032051
tag name: miglayout
tags question: http://stackoverflow.com/q/23001696
type: Tag

avatarjs
tags question: http://stackoverflow.com/q/23124361
tag name: avatarjs
type: Tag

http://stackoverflow.com/q/23104363
has comment: http://stackoverflow.com/comment/35316615
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35316295
score: 0
type: Question
accepted answer: http://stackoverflow.com/a/23104840
has title: Is it Logical Creating Separate Java Class for Database Table?
has comment: http://stackoverflow.com/comment/35316582
has comment: http://stackoverflow.com/comment/35316700
tagged with: database
has body: I have 5 different tables in my database on MS SQL Server 2012. I have created class for my UserTable and filled in setters and getters shown below , is it logical to put other tables's setters and getters inside the same glass or create separate class for other tables with setters and getters. import java.math.BigDecimal; import java.sql.Connection; public class UserFR17setget { Connection cn; BigDecimal userID; String UserName; String UserPassword; int UserSecurity; BigDecimal ProjectID; public BigDecimal getUserID() { return userID; } public void setUserID(BigDecimal userID) { this.userID = userID; } public String getUserName() { return UserName; } public void setUserName(String UserName) { this.UserName = UserName; } public String getUserPassword() { return UserPassword; } public void setUserPassword(String UserPassword) { this.UserPassword = UserPassword; } public int getUserSecurity() { return UserSecurity; } public void setUserSecurity(int UserSecurity) { this.UserSecurity = UserSecurity; } public BigDecimal getProjectID() { return ProjectID; } public void setProjectID(BigDecimal ProjectID) { this.ProjectID = ProjectID; } } Regards
has comment: http://stackoverflow.com/comment/35316646
tagged with: sql-server
has comment: http://stackoverflow.com/comment/35316675
answer count: 1
has comment: http://stackoverflow.com/comment/35316559
has answer: http://stackoverflow.com/a/23104840
tagged with: jdbc

http://stackoverflow.com/a/23037605
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Yes, there are few ways to map such scenario. JPA provides support for three different data representations: single-table strategy joined strategy table-per-class strategy In other words depending on inheritance type used you will get different database model. Various JPA providers may support additional inheritance strategies. Consider the following example: @Entity @Inheritance //by default SINGLE_TABLE strategy @DiscriminatorColumn( //not supported for TABLE_PER_CLASS strategy name = "BUS_TYPE", discriminatorType = DiscriminatorType.INTEGER ) public abstract class Bus { @Id protected int id; protected int seats; public Bus() { } } @Entity @DiscriminatorValue(value = "1") //not supported for TABLE_PER_CLASS strategy public class BusSubClass1 extends Bus { private String specific1; public BusSubClass1() { } } @Entity @DiscriminatorValue(value = "2") //not supported for TABLE_PER_CLASS strategy public class BusSubClass2 extends Bus { @Temporal private Data specific2; public BusSubClass2() { } } Using InheritanceType.SINGLE_TABLE strategy leads to a single database table containing all concrete entity types: Bus ID BUS_TYPE SEATS SPECIFIC1 SPECIFIC2 -- -------- ----- --------- --------- 1 1 50 qwerty 2 1 55 asdfgh 3 2 30 2014-01-01 every concrete entity instance in the inheritance hierarchy is distinguished by discriminator value (here indicated by BUS_TYPE column) all database columns must be declared as nullable because not all of them may contain values (thus may be problematic for columns that cannot be set to null) wide or deep hierarchy may affect performance (a lot of redundant columns or rows respectively in a table) lack of normalization can waste space in database table offers good performance for read and write operations (polymorphic queries don't require joins, only discriminator value) adding/removing entity fields may be problematic (from database administration point of view) Using InheritanceType.JOINED strategy leads to multiple database tables per …
score: 3
accepted answer of: http://stackoverflow.com/q/23011672
answers question: http://stackoverflow.com/q/23011672
has comment: http://stackoverflow.com/comment/35212612
upvote count: 3

http://stackoverflow.com/comment/69286956
has text: Where do I get the SSLContext from?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24401795
type: AnswerComment

http://stackoverflow.com/a/23055949
has body: Do like the following - String pathToExternalStorage = Environment.getExternalStorageDirectory().toString(); File root = new File(pathToExternalStorage + "/saved_images"); if (!root.exists()) root.mkdirs(); try { File sdImageMainDirectory = new File(root, myid + "__" + fileName + ".png"); fOut = new FileOutputStream(sdImageMainDirectory); bm.compress(Bitmap.CompressFormat.PNG, 100, fOut); fOut.flush(); fOut.close(); } catch (Exception e) { e.printStackTrace(); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23055713

http://stackoverflow.com/comment/35255733
type: QuestionComment
has text: By the way, I'm not sure this is relevant, but the code is running against the Dalvik VM (i.e. it's Android code).
comment on: http://stackoverflow.com/q/23069722
score: 0
type: Comment

http://stackoverflow.com/a/23002325
has body: So, inside your inner most for loop, just check each distance and store the max. And once the loops are all finished, execute your drawing. In order to do so, you'll need to store the indices (the i and j) of the points somewhere globally. So something like this: // declare these guys to keep track of where to draw int maxI = 0; int maxJ = 0; for (int i = 0; i &lt; pts.length; i++){ pts[i] = new Point2D(Math.random(), Math.random()); StdDraw.setPenColor(StdDraw.RED); StdDraw.setPenRadius(0.008); pts[i].draw(); for (int j = 0; j&lt;i; j++){ double distance[] = {pts[i].distanceTo(pts[j])}; for (int k = 0; k &lt;distance.length; k++ ){ if (distance[k] &gt; max){ max = distance[k]; maxI = i; maxJ = j; } } } } if (max &gt; 0){ System.out.println(max); StdDraw.setPenColor(StdDraw.BLACK); StdDraw.setPenRadius(0.002); pts[maxI].drawTo(pts[maxJ]); }
answers question: http://stackoverflow.com/q/23002077
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35132642
has comment: http://stackoverflow.com/comment/35132593
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35132681
accepted answer of: http://stackoverflow.com/q/23002077

http://stackoverflow.com/q/22971662
tagged with: regex
linked to: http://stackoverflow.com/q/7844359
has comment: http://stackoverflow.com/comment/35077277
has body: I try to use the following expression to check whether the password is a combination of number and letter despite the order of letter and number password.matches("[a-zA-z]{1,}[0-9]{1,}") but the above code would check with the order letter goes first, then number comes later like the password would be acceptable if the password looks like "hello1213" and "123hello"
tagged with: java
has title: how to use regex to check the password contains letter and number
type: Question
has answer: http://stackoverflow.com/a/22971710
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35134874
type: Comment
has text: Applets and files mix like oil and water (poorly). Applet resources should typically be loaded via URL.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22988731

http://stackoverflow.com/comment/35231424
has text: How would I do this @Pphoenix ? Thanks :)
comment on: http://stackoverflow.com/q/23056804
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23106098
score: 0
type: Answer
has body: Though Double class supports infinite value double d=Double.POSITIVE_INFINITY but i dont think you can use it for your arithmatic purpose. Better you define a maximum value and treat it as infinity. double Min=0; double Max= Double.MAX_VALUE; double aggresiveness= Min + (Math.random() * ((Max - Min) + 1)); ps: you can also take aggresiveness as long or int if you don't want it be a double
answers question: http://stackoverflow.com/q/23105684

http://stackoverflow.com/q/23077204
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/23077404
score: 0
has comment: http://stackoverflow.com/comment/35268952
tagged with: copyonwritearraylist
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35269213
tagged with: filereader
has body: I want to add data from Text.txt file to ArrayList in java. I had created a POJO Employee class with just getters and setters: public class Employee { private String name; private String designation; private String joiningDate; public Employee(String name, String designation, String joiningDate) { this.name = name; this.designation = designation; this.joiningDate = joiningDate; } public String getJoiningDate() { return joiningDate; } public void setJoiningDate(String joiningDate) { this.joiningDate = joiningDate; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDesignation() { return designation; } public void setDesignation(String designation) { this.designation = designation; } } And this is my main class : import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.util.ArrayList; public class MainClass { public static void main(String[] args) throws FileNotFoundException { ArrayList&lt;Employee&gt; emplo = new ArrayList&lt;Employee&gt;(); BufferedReader file = new BufferedReader(new FileReader("D://Test.txt")); try { StringBuilder builder = new StringBuilder(); String line; while ((line = file.readLine()) != null) { String token[] = line.split("|"); String name = token[0]; String designation = token[1]; String joiningDate = token[2]; Employee emp = new Employee(name, designation, joiningDate); emplo.add(emp); } for (int i = 0; i &lt; emplo.size(); i++) { System.out.println(emplo.get(i).getName() + " " + emplo.get(i).getDesignation() + " " + emplo.get(i).getJoiningDate()); } file.close(); } catch (Exception e) { // TODO: handle exception } } } Text file data: John|Smith|23 Rick|Samual|25 Ferry|Scoth|30 What I want: John Smith 23 Rick Samual 25 Ferry Scoth 30 Any help in this will be appreciable
has title: adding text file data to Array java
has answer: http://stackoverflow.com/a/23077347
tagged with: java
tagged with: file
type: Question
answer count: 2

http://stackoverflow.com/q/22996274
has body: This might be a stupid question but.. let's assume I have a class ContainerClass, if contains a HashSet that is accessed from several threads that add and also remove elements.. In one of these thread, let's call it thread 1, I execute the following code: if(ContainerClass.hashSet.containsKey(keyId)) int number = ContainerClass.hashSet.get(keyId); Is it guaranteed that by the time the second line is executed, the element with the key keyId is still there? Or could this thread do the check in the if-statement, then be paused, then another thread alters the HashSet, and thread 1 gets a NullPointerException?
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/35121444
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22996355
tagged with: thread-safety
has comment: http://stackoverflow.com/comment/35121368
has answer: http://stackoverflow.com/a/22996435
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35121846
possible better answer: http://stackoverflow.com/a/22996367
has comment: http://stackoverflow.com/comment/35121386
has answer: http://stackoverflow.com/a/22996367
has comment: http://stackoverflow.com/comment/35121427
has title: Java - Are if-statements thread-safe?
favorite count: 0
has comment: http://stackoverflow.com/comment/35121501
has answer: http://stackoverflow.com/a/22996355
type: AnsweredQuestion

http://stackoverflow.com/comment/35317971
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23095631
score: 0
has text: 1) An MCVE is one source file (which can have multiple classes in it, though only one `public` class). 2) If it is an MCVE, you can post it as an [edit to the thread](http://stackoverflow.com/posts/23095631/edit). If it is too long to add it directly to the question, it is not **minimal**. 3) External links go stale, and most people either cannot (by employer choice) or will not (through their own choice) follow them.

http://stackoverflow.com/comment/35195272
type: Comment
type: QuestionComment
has text: What happened, if you to tried this HQL - `select u from Users u`?
comment on: http://stackoverflow.com/q/23036714
score: 0

http://stackoverflow.com/comment/35362714
score: 0
has text: Well i only need to read so there is no problem there. But what i'm wondering is this: If i need to create a project manualy and loop over all the subTasks to add them to the project. Then i'd basically be doing the same as normal JDBC calls (getting resultsets and looping over the data to create the objects). In which case it might be better to use normal JDBC instead of JPA. Since I wont be getting any added value by using JPA and JDBC might even have better performance in this case.
type: Comment
comment on: http://stackoverflow.com/a/23129399
type: AnswerComment

http://stackoverflow.com/a/23079308
score: 2
answers question: http://stackoverflow.com/q/23079236
downvote count: 0
has comment: http://stackoverflow.com/comment/35272349
upvote count: 2
has body: If there are at most 4 columns then you can simply do: final String[] columns = input.split("\\s", 4); From the Javadoc: The limit parameter controls the number of times the pattern is applied and therefore affects the length of the resulting array. If the limit n is greater than zero then the pattern will be applied at most n - 1 times, the array's length will be no greater than n, and the array's last entry will contain all input beyond the last matched delimiter. If n is non-positive then the pattern will be applied as many times as possible and the array can have any length. If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded. If you have fewer than 4 columns then columns.length will simply be the number of columns. If you have more than 4 columns then the remainder, after extracting the first 3, will be dumped into the fourth column. No need for Guava.
type: Answer
has comment: http://stackoverflow.com/comment/35272189

http://stackoverflow.com/comment/35308789
type: Comment
score: 0
type: AnswerComment
has text: I do not know why it shows `[machine, Learning]` not `[machine, learning]`? why the L should still be uppercase?
comment on: http://stackoverflow.com/a/23099837

http://stackoverflow.com/q/23045088
tagged with: arraylist
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23045320
has answer: http://stackoverflow.com/a/23045143
type: UnansweredQuestion
has title: Mapping an ArrayList to a HashMap
tagged with: java
type: Question
has body: Let's say I am reading in a bunch of long strings from an ArrayList like... Green,Jim,Bob,Dan Blue,Chris,Al,Jeff Orange,Mark I want to map these values into a HashMap with the colors as the key and the names as the mapped values. I figured out how to get the colors as the key, but I am not sure how to get the mapped values as the names. Code: for (int i = 0; i &lt; namesAndColors.size(); i++) { String linetoSplit = namesAndColors.get(i); String colors= linetoSplit.split(",")[0]; hm.put(colors, ***); } System.out.println(hm); } Output right now would be something like: [Green = , Blue= , Orange= ] Desired Output: [Green = Jim Bob Dan, Blue = Chris Al Jeff, Orange = Mark]

http://stackoverflow.com/q/23068734
type: Question
has body: (Question #0 : Does the java compiler eliminate dead-code by default?) Question #1: Suppose I have the following piece of code (which is artificially generated, so I don't have much control over), would the compiler be able to eliminate the dead-code for me? static void foo(final Object o) { if (o == null) { // do something } else { // do something if (o == null) { // this condition is never gonna be true // do something } else { // do something } } }
upvote count: 1
answer count: 1
has title: Can the Java compiler eliminate dead code from the following scenario?
favorite count: 0
tagged with: javac
type: UnansweredQuestion
tagged with: dead-code
has answer: http://stackoverflow.com/a/23803007
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/23010131
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
type: Question
has body: I'm looking the way how to control java properties during installation procedure. I'm have Spring Data JPA + Hibernate in my application. I've configured jpa properties in bean. And move it to property file. <entry key="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl}"/> <entry key="hibernate.show_sql" value="${hibernate.show.sql}" /> <entry key="hibernate.dialect" value="${hibernate.dialect}" /> property file: prop-local-override.properties where local is environment variable. hibernate.hbm2ddl=update #hibernate.dialect=org.hibernate.dialect.HSQLDialect hibernate.show.sql=true So, everything works fine. But I want to change hibernate.hbm2ddl during installation process. I use rpm package for installation my app. For example, I want to set this property to "create" when app is installing. And return to update after each restart. Looks like -Dhibernate.hbm2ddl=update works fine. But it's manual work. Does anyone has some idea how to make it automatically, without big tools like Puppet? Thanks, Sergii K.
has comment: http://stackoverflow.com/comment/35147974
answer count: 1
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/23012422
has comment: http://stackoverflow.com/comment/35151031
favorite count: 0
tagged with: spring
tagged with: properties
has title: How can I modify java properties on the fly?
score: 2
upvote count: 2

http://stackoverflow.com/q/22995678
has body: org.codehaus.jackson.map.JsonMappingException: No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) through reference chain.. Above is the exception I'm getting, where my non-primitive member variables in my pojo are not able to be read. after several searches I tried add @JsonAutoDetect for my POJO class and also tried the @JsonProperty annotation for all fields that weren't getting recognized. This did not work so I also tried @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) with no luck as well. Here is where I attempt to convert the object into json: @Override public Map&lt;String, String&gt; getChanges(User oldInfo, User newInfo) { oldAndNewInfo = new HashMap&lt;String, String&gt;(); objectWriter = new ObjectMapper().writer().withDefaultPrettyPrinter(); try { oldAndNewInfo.put(objectWriter.writeValueAsString(oldInfo), objectWriter.writeValueAsString(newInfo)); } catch (Exception e) { e.printStackTrace(ps); } return oldAndNewInfo; } Does anyone have any ideas?
upvote count: 1
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
has title: JsonMappingException while saving Java Object to JSON
has answer: http://stackoverflow.com/a/22998700
accepted answer: http://stackoverflow.com/a/22998700
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23012529
linked to: http://stackoverflow.com/q/3522454
type: Question
has comment: http://stackoverflow.com/comment/35150672
answer count: 1
upvote count: 7
has answer: http://stackoverflow.com/a/23012611
favorite count: 0
has comment: http://stackoverflow.com/comment/119959238
duplicate of: http://stackoverflow.com/q/3522454
downvote count: 0
type: UnansweredQuestion
tagged with: java
score: 7
has title: Exisiting Tree Library in Java?
has body: I am trying to create a Tree like structure were i have a root node and then i can add childrens to the root node and continue the process. I am not really interested in sorting. All i want is a tree like structure since i am creating an Org Chart. Is there an exisitng java library that will let me add root node, child node or for example get a child node from a tree and then add child to those nodes as well. Or maybe get all the leaf node from a tree. I am trying to avoid creating one on my own just to save time ? Any libraries you can suggest will be of great help . Note: I am not using Swing or AWT components.

http://stackoverflow.com/comment/35086977
has text: @jojodmo the code shouldn't be this nested. That's ugly code. It should be broken into methods. You can argue performance but modern compilers make that argument largely moot.
comment on: http://stackoverflow.com/q/22976655
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35227830
score: 0
type: Comment
type: QuestionComment
has text: Duncan is right: I always recommend to not put IDE specific files into version control. This way, each developer can choose whatever IDE he wants to use (if any at all). You also could work from command line (which CI systems do, for example). Using Maven and the M2E plugin in Eclipse for example is very easy: Checkout the project and afterwards configure it to be a Maven project. No need to have the meta files under version control.
comment on: http://stackoverflow.com/q/23054287

http://stackoverflow.com/comment/35263637
score: 1
comment on: http://stackoverflow.com/q/23074029
has text: If you don't like my question at least explain why. I'm happy to try and improve it.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23025789
accepted answer of: http://stackoverflow.com/q/23025713
type: AcceptedAnswer
has body: I won't compile because Collections.sort() only sorts Lists, not Collections. If you want to sort the values, it's east to turn a Collection into a List by passing the collection into the constructor of the List: List&lt;Author&gt; list = new ArrayList&lt;Author&gt;(unSortedMap.values()); Collections.sort(list, new Comparator&lt;Author&gt;() { public int compare(Author a, Author b) { return a.name.compareTo(b.name); } }); But that won't get the job done. Instead, you need to sort the Map's Entry objects, then put them into the map: public static LinkedHashMap&lt;String, Author&gt; sortName(Map&lt;String, Author&gt; unSortedMap) { List&lt;Map.Entry&lt;String, Author&gt;&gt; list = new ArrayList&lt;Map.Entry&lt;String, Author&gt;&gt;(unSortedMap.entrySet()); Collections.sort(list, new Comparator&lt;Map.Entry&lt;String, Author&gt;&gt;() { public int compare(Map.Entry&lt;String, Author&gt; a, Map.Entry&lt;String, Author&gt; b) { return a.getValue().name.compareTo(b.getValue().name); } }); LinkedHashMap&lt;String, Author&gt; result = new LinkedHashMap&lt;String, Author&gt;(); for (Entry&lt;String, Author&gt; entry : list) { result.put(entry.getKey(), entry.getValue()); } return result; }
downvote count: 0
answers question: http://stackoverflow.com/q/23025713
has comment: http://stackoverflow.com/comment/35176195
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/23008297
has body: I'd like to set the foreign key constraint name that is autogenerated by hibernate, so that is not named fk_123213241341, but fk_user. I'm trying to use the new JPA 2.1 Annotation @ForeignKey. But I'm missing probably something: org.hibernate.AnnotationException: A Foreign key refering User from Trip has the wrong number of column. should be 2 @IdClass(UserPK.class) class User { @Id String firstname; @Id String lastname; //other fields omitted } class UserPK { String firstname; String lastname; } class Trip { @ManyToOne @JoinColumn(foreignKey = @ForeignKey(name = "FK_USER") private User user; }
has comment: http://stackoverflow.com/comment/35166488
has title: How to map a foreign key name on table with composite key?
has comment: http://stackoverflow.com/comment/35157226
tagged with: sql
has comment: http://stackoverflow.com/comment/35164663
answer count: 1
has comment: http://stackoverflow.com/comment/35157700
favorite count: 0
accepted answer: http://stackoverflow.com/a/23022742
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: hibernate
type: Question
tagged with: jpa
has answer: http://stackoverflow.com/a/23022742
downvote count: 0

http://stackoverflow.com/comment/35144821
comment on: http://stackoverflow.com/q/22984129
score: 0
type: QuestionComment
type: Comment
has text: In fact, my tests fail when accessing anything from Gdx.gl - apparently, the above is not sufficient to initialize the GL part. I'm investigating further - part of my testing involves texture loading, so I'll need it too!

http://stackoverflow.com/q/23035165
type: AnsweredQuestion
score: 0
tagged with: java
has body: I have a very simple JavaFX application. It needs to draw an image I keep as a png in the "resources" directory. I initialize it like this: private final static Image customerImage; static { Path imageLink = Paths.get("resources", "homeIcon.png"); customerImage = new Image("file:"+imageLink.toString(),true); } This works fine when I run it straight from my IDE. But when I deploy the application as a JavaFX package and run the resulting jnlp then the Image constructor throws an AccessControlException, specifically: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "user.dir" "read") Which, if I understand correctly, means it doesn't have access to search for the file. How should I resolve this? It also seems strange that it would look in a directory when deployed as .jnpl, should I place the .png file somewhere else?
tagged with: accesscontrolexception
type: Question
tagged with: javafx-8
tagged with: jnlp
has answer: http://stackoverflow.com/a/23058510
answer count: 1
accepted answer: http://stackoverflow.com/a/23058510
has title: Loading image in JavaFX causes AccessControlException when deployed as jnlp

http://stackoverflow.com/q/23043743
has title: In java how does the static field and method occupy the memory？
has answer: http://stackoverflow.com/a/23043782
favorite count: 0
has comment: http://stackoverflow.com/comment/35207248
score: 0
answer count: 3
has body: I searched on google. It says the static field and method are loaded in compile time. In my mind, compiling is used to create the class file and then when executing , the threads are created and the program will occupy the memory. What does it mean "in compile time"? means when creating the class file? http://javarevisited.blogspot.com.au/2012/03/what-is-static-and-dynamic-binding-in.html This is the URL.
has answer: http://stackoverflow.com/a/23043813
linked to: http://stackoverflow.com/q/4343760
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35207411
tagged with: java
type: Question
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/23043791
has comment: http://stackoverflow.com/comment/35323463
has comment: http://stackoverflow.com/comment/35207364

http://stackoverflow.com/a/23004959
answers question: http://stackoverflow.com/q/23004882
type: Answer
upvote count: 2
score: 2
has body: This should work JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
downvote count: 0

http://stackoverflow.com/a/23128645
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23128524
upvote count: 2
type: Answer
has body: One solution would be to take substring on every three characters and convert each substring back using Integer.parseInt(). public class Main { public static void main(String[] args) { String input = "8479777982827987326669717378"; int n = 3; int[] output = new int[(input.length() + n - 1) / n]; for (int i = 0; i &lt; output.length; i++) { output[i] = Integer.parseInt(input.substring(i*n, Math.min((i+1)*n, input.length()))); // System.out.println(output[i]); } } }

http://stackoverflow.com/a/23098164
answers question: http://stackoverflow.com/q/23098022
accepted answer of: http://stackoverflow.com/q/23098022
score: 0
type: AcceptedAnswer
has body: Here is one possible approach, using Class#isAssignableFrom(Class) - public static &lt;E, F&gt; List&lt;F&gt; copyIf(List&lt;E&gt; source, List&lt;F&gt; destination, Class&lt;F&gt; cls) { for (E e : source) { if (cls.isAssignableFrom(e.getClass())) { destination.add((F) e); } } return destination; } public static void main(String[] args) { String s = "Hello"; List&lt;String&gt; al = new ArrayList&lt;String&gt;(); al.add(s); System.out.println(copyIf(al, new ArrayList&lt;String&gt;(), String.class)); } Output is Hello
type: Answer

http://stackoverflow.com/comment/35077823
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22971744
has text: You know that the Apache DBCP is just a wrapper for the actual JDBC driver right? Meaning DBCP can __not__ actually connect to any database, it requires the database's native JDBC driver to work?
type: Comment

http://stackoverflow.com/a/22988357
answers question: http://stackoverflow.com/q/22988243
has body: For own, little projects one doesn't have to use this. But when creating libraries for others, this may help your API users to write robust applications. IMO As I posted in the comment: See nullable annotation usage for a good answer to that particular question.
upvote count: 7
score: 7
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35239041
score: 0
comment on: http://stackoverflow.com/q/23060792
type: Comment
type: QuestionComment
has text: do you have a lsitvie with textviews. Need more info. But what you are doing is wrong

http://stackoverflow.com/q/23071245
has body: I have a problem with the call of asyncTask.... i have a class named arrivi public class arrivi extends Fragment { ListView list; int thread = 0; public String[] lista = new String[200]; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View ios = inflater.inflate(R.layout.arrivi, container, false); new MyTask().execute(""); return ios; } //INIZIO THREAD public class MyTask extends AsyncTask&lt;String, Void, String&gt; { with new MyTask this work fine... but i want call MyTask into MainActivity.java public class MainActivity extends FragmentActivity { ViewPager Tab; TabPagerAdapter TabAdapter; ActionBar actionBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ..... ..... i have tried to arrivi a = new arrivi(); a.MyTask.execute(""); i don't know... how to make a call?? can you make me an example of code? Thank u guys!
has answer: http://stackoverflow.com/a/23071314
accepted answer: http://stackoverflow.com/a/23071314
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/23077543
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/23077543
has comment: http://stackoverflow.com/comment/35258041
score: 0
has title: Asynctask in another class?
answer count: 2

http://stackoverflow.com/q/23111322
type: AnsweredQuestion
tagged with: restlet-2.0
tagged with: java
has title: Transparent reverse proxying using org.restlet.routing.Redirector
type: Question
accepted answer: http://stackoverflow.com/a/23216251
tagged with: http-headers
tagged with: restlet
score: 0
has body: I am trying to create a transparent reverse proxy using org.restlet.routing.Redirector. For the sake of simplicity let's say all I want to do is to redirect all HTTP requests pointing at http://localhost:80 to be dispatched to another unrelated HTTP server: http://localhost:8080 I've wrote a simple reverse proxy using Redirector (MODE_SERVER_OUTBOUND mode) and it actually works as expected in the sense that it dispatches requests properly and also handles redirects. But now let's say that resources at http://localhost:8080 are protected with Digest authentication mechanism. Now the problem is that headers in requests and responses when handled by Redirector are removed (from docs WRT MODE_SERVER_OUTBOUND): Note that in this mode, the headers of HTTP requests, stored in the request's attributes, are removed before dispatching. Also, when a HTTP response comes back the headers are also removed. which makes Digest authentication mechanism unusable. I guess that reverse proxy should return responses as if it was itself the origin. Is there any way to leave headers intact so that end server (http://localhost:8080) and clients could communicate as there is no proxy in between?
answer count: 1
has comment: http://stackoverflow.com/comment/35417631
tagged with: reverse-proxy
has answer: http://stackoverflow.com/a/23216251

http://stackoverflow.com/comment/35247944
has text: Try closing the Socket in Sender?
score: 0
comment on: http://stackoverflow.com/q/23065675
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35186506
type: Comment
type: QuestionComment
has text: you have to make your arrayList `amostra` static and make your `element` method static. Then call your `element` method like this `System.out.println(element(1));`
comment on: http://stackoverflow.com/q/23031886
score: 1

http://stackoverflow.com/comment/35316084
has text: Thx, but what is the plugin id?? Can't I get it by some method call?
type: Comment
comment on: http://stackoverflow.com/a/23104149
score: 0
type: AnswerComment

http://stackoverflow.com/a/23051419
has comment: http://stackoverflow.com/comment/35221665
has comment: http://stackoverflow.com/comment/35221826
has comment: http://stackoverflow.com/comment/35351740
type: Answer
answers question: http://stackoverflow.com/q/23051306
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35221706
has comment: http://stackoverflow.com/comment/35221686
has comment: http://stackoverflow.com/comment/35221637
has comment: http://stackoverflow.com/comment/35222724
has body: For each point in the array, calculate the angle between this point and other points. Counting the number of those with the same angle using a hashMap. Expected time O(n^2) Pseudo code int result = 0; for(int i = 0; i &lt; data.length; i++){ HashMap&lt;Double, Integer&gt; map = new HashMap(); for(int j = 0; j &lt; data.length; j++){ if(i == j) continue; double angle = calculateAngle(data[i], data[j]); if(map.containsKey(slope)){ map.put(angle, map.get(slope) + 1); }else{ map.put(angle, 1); } result = max(result, map.get(slope)); } } Note: As mention in NiklasB 's comment, using double will cause some problems with precision, especially when we need to compare those floating values. We can avoid that by using the Rational class suggested by NiklasB. (Or less precise, using this)
downvote count: 0
has comment: http://stackoverflow.com/comment/35221700

http://stackoverflow.com/comment/35361289
has text: What is the fully qualified name of your class containing the `public static void main(String[] args)` method? Use that fully qualified name instead.
type: Comment
comment on: http://stackoverflow.com/a/23129147
score: 0
type: AnswerComment

http://stackoverflow.com/a/23105532
answers question: http://stackoverflow.com/q/23105395
upvote count: 1
has body: You can do this: Intent i = new intent(aActivity, InstructionsActivity.class); i.putExtras("Flag", "firstInstructions"); i.putExtras("Flag2", "firstInstructions2"); i.putExtras("Flag3", "firstInstructions3"); Hope this helps.. :)
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/23001919
score: 0
type: Answer
has body: You need CSS for this. The text-indent property will do what you're looking for. Here's an example using inline CSS: out.println("&lt;p style=\"text-indent: 10px;\"&gt;" + meaning + "&lt;/p&gt;"); Or in your stylesheet, define your indent class: .indent { text-indent: 10px }
answers question: http://stackoverflow.com/q/23001910

http://stackoverflow.com/a/23078128
upvote count: 3
answers question: http://stackoverflow.com/q/23073439
has body: Your server should return 4xx HTTP error code to get this working. When your server returns HTTP 200 this mean successful response and it will be processed with onSuccess branch. Likely your object which you pass to Callback&lt;Object&gt; should be ready to handle both success and error result. To make sure this is the case you can check if RetrofitError is actually a JsonParseException by adding next snippet: public void failure(RetrofitError error) { Log.v(TAG, error.getMessage()); };
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/57627270
score: 3

http://stackoverflow.com/comment/35104248
comment on: http://stackoverflow.com/q/22986673
type: Comment
has text: What JDK are you using? List the steps you used to add the appcompat library into your project. Maybe you're missing something along the way.
type: QuestionComment
score: 0

http://stackoverflow.com/q/23115878
has answer: http://stackoverflow.com/a/23116350
type: AnsweredQuestion
tagged with: compiler-errors
downvote count: 0
score: 1
tagged with: java
tagged with: jbutton
type: Question
tagged with: actionlistener
has body: My program is supposed to output the the text of the selected JButton to the console. The problem I am running into is that I don't understand how to get the source object to recognize the getText() method so that I can do the above. Here is the Error Code: Error: cannot find symbol symbol: method getText() location: variable source of type java.lang.Object Here is the Program Code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class PanelExample extends JFrame implements ActionListener{ JButton b1; JButton b2; JButton b3; JButton b4; JButton b5; JButton b6; String response; public void makePanels() { Container c = getContentPane(); b1 = new JButton("Item 1"); b2 = new JButton("Item 2"); b3 = new JButton("Item 3"); b4 = new JButton("Item 4"); b5 = new JButton("Item 5"); b6 = new JButton("Item 6"); JPanel p1 = new JPanel(); p1.setLayout(new FlowLayout()); p1.add(new JButton("Ok")); p1.add(new JButton("Cancel")); p1.add(new JLabel(response)); JPanel p2 = new JPanel(); p2.setLayout(new FlowLayout()); p2.add(new JLabel("Make a Selection")); JPanel p3 = new JPanel(); p3.setLayout(new BoxLayout(p3, BoxLayout.Y_AXIS)); p3.add(b1); p3.add(b2); p3.add(b3); JPanel p4 = new JPanel(); p4.setLayout(new BoxLayout(p4, BoxLayout.Y_AXIS)); p4.add(b4); p4.add(b5); p4.add(b6); c.setLayout(new BorderLayout()); c.add(p1, BorderLayout.SOUTH); c.add(p2, BorderLayout.NORTH); c.add(p3, BorderLayout.WEST); c.add(p4,BorderLayout.EAST); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); b5.addActionListener(this); b6.addActionListener(this); pack(); setVisible(true); } public void actionPerformed(ActionEvent event){ Object source = event.getSource(); String text = source.getText(); System.out.println(text); } public static void main(String[] args) { PanelExample frame = new PanelExample(); frame.makePanels(); frame.setSize(200, 250); } } Throughout all the posts I have searched I have not found one that wil…
has title: How do I get a source object from actionPerformed to be able to work with the getText() method and output the text from a JButton to a String file?
upvote count: 1
accepted answer: http://stackoverflow.com/a/23116350
answer count: 1
tagged with: user-interface
favorite count: 0

http://stackoverflow.com/a/23093206
type: Answer
has body: The paint method is automatically called to refresh your window. For example, the paint method is automatically called when resizing your window. You can also force to call the paint method by calling the repaint() method of JFrame. Also, if you're looking for the declaration of paint method, it is in java.awt.Component. Dont hesitate to have a look to the javadoc
score: 2
answers question: http://stackoverflow.com/q/23093040
has comment: http://stackoverflow.com/comment/35297728
has comment: http://stackoverflow.com/comment/35298003
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/35298085

http://stackoverflow.com/q/23008246
has title: How to go back to previous frame that was invisible
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35143430
possible better answer: http://stackoverflow.com/a/23008885
downvote count: 0
tagged with: jframe
has body: I am very new to Java Swing and I am working on a login frame with swing that works like this. After I login successfully in a frame, another new frame is opened while the login frame goes to invisible. What I am trying to do is that when i close the another frame (after login frame) I want the previous login frame to show again from invisible to visible. please let me know how to do this..:)
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/23008295
accepted answer: http://stackoverflow.com/a/23008295
has answer: http://stackoverflow.com/a/23008885
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/9554636
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/36938800
answer count: 3

http://stackoverflow.com/a/23120818
upvote count: 0
has comment: http://stackoverflow.com/comment/35388570
has comment: http://stackoverflow.com/comment/35376373
score: -1
has body: Buttons add and sub are null. Try the following code (add in onCreate()): add = (Button) findViewById(R.id.bAdd); sub = (Button) findViewById(R.id.bSub);
has comment: http://stackoverflow.com/comment/35347084
has comment: http://stackoverflow.com/comment/35346815
answers question: http://stackoverflow.com/q/23120454
has comment: http://stackoverflow.com/comment/35347179
downvote count: 1
type: Answer

http://stackoverflow.com/comment/35088883
type: Comment
comment on: http://stackoverflow.com/a/22978127
has text: Okay. So the top three bits in this byte that I would be concerned with are: "A,B,and C", correct? Why was 0x0F chosen by the coder in this example?
type: AnswerComment
score: 0

http://stackoverflow.com/q/23058275
possible better answer: http://stackoverflow.com/a/23058318
accepted answer: http://stackoverflow.com/a/23338892
upvote count: 8
tagged with: neo4j
score: 8
tagged with: cypher
has title: Should I use uppercase or camelcase in label enums?
type: AnsweredQuestion
tagged with: enums
has answer: http://stackoverflow.com/a/23338892
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23058318
downvote count: 0
favorite count: 0
has body: The title says it all. In cypher, camelcase is used for labels. For instance :Car and :Bike. The API docs for Label uses uppercase when defining each label in the enum, so then Label.CAR.name() will always be CAR, not Car. Using camelcase fits in more nicely with cypher queries, but this conflicts with the Java standard for naming enum members. This forces me to use labels like Label.BIKE_SEAT instead of Label.BikeSeat in my graph database. Which one should I use? Even though using uppercase for enum members is the correct way to do it in Java, I'm still a bit curious about why the Neo4j people then decided to represent labels as an enums?

http://stackoverflow.com/q/23081848
type: AnsweredQuestion
has body: I have an AWS EC2 instance deployed, and I need to find out its public IP. Howver, to know that I must first know the instance-id of my instance. Objective: I have a Java code running in my instance, and I want that code figure out the current IP or Instance-ID of the instance where it is being run. After reading Amazon documentation I came up with a Java method that returns the IP of all instances, but this is not what I want, I want a method that returns only the instance-id or the public IP address of the running instance. /** * Returns a list with the public IPs of all the active instances, which are * returned by the {@link #getActiveInstances()} method. * * @return a list with the public IPs of all the active instances. * @see #getActiveInstances() * */ public List&lt;String&gt; getPublicIPs(){ List&lt;String&gt; publicIpsList = new LinkedList&lt;String&gt;(); //if there are no active instances, we return immediately to avoid extra //computations. if(!areAnyActive()) return publicIpsList; DescribeInstancesRequest request = new DescribeInstancesRequest(); request.setInstanceIds(instanceIds); DescribeInstancesResult result = ec2.describeInstances(request); List&lt;Reservation&gt; reservations = result.getReservations(); List&lt;Instance&gt; instances; for(Reservation res : reservations){ instances = res.getInstances(); for(Instance ins : instances){ LOG.info("PublicIP from " + ins.getImageId() + " is " + ins.getPublicIpAddress()); publicIpsList.add(ins.getPublicIpAddress()); } } return publicIpsList; } In this code I have an array with the instance-ids of all active instances, but I do not know if they are "me" or not. So I assume that my first step would be to know who I am, and then to ask for my public IP address. Is there a change I can do to the previous method to give me what I want? Is there a more efficient way of doing it?
downvote count: 0
tagged with: amazon-ec2
possible better answer: http://stackoverflow.com/a/30375608
tagged with: amazon-web-services
favorite count: 0
has answer: http://stackoverflow.com/a/23087183
type: Question
has answer: http://stackoverflow.com/a/30317951
has answer: http://stackoverflow.com/a/25675456
has answer: http://stackoverflow.com/a/23083578
score: 18
accepted answer: http://stackoverflow.com/a/23087183
has title: Get instance-id of EC2 instance via Java
answer count: 7
tagged with: ip
has answer: http://stackoverflow.com/a/53107206
tagged with: java
has answer: http://stackoverflow.com/a/35492189
upvote count: 18
has comment: http://stackoverflow.com/comment/85015589
has answer: http://stackoverflow.com/a/30375608

http://stackoverflow.com/comment/35195793
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23025534
has text: I would agree that encryption would not even make any sense since the software proceeds to negotiate SSL later on. The sad part is the server is lacking any sort of logging system, so looking over error logs is probably impossible. From what I've seen sending anything other then the data block above results in the server closing the connection, not even in a gentle way. One thing I have noticed is both the server and client are modular (using .cat files), running the same base program. The .cat files look a lot like the binary above, I'm wondering if it's just sending some sort of .cat file.

http://stackoverflow.com/comment/63340166
score: 1
comment on: http://stackoverflow.com/a/24117864
type: AnswerComment
has text: To combine this with JUnit tests, you can use `GdxTestRunner` from https://github.com/TomGrill/gdx-testing.
type: Comment

http://stackoverflow.com/comment/35195476
comment on: http://stackoverflow.com/a/23035505
type: AnswerComment
type: Comment
score: 0
has text: So you're saying the problem is that he didn't escape the quote characters for the regex parser? Not true; `"` has no special meaning in a regex, so you only need the one backslash to get it past the *Java* compiler. Adding the backslash didn't break anything, but it didn't fix the problem. Your regex works because (as it turns out) the original regex was okay; it was the input that was broken.

http://stackoverflow.com/comment/35343026
comment on: http://stackoverflow.com/a/23118859
score: 0
type: Comment
has text: @quartaela No, you shouldn't have a problem with that I don't think. I'll delete and investigate further
type: AnswerComment

http://stackoverflow.com/q/22999315
has answer: http://stackoverflow.com/a/23000043
answer count: 1
has body: So as of right now, I am trying to create a basic login GUI. I would like to have it look something like this UserID Password &lt;EDITABLE AREA FOR USERID&gt; &lt;EDITABLE AREA FOR Password&gt; "Error Msg displayed here if there exists error, otherwise NO SPACE" [Login Button] Below is the code that I am currently trying to use to achieve this. I understand that nothing is functional at the moment, I will add listeners and provide functionality later. My current issue is that the spacing seems to be off and I am not sure how to improve it. public class Login extends JFrame{ /** * */ private static final long serialVersionUID = 1023608189590961526L; JTextField userName, passWord, userNameLabel, passWordLabel; JTextField errorMsg; JButton login; JPanel userNamePanel, passWordPanel, errorMsgPanel, loginPanel; public Login(String Title){ super(Title);//Set Frame Title login = new JButton("Login"); initTextFields(); setLayout(new GridBagLayout()); userNamePanel = new JPanel(new GridBagLayout()); passWordPanel = new JPanel(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 1; constraints.weighty = 1; constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.gridx = 0; constraints.gridy = 0; userNamePanel.add(userNameLabel, constraints); passWordPanel.add(passWordLabel, constraints); constraints.gridy++; userNamePanel.add(userName, constraints); passWordPanel.add(passWord, constraints); constraints.gridwidth = GridBagConstraints.RELATIVE; constraints.fill = GridBagConstraints.NONE; this.add(userNamePanel, constraints); constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.gridx = 2; this.add(passWordPanel, constraints); constraints.gridy++; constraints.gridy++; constraints.gridx--; this.add(login, constraints); constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.gridx = 0; constraints.gridy--; this.add(errorMsg, constraints); errorMsg.setVisible…
has comment: http://stackoverflow.com/comment/35131859
score: 0
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/35128156
has comment: http://stackoverflow.com/comment/35128082
has title: I am trying to create nice JFrame login panel
tagged with: java
tagged with: jpanel
tagged with: jtextfield
type: Question

http://stackoverflow.com/comment/35308760
score: 0
type: Comment
type: QuestionComment
has text: It works now that I updated javac with update-alternatives and then selected Java 7 :D Thanks for your expert help @SotiriosDelimanolis :)
comment on: http://stackoverflow.com/q/23098721

http://stackoverflow.com/a/23128772
has comment: http://stackoverflow.com/comment/35363663
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23127603
answers question: http://stackoverflow.com/q/23127603
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/35362579
has body: That is a LOT of questions, I wouldn't expect anyone to answer all of them fully in one go. I'll give my best on questions 1 and 2: 1) When a method with @Transactional is invoked on a bean (i.e. not directly in the same class), Spring checks for an existing transaction and does something. That something is set by your configuration (and may be configured differently for methods or beans), see Transaction Propagation. So you could be using an existing one, making a new one or not using a transaction at all. 2) I found non-eager fetching to be a problem in my projects. It certainly is possible, but IMHO it's difficult to maintain and adds extra space for a mistake. This problem has been discussed before (answer is again: possible, but requires extra work, you should weight the benefits vs effort for your specific situation): Open Session In View Pattern
upvote count: 1

http://stackoverflow.com/q/23107835
tagged with: eclipse
tagged with: jfreechart
type: Question
has answer: http://stackoverflow.com/a/23218247
score: 0
answer count: 1
tagged with: e4
has body: I am using JFreechart in eclipse e4 application. I have dynamically created parts in a partstack say A. Each parts show some graph based on the selections other partstack say B. If I am in first part and made some selections from partstack B, the graph should be updated according to the selections I made. If I click on the second part and select some other inputs , it should show new gragh only in the second part. My problem is when I click on the second part and select some inputs and the graph is drawn but the changes in the graph are also replicated in the first part. For sending the data from partstack B to parts in the partstack A, I am using the Eventbroker service. @Inject @Optional void getStatisticEvent(@UIEventTopic("values_stat/UI_Event")ArrayList&lt;TreeMap&lt;Timestamp, Long&gt;&gt; statisticalValues){ //some code to create the timeseries dataset.addSeries(t); }
has title: TImeseries chart get replicated in all the parts of GUI in eclipse e4
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/23104146
answers question: http://stackoverflow.com/q/23103706
type: Answer
has body: Could be because you have two jClientSessionId and no jUserSessionId in the @RequestMapping ({jClientSessionId}/{jClientSessionId})?
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23103706

http://stackoverflow.com/comment/35086849
comment on: http://stackoverflow.com/q/22976752
has text: @derstrom8 Nevermind on my last comment. Yes the console does automatically show when a `System.out.print` is done but does not show if, for e.g., the program is asking for an input from a Scanner.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35292115
type: QuestionComment
type: Comment
has text: I am trying to use what java is giving me. I just dont know where to sue it at and all that good stuff.
score: 0
comment on: http://stackoverflow.com/q/23090346

http://stackoverflow.com/q/23091328
has comment: http://stackoverflow.com/comment/35294164
tagged with: swing
has comment: http://stackoverflow.com/comment/35294116
downvote count: 0
has comment: http://stackoverflow.com/comment/35297199
has comment: http://stackoverflow.com/comment/35294429
tagged with: java
tagged with: jpanel
tagged with: eclipse
has title: cannot find javax.swing.JPanel
type: Question
has body: I'm a novice in java coding. Just downloaded the JDK 8 and Eclipse java ee ide. eclipse cannot find JPanel. the error says the JPanel has an access restriction. how do I fix this? here is my program import java.awt.*; import java.awt.event.*; import javax.swing.*; public class purcellm26try2 extends JPanel { public void paintComponent(Graphics g){ super.paintComponent(g); this.setBackground(Color.WHITE); g.setColor(Color.WHITE); } } I can rephrase my question if users don't understand. Thank you
favorite count: 0
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/22998285
downvote count: 0
score: 1
has body: Using a Supplier to specify the way to create an instance: public static &lt;T&gt; T[] fullArray(Class&lt;T&gt; componentType, int n, Supplier&lt;? extends T&gt; constructor) { // This introduces no new type-unsafety. // Array.newInstance has to return Object since it can take a primitive // component type and !(new int[0] instanceof Object[]), but we know that // the result is a reference type since type parameters like T can only // bind to reference types. @SuppressWarnings("unchecked") T[] array = (T[]) Array.newInstance(componentType, n); for (int i = 0; i &lt; n; ++i) { array[i] = constructor.get(); } return array; } Instead of Foo[] foos = new Foo[42]; for (int i = 0; i &lt; foos.length; ++i) { foos[i] = new Foo(); } you could do Foo[] foos = fullArray( Foo.class, 42, new Supplier&lt;Foo&gt;() { public Foo get() { return new Foo(); } }); or in Java 8 Foo[] foos = fullArray(Foo.class, 42, () -&gt; new Foo());
upvote count: 1
has comment: http://stackoverflow.com/comment/35125594
type: Answer
answers question: http://stackoverflow.com/q/22998005

http://stackoverflow.com/comment/35299838
score: 0
type: QuestionComment
type: Comment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/50727/discussion-between-salauyou-and-user2676468)
comment on: http://stackoverflow.com/q/23092178

xfire
tags question: http://stackoverflow.com/q/23003505
tag name: xfire
type: Tag

http://stackoverflow.com/a/23078814
type: Answer
answers question: http://stackoverflow.com/q/23078747
score: 0
has comment: http://stackoverflow.com/comment/35271746
has body: I'm not sure, if this is the problem, but in your Spring configuration you have emf as bean name, and in the AbstractDao you have entityManagerFactory as qualifier. So i guess Spring fails to inject the correct bean.

http://stackoverflow.com/comment/49500939
has text: What package is "Type" from? There are a million packages containing the class "Type". Thank you.
type: AnswerComment
comment on: http://stackoverflow.com/a/27976073
type: Comment
score: 1

http://stackoverflow.com/comment/35305949
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23097769
has text: @jimmycarr it's quiet unclear what the OP wants but +1 to your response.

http://stackoverflow.com/a/23121635
has comment: http://stackoverflow.com/comment/35348287
has comment: http://stackoverflow.com/comment/35348271
has comment: http://stackoverflow.com/comment/35348264
has comment: http://stackoverflow.com/comment/35348561
upvote count: 1
downvote count: 0
has body: Your for loop isn't looping enough times to iterate through the entire array. It will only get the first 5 elements. As a general rule you need to increment i to the length of the array. So change your for loop to this: for(int i = 0; i &lt; 6; i++) // 6 is the number of points so that's what you need to go to. { xArray[i]=xPoints.get(i); yArray[i]=yPoints.get(i); } In addition your method of drawing is slightly wrong for swing components. You should draw as is demonstrated in this tutorial. So your complete method will look like this: class MyPanel extends JPanel { public MyPanel() { setBorder(BorderFactory.createLineBorder(Color.black)); } public void paintComponent(Graphics g) { super.paintComponent(g); if(count==6) { for(int i = 0; i &lt; 6; i++) { xArray[i]=xPoints.get(i); yArray[i]=yPoints.get(i); } } } } In your constructor you need to add: getContentPane().add(new MyPanel()); Before you set the frame visible to true or else it won't paint.
has comment: http://stackoverflow.com/comment/35349267
has comment: http://stackoverflow.com/comment/35347934
has comment: http://stackoverflow.com/comment/35348352
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23121472

http://stackoverflow.com/comment/35109823
type: Comment
has text: Ahh, great. Now I understand why the sysouting works :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22989888

http://stackoverflow.com/q/23087782
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35293993
has comment: http://stackoverflow.com/comment/35293285
downvote count: 0
has comment: http://stackoverflow.com/comment/35294025
has comment: http://stackoverflow.com/comment/35293759
type: Question
accepted answer: http://stackoverflow.com/a/23116239
tagged with: java
has body: I'm migrating an application that used to use log4j to logback/slf4j and have been having issues for about 2 weeks now... I made a small project to test logback/slf4j and that worked great, but for some reason when applying it to the actual app it just doesnt want to work. I'm using JBoss 6.2 and deploying an EAR to the standalone/deployments directory and starting the server (which is all good and happy, except for the fact that I'm getting this exception java.lang.ClassCastException: org.slf4j.impl.Slf4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext) but anyway, back to the main problem. when I run the application I get this printed to the log file I specified 10:51:06.752 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider 10:51:06.780 [main] DEBUG o.j.n.r.client.InitialContextFactory - Looking for jboss-naming-client.properties using classloader sun.misc.Launcher$AppClassLoader@194d4313 10:51:06.782 [main] DEBUG o.j.n.r.client.InitialContextFactory - jboss.naming.client.endpoint.create.options. has the following options {} 10:51:06.783 [main] DEBUG o.j.n.r.client.InitialContextFactory - jboss.naming.client.remote.connectionprovider.create.options. has the following options {} 10:51:06.789 [main] INFO org.xnio - XNIO Version 3.0.7.GA-redhat-1 10:51:06.798 [main] INFO org.xnio.nio - XNIO NIO Implementation Version 3.0.7.GA-redhat-1 10:51:06.815 [main] INFO org.jboss.remoting - JBoss Remoting version 3.2.18.GA-redhat-1 10:51:06.856 [Remoting "config-based-naming-client-endpoint" read-1] DEBUG org.xnio.nio - Started channel thread 'Remoting "config-based-naming-client-endpoint" read-1', selector sun.nio.ch.WindowsSelectorImpl@2668d102 10:51:06.856 [Remoting "config-based-naming-client-endpoint" write-1] DEBUG org.xnio.nio - Started channel thread 'Remoting "config-based-naming-client-endpoint" write-1', selector sun.nio.ch.WindowsSelectorImpl@2b71ee01 10:51:06.915 [main] DEBUG o.j.n.r.client.InitialContextFa…
tagged with: logback
tagged with: jboss
tagged with: slf4j
has title: jboss not using logback for logging
has answer: http://stackoverflow.com/a/23116239
score: 5
answer count: 1
has comment: http://stackoverflow.com/comment/35293967
favorite count: 0
has comment: http://stackoverflow.com/comment/35293872
upvote count: 5

http://stackoverflow.com/comment/35093289
type: QuestionComment
has text: Are you 100% sure your Java program connects to the same database?
comment on: http://stackoverflow.com/q/22980134
score: 0
type: Comment

http://stackoverflow.com/comment/35546397
type: Comment
has text: @IanRoberts I have also thought of Log4J is loading another config. However, OP mentioned that the log file got created but just nothing is logged inside, which seems suggest to me the config file is really used.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23128852

http://stackoverflow.com/comment/35292974
type: Comment
comment on: http://stackoverflow.com/a/23090755
has text: @user2357112: Of course, I switched them around. Fixed.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35247906
score: 0
has text: `list2 = new ArrayList<>(list1)`.
comment on: http://stackoverflow.com/q/23065657
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35317068
comment on: http://stackoverflow.com/q/23104762
score: 0
type: Comment
type: QuestionComment
has text: After `JAR` adding you have to clean and built your project.

http://stackoverflow.com/comment/35180817
type: QuestionComment
has text: why dont you use String row1=rowInput.next();
comment on: http://stackoverflow.com/q/23028789
score: 0
type: Comment

http://stackoverflow.com/a/23009105
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35144808
answers question: http://stackoverflow.com/q/23008962
has comment: http://stackoverflow.com/comment/35144885
downvote count: 0
has comment: http://stackoverflow.com/comment/35144924
accepted answer of: http://stackoverflow.com/q/23008962
has body: You are converting your character array to a string in the wrong fashion. Try: content = new String(tmp); Your original code was calling .toString() on an array, which simply calls the Object.toString() implementation. Hence you got something like [C@609a5d54: [ indicates an array type C indicates the char type @ separates type from hashcode 609a5d54 was the hashcode (different each time the code runs) See Object.toString() and Class.getName() for furthed details.
has comment: http://stackoverflow.com/comment/35144717
type: AcceptedAnswer

http://stackoverflow.com/comment/35158149
type: QuestionComment
has text: Debug your code. You will learn the mistakes.
comment on: http://stackoverflow.com/q/23016274
score: 0
type: Comment

http://stackoverflow.com/q/23112193
has comment: http://stackoverflow.com/comment/35335010
tagged with: escaping
has comment: http://stackoverflow.com/comment/73557428
linked to: http://stackoverflow.com/q/3020094
has body: While writing a JSON parser in Java I ran into a "cosmetic" problem: In the JSON specification it's clearly said that Javascript control characters are the same as e.g. in C and Java, like \n or \t. The problem I was running into, is that when there are control codes within a JSON string (so within the quotes: "property":"value"), then the displayed JSON code is messed up because the control characters are changing the print, e.g. \n creates a new line or \t creates a tab. An example: String s = "{\n\t\"property1\": \"The quick brown fox\njumps over the lazy dog\",\n\t\"property2\":\"value2\"\n}" Printing as: { "property1": "The quick brown fox jumps over the lazy dog", "property2": "value2" } The solution would look like this: String s = "{\n\t\"property1\": \"The quick brown fox\\njumps over the lazy dog\",\n\t\"property2\": \"value2\"\n}" Printing "correctly" as: { "property1": "The quick brown fox\njumps over the lazy dog", "property2": "value2" } So my question: Is it correct to treat control code outside strings differently than the control code within strings? And is it correct to add within JSON strings another backslash \ before any control characters, creating strings like "\n" or "\t" that won't have any effect on the look of JSON strings?
has comment: http://stackoverflow.com/comment/35339551
answer count: 1
has comment: http://stackoverflow.com/comment/35335152
downvote count: 0
has comment: http://stackoverflow.com/comment/35330303
has comment: http://stackoverflow.com/comment/35330611
has answer: http://stackoverflow.com/a/23113604
tagged with: string
tagged with: parsing
has title: Escaping of JSON control characters within string
favorite count: 0
has comment: http://stackoverflow.com/comment/35334663
has comment: http://stackoverflow.com/comment/35330699
has comment: http://stackoverflow.com/comment/35332198
has comment: http://stackoverflow.com/comment/35333039
has comment: http://stackoverflow.com/comment/35330437
has comment: http://stackoverflow.com/comment/35331093
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35330491
has comment: http://stackoverflow.com/comment/35332771
score: 1
accepted answer: http://stackoverflow.com/a/23113604
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
type: Question

http://stackoverflow.com/comment/35112069
has text: Your question states that your cookie name is `data`. You can find it server side by checking for `name.equals("data")` in above code.
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/22988890

http://stackoverflow.com/a/22970831
upvote count: 1
answers question: http://stackoverflow.com/q/22970785
downvote count: 0
has comment: http://stackoverflow.com/comment/35076036
has comment: http://stackoverflow.com/comment/35077000
has comment: http://stackoverflow.com/comment/35076543
has comment: http://stackoverflow.com/comment/35077483
has comment: http://stackoverflow.com/comment/35076397
type: Answer
has body: You should be using a Card Layout. Read the section from the Swing tutorial on How to Use Card Layout for more information and working examples.
score: 1

http://stackoverflow.com/q/22999716
has answer: http://stackoverflow.com/a/22999815
has answer: http://stackoverflow.com/a/22999855
score: 0
answer count: 2
has title: How to synchronize access to class field in Java?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35128247
tagged with: multithreading
has body: There is a variable in the class, which is actively used by multiple threads. For example: public class A { private int magicVar; private void someMethod() { // some operations with magicVar } public synchronized void somePublicMethod() { // some operations with magicVar } private class B extends Thread { @Override private void run() { // some operations with magicVar } } } How to organize access to the variable in this case? To describe private synchronized setter and getter? Or to mark this field as violate?
type: Question
tagged with: java

http://stackoverflow.com/a/23354417
has body: From the log file output it seems none of tcollector plugins are actually running. They get spawned and are removed right after due to errors.
answers question: http://stackoverflow.com/q/23080351
score: 0
type: Answer

http://stackoverflow.com/comment/35168073
has text: All looks good - I'll be able to test it on Monday. How does it know to use the Builder? Thanks for the injection suggestion - that should solve my other problem very neatly.
type: Comment
comment on: http://stackoverflow.com/a/23018626
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35174821
has text: gotcha, I'll definitely look into this I wanted to add some buttons so I figured Grid would help out a little bit but as you mentioned I should definitely rethink this I'll give the layout managers a look over, once again thanks a lot.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23025025
type: Comment

http://stackoverflow.com/comment/35281704
score: 0
has text: Thanks for a recommendation but I don't see there a possible solution. I need to call all getters of object class dynamically.. or find another better solution.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23084344

http://stackoverflow.com/comment/35326056
type: Comment
type: QuestionComment
has text: `ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);` Not working :(
score: 0
comment on: http://stackoverflow.com/q/23109185

http://stackoverflow.com/q/23024487
answer count: 2
tagged with: random
tagged with: for-loop
has comment: http://stackoverflow.com/comment/35173698
has comment: http://stackoverflow.com/comment/35174057
has answer: http://stackoverflow.com/a/23024811
has answer: http://stackoverflow.com/a/23160049
score: 0
accepted answer: http://stackoverflow.com/a/23160049
tagged with: file-io
possible better answer: http://stackoverflow.com/a/23024811
type: AnsweredQuestion
has title: When writing to files, it writes the same integers instead of different integers
has comment: http://stackoverflow.com/comment/35173924
has comment: http://stackoverflow.com/comment/35173949
tagged with: java
has body: If you need any explanation, please feel free to ask. The objective of the EquationsAndAnswers class is to generate 8 arrays, 4 of string type, and 4 of double type and populate them with addition equations, then answers and so on for each basic mathematic operator. Then, from these 8 arrays, it should randomly select equations, one at a time, from any of the four string type equation arrays. After selecting the random equations and corresponding answers to be written, it writes them to the file(equations.txt). My problem is that after I call the writeBoth method from the Menu class, the equations.txt file looks like this: 6 + 10 6 + 10 8 - 9 8 - 9 6 + 10 8 - 9 6 + 10 rather than like this: 1+2 3-2 4*5 10÷2 My class Menu: public class Menu { public static boolean additionBool = true; public static boolean subtractionBool = true; public static boolean multiplicationBool = true; public static boolean divisionBool = true; public static boolean doubleDigitBool = false; new EquationsAndAnswers().writeBoth(); } My class EquationsAndAnswers: import java.util.Random; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import javax.swing.JOptionPane; public class EquationsAndAnswers { /*Random Generators*/ Random singleDigitNaturalGen = new Random(); Random randomEquationPicker = new Random(); Random doubleDigitNaturalGen = new Random(); public void writeBoth(){ /*Declaration of Four Basic Mathematic Operation Equation Arrays and Corresponding Answers*/ String additionArrayEquation[] = new String[100]; int additionArrayAnswers[] = new int[100]; String subtractionArrayEquation[] = new String[100]; int subtractionArrayAnswers[] = new int[100]; String multiplicationArrayEquation[] = new String[100]; int multiplicationArrayAnswers[] = new int[100]; String divisionArrayEquation[] = new String[100]; double divisionArrayAnswers[] = new double[100]; String assortedEquations[] = new String[100]; double assortedAnswers[] = new dou…
type: Question

http://stackoverflow.com/comment/35215630
has text: No, `Executors.newFixedThreadPool(4)` creates 4 threads. The Handler-runnables are automagically run on one of those 4 threads. The handler constructor takes the socket as argument, and can use it in its run() method. If the handlers are slow, and 5 connections come in, the 5th will have to wait till one of the previous 4 finishes.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23047687

http://stackoverflow.com/comment/35238676
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23060774
type: QuestionComment
has text: Please post minimal executable code reproducing your problem.

http://stackoverflow.com/q/23025087
has answer: http://stackoverflow.com/a/23025125
has body: I am using intellij IDEA and I have followed all instructions I was told to export my project as a .jar. It says that I am not able to use my jar as an api and call the methods. HEre's my jar: ` package me.JBoss925.com; import com.sun.org.apache.xerces.internal.xs.StringList; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.block.Action; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.inventory.Inventory; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.UUID; /** * Created by JBoss925 on 4/11/14. * Made for beginners and people who want to spend less time on code. * If you can see this please tell me how you were able to decompile this. */ public class api extends JavaPlugin{ public static AsyncPlayerChatEvent chat; public static PlayerJoinEvent join; public static PlayerInteractEvent pie; public static void setKilled(Player victim, boolean killed){ if(killed == true){ victim.setHealth(0.0); } } public static void openInventory(Player player, Inventory inventory){ player.openInventory(inventory); } public static void closeInventory(Player player, Inventory inventory){ if(player.getOpenInventory().equals(inventory)){ player.closeInventory(); } } public static void tellPlayer(Player receiver, String message){ receiver.sendMessage(message); } public static void replaceCurseWords(boolean allowed){ if(allowed == true){ return; } if(allowed == false){ if(chat.getMessage().contains("crap")){ chat.getMessage().replace("crap", "flip"); } if(chat.getMessage().contains("good")){ chat.getMessage().replace("good", "poop"); } if(chat.getMessage().contains("damn")){ chat.getMessage().replace("damn", "darn"); } if(chat.getMessage().contains("douche")){ chat.ge…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35174929
tagged with: java
type: Question
score: 0
answer count: 2
tagged with: api
has answer: http://stackoverflow.com/a/23029250
tagged with: jar
has comment: http://stackoverflow.com/comment/35174945
has title: How to use my own .jar as an api/library?

http://stackoverflow.com/comment/35283877
score: 0
type: Comment
has text: I ran the tests that seem to confirm my answer.
comment on: http://stackoverflow.com/a/23084749
type: AnswerComment

http://stackoverflow.com/a/23034976
accepted answer of: http://stackoverflow.com/q/22979846
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35198090
has comment: http://stackoverflow.com/comment/35204851
upvote count: 1
type: AcceptedAnswer
has body: This tutorial explains how to do it in Eclipse. And for completeness sake, here is how to do it using ant and IntelliJ. I hope this was useful. I will try the Eclipse one now...
has comment: http://stackoverflow.com/comment/35194380
answers question: http://stackoverflow.com/q/22979846
type: Answer

http://stackoverflow.com/comment/35321512
type: Comment
has text: Thank you Schollii, I'd like to test your solution. But at the moment I'm having some errors, that I THINK might depend on the fact that my `unsigned char*` contains any ASCII character also greater than 128
type: AnswerComment
comment on: http://stackoverflow.com/a/23100720
score: 0

math
tags question: http://stackoverflow.com/q/22996752
tags question: http://stackoverflow.com/q/23105684
tags question: http://stackoverflow.com/q/23086596
tags question: http://stackoverflow.com/q/22976698
tags question: http://stackoverflow.com/q/23100275
type: Tag
tags question: http://stackoverflow.com/q/23123354
tags question: http://stackoverflow.com/q/23048698
tags question: http://stackoverflow.com/q/23073822
tags question: http://stackoverflow.com/q/23003519
tags question: http://stackoverflow.com/q/23002218
tags question: http://stackoverflow.com/q/23120746
tags question: http://stackoverflow.com/q/23012447
tags question: http://stackoverflow.com/q/23063423
tag name: math
tags question: http://stackoverflow.com/q/23115739

http://stackoverflow.com/comment/35319670
type: Comment
comment on: http://stackoverflow.com/q/23105982
score: 1
has text: I'm sorry but you should start with more basic programs to properly understood OO design and the basics of Java programming, the issue is that you need to make your fields static as well, to be honest, in this code you don't need the fields at all since you're creating local variables for them anw
type: QuestionComment

http://stackoverflow.com/a/23036302
upvote count: 2
has body: No, it cannot. The servlet-name elements must match at this is how the servlet and servlet-mapping elements are tied together. Think of it as an id. If you want to add a description to the servlet you can use the description element. You can also use comments.
answers question: http://stackoverflow.com/q/23036284
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/35145823
comment on: http://stackoverflow.com/q/23009624
has text: I think it's not relevant.......the only thing I believe it matters regarding queries and/or tables is that each Unit row has a FamilyId that a matches a single row in Family table. That's why you'll find `uns.get(i).getFamilyId() == this.FamilyId` in the Family constructor method.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35169310
comment on: http://stackoverflow.com/a/23022042
type: AnswerComment
has text: but if we talk of primitive values then, it is not about subtypes but which values can be passed. Moreover why obj.m(Byte.valueOf(b), 24) calls m(Number n, int i) method ?
type: Comment
score: 0

http://stackoverflow.com/q/23109809
has title: Java8: select min value from specific field of the objects in a list
has body: Suppose to have a class Obj class Obj{ int field; } and that you have a list of Obj instances, i.e. List&lt;Obj&gt; lst. Now, how can I find in Java8 the minimum value of the int fields field from the objects in list lst?
answer count: 2
has answer: http://stackoverflow.com/a/23112231
favorite count: 0
tagged with: minimum
accepted answer: http://stackoverflow.com/a/23112231
tagged with: java-8
type: AnsweredQuestion
tagged with: java-stream
tagged with: java
possible better answer: http://stackoverflow.com/a/23109899
score: 9
type: Question
has answer: http://stackoverflow.com/a/23109899
upvote count: 9
downvote count: 0

http://stackoverflow.com/comment/35151926
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23012825
has text: Now I can see the drawing. But half of the drawing is out of the screen.

http://stackoverflow.com/comment/35351430
score: 0
type: Comment
type: QuestionComment
has text: and this one also [Why only 1 public class](http://stackoverflow.com/questions/3578490/why-only-1-public-class-in-java-file)
comment on: http://stackoverflow.com/q/23123668

http://stackoverflow.com/comment/35283100
type: AnswerComment
score: 0
type: Comment
has text: @user3159253 sure there is, but the question was "how to use constants". Anyway, I will add the information, thanks.
comment on: http://stackoverflow.com/a/23085471

http://stackoverflow.com/comment/35348422
comment on: http://stackoverflow.com/a/23120952
type: AnswerComment
score: 0
type: Comment
has text: You would call `Integer.toString(askQuestion());`

http://stackoverflow.com/q/23029289
downvote count: 0
type: UnansweredQuestion
has body: For some unusual reason, when I am using FileWriter for Java Netbean, the file gets written into this directory: C:\Users\myname\AppData\Roaming\NetBeans\7.2\config\GF3\domain1 rather than to my working directory, which is at the desktop. I used this code to check my User Directory, and it returns this: System.out.println(System.getProperty("user.dir")); INFO: C:\Users\myname\AppData\Roaming\NetBeans\7.2\config\GF3\domain1 which is obviously NOT my working directory where my source code is. I thought I could have accidentally configured Netbeans to change the directory, but I checked through NetBeans menu and can't figure out how to undo this. I have never had this problem before in my previous projects. As simple as the following code, the file should appear in my working directory. File file = new File("myFile.xml"); Instead now I'm being forced to enter the path name to make the file save into my working directory, which is not going to be dynamic if I change computer. String dir = "C:\\Users\\myname\\Desktop\\Assignment\\IRAssignmentJ\\"; File file = new File(dir + "myFile.xml"); Please enlighten me how do I solve this.
tagged with: file
has answer: http://stackoverflow.com/a/23029463
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
tagged with: directory
favorite count: 0
has title: Why is a file being saved to a different directory path in NetBeans?
tagged with: netbeans

http://stackoverflow.com/comment/35271341
comment on: http://stackoverflow.com/a/23077728
type: AnswerComment
has text: I have tried this but not working. Still error persists! Thanks for your answer.
score: 0
type: Comment

http://stackoverflow.com/comment/94855437
score: 1
has text: Voting does not obligate to comment, whether it's up- or down-voting. This is according to community guidelines. Even though it may be frustrating to not know the reason for a vote.
type: AnswerComment
comment on: http://stackoverflow.com/a/23110835
type: Comment

http://stackoverflow.com/comment/35325718
comment on: http://stackoverflow.com/q/23099931
score: 0
type: Comment
type: QuestionComment
has text: In my program frequency doesn't corresponds to notes, but in java library the given note numbers corresponds to some fixed frequencies.

tcp
type: Tag
tags question: http://stackoverflow.com/q/23025534
tags question: http://stackoverflow.com/q/23053373
tags question: http://stackoverflow.com/q/23081739
tags question: http://stackoverflow.com/q/23037063
tags question: http://stackoverflow.com/q/23061938
tag name: tcp

http://stackoverflow.com/q/23000174
has comment: http://stackoverflow.com/comment/35130101
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35129209
has comment: http://stackoverflow.com/comment/35130130
has body: My code is below. I'm having trouble with the deletion method, I can not delete a node in the binary search tree and replace it without creating two of the replacement nodes... How can I fix this? public class BSTMain { public static void DeleteValue(int num, BSTNode root){ BSTNode cursor = root; while(true){ //move cursor while(cursor.getLeft()!=null &amp;&amp; num&lt;cursor.getData()){ //move cursor cursor = cursor.getLeft(); } while(cursor.getRight()!=null &amp;&amp; num&gt;cursor.getData()){ //move cursor cursor = cursor.getRight(); } if(cursor.getData() == num || (cursor.getLeft()==null &amp;&amp; num&lt;cursor.getData()) || (cursor.getRight()==null &amp;&amp; num&gt;cursor.getData())) //check for placing cases break; //time to delete node in the tree } if(cursor.getData()==num){//delete node if(cursor.getLeft()!=null){ //if left exists BSTNode cursor2 = cursor.getLeft(); while(cursor2.getRight()!=null){ //get rightmost of left to replace cursor2 = cursor2.getRight(); } cursor.setData(cursor2.getData()); //replace cursor if(cursor2.getLeft()!=null) cursor2.getLeft().root = cursor2.root; //Replace cursor2 cursor2.root.setRight(cursor2.getLeft()); } else if(cursor.getRight()!=null){ //if no left but right BSTNode cursor2 = cursor.getRight(); while(cursor2.getLeft()!=null){ //get leftmost of right cursor2 = cursor2.getLeft(); } cursor.setData(cursor2.getData()); //replace cursor if(cursor2.getRight()!=null) cursor2.getRight().root = cursor2.root; //Replace cursor2 cursor2.root.setLeft(cursor2.getRight()); } else { System.out.println("Node " + num + " does not exist!"); } } else System.out.println(num + " does not exist in Binary Search Tree!"); } } Some Output: In Order: 19 20 21 22 23 23 45 Command: D 19 After Deletion: 20 20 21 22 23 23 45 Command: D 20 After Deletion: 20 20 21 22 23 23 45 Command: D 21 After Deletion: 20 20 22 23 23 45 Command: D 22 After Deletion: 20 20 20 20 23 23 45 Command: D 23 After Deletion: 20 20 20 20 23 23 20 20 20 20 45 Command: D 45…
score: 0
has title: How do I remove a node in a BST without duplicating nodes?
has comment: http://stackoverflow.com/comment/35129304
tagged with: binary-search-tree
type: UnansweredQuestion

http://stackoverflow.com/a/30392449
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23079603
upvote count: 2
has body: After lots of testing, trying to get Java parameterisation working with an abstract parent (Single-table inheritance), and an abstract child table (one-table-per-class inheritance), I've given up. It may be possible, but often you get problems where Hibernate tries to instantiate an abstract (parameterised) class as an entity. I would suggest rewriting it using the JPA inheritance, moving the parameterised stuff down into extending classes. That way you get the same polymorphism back from the database. @MappedSuperclass @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "CLASS_TYPE", discriminatorType = DiscriminatorType.STRING) public abstract class ClassA { [...] } extension B: @Entity @DiscriminatorValue=("B") public class ClassB extends ClassA { @OneToOne @JoinColumn(name = "mycolumn_id") private Integer instance; [...] } extension C: @Entity @DiscriminatorValue=("C") public class ClassC extends ClassA { @OneToOne @JoinColumn(name = "mycolumn_id") private String instance; [...] }

http://stackoverflow.com/comment/35303817
type: QuestionComment
comment on: http://stackoverflow.com/q/23096555
type: Comment
has text: please post your `servlet-context.xml` as well.
score: 0

http://stackoverflow.com/q/23044060
has title: How access native provider API with Jclouds 1.7
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23062821
type: Question
downvote count: 0
tagged with: amazon-ec2
tagged with: amazon-web-services
tagged with: jclouds
answer count: 1
accepted answer: http://stackoverflow.com/a/23062821
favorite count: 0
has body: Using JClouds, up to version 1.6.x it was possible to access to the native EC2 provider API by using the following idiom: AWSEC2Client ec2Client = AWSEC2Client.class.cast(context.getProviderSpecificContext().getApi()); Actually, I copied from the documentation page: http://jclouds.apache.org/guides/aws/ It turns out that in the latest release this method has been removed. Is there an alternative method/way to access to the provider specific features (security groups, key-pairs, etc)?

http://stackoverflow.com/comment/35318967
comment on: http://stackoverflow.com/q/23103844
score: 0
has text: Yes, you are right! Please, yours is the honor: edit my question!
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35209241
type: QuestionComment
comment on: http://stackoverflow.com/q/23044719
score: 0
has text: Do you mean a single database replicated in 199 servers or 200 different databases?
type: Comment

http://stackoverflow.com/comment/35170524
type: Comment
comment on: http://stackoverflow.com/q/23022110
has text: (What are the units for "Bytes Allocated", BTW? Clearly not unit bytes. Kbytes?)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35294159
type: Comment
has text: @KonradRudolph: "these APIs precede the introduction of generic types" has nothing to do with it. The version `public static <T> int binarySearch(T[] a, T key, Comparator<? super T> c)` existed from before generics (Java 1.2), but use `T` now. Why? Because in this case, the `T` narrows the set of allowed inputs. In the case of the versions without the comparator, the `T` does not narrow the set of allowed inputs. It is therefore pointless to add it.
type: AnswerComment
comment on: http://stackoverflow.com/a/23079176
score: 0

http://stackoverflow.com/a/23087549
type: AcceptedAnswer
score: 0
has body: Make sure to initialize database variable before calling: long insertId = database.insert(PointsDB.TABLE_NAME, null, values); You should do: database = points.getWritableDatabase();
type: Answer
has comment: http://stackoverflow.com/comment/35286867
accepted answer of: http://stackoverflow.com/q/23087491
answers question: http://stackoverflow.com/q/23087491

http://stackoverflow.com/a/22996659
accepted answer of: http://stackoverflow.com/q/22996203
has body: I am using something similar to what you presented above. The difference is that I keep in the singleton the SQLiteDatabase object and have wrapper methods for the CRUD operations and synchronize the SQLiteDatabase object in those so the user of the class won't have direct access to the SQLiteDatabase object unless it is synchronized. I am not sure if the method you use is thread safe since you didn't posted some code but if you don't use a synchronization mechanism then I suppose it isn't as I don't think that getWritableDatabase() method does that for you. EDIT As Petar mentioned it seems that it is a default synchronization mechanism behind so I think the logic you are using should work fine.
answers question: http://stackoverflow.com/q/22996203
has comment: http://stackoverflow.com/comment/35122426
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35122554
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/35334619
type: QuestionComment
type: Comment
has text: @TheodorosChatzigiannakis I agree that C++ is not a Toy. ;)
comment on: http://stackoverflow.com/q/23114321
score: 0

http://stackoverflow.com/a/31975575
has body: May be this will make it more clear, and of course makes sense too. @Entity @Table(name = "users") /** * * @author Ram Srinvasan * Use class name in NamedQuery * Use table name in NamedNativeQuery */ @NamedQueries({ @NamedQuery(name = "findUserByName", query = "from User u where u.name= :name") }) @NamedNativeQueries({ @NamedNativeQuery(name = "findUserByNameNativeSQL", query = "select * from users u where u.name= :name", resultClass = User.class) }) public class User implements Principal { ... }
type: Answer
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/23018836
upvote count: 5

http://stackoverflow.com/a/23103390
has body: Indeed, Erlang provides a module for Socket programming that you can use. Go with your option number one. But is such low level programming is a must for you? If not for your game, then consider creating a REST API. It is HTTP after all. Thus you can achieve: general protocol sent over the network that all languages interprets
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35316007
downvote count: 0
answers question: http://stackoverflow.com/q/23103082
type: Answer
has comment: http://stackoverflow.com/comment/35323354

http://stackoverflow.com/comment/35328640
comment on: http://stackoverflow.com/a/23093278
score: 0
type: AnswerComment
type: Comment
has text: @SavannahC123 I fixed my code dump so it now has comments and a brief explanation.

http://stackoverflow.com/comment/35337842
has text: if I also need < > , you mean only change this with <0 and >0 in the right?
score: 1
comment on: http://stackoverflow.com/q/23116143
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22981620
has comment: http://stackoverflow.com/comment/35095369
type: Answer
has body: Try to use Handler messages to do that: private Handler handler = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch(msg.what){ case 1:{ long totalDuration = mediaPlayer.getDuration(); long currentDuration = mediaPlayer.getCurrentPosition(); seekBar.setProgress(progress); nowduration.setText("" + utils.milliSecondsToTimer(currentDuration)); totalduration.setText(""+utils.milliSecondsToTimer(totalDuration)); // Running this thread after 100 milliseconds mHandler.sendEmptyMessageDelayed(1, 100); }break; } } }; And first update start: ... handler.sendEmptyMessage(1); ...
has comment: http://stackoverflow.com/comment/35095086
has comment: http://stackoverflow.com/comment/35095011
answers question: http://stackoverflow.com/q/22981463
score: 0

http://stackoverflow.com/a/23117496
has body: You are using: t.find("HELLO1"), which will be passed to your getFreq() function. it will proceed calling getFreq() with ELLO1, LLO1, LO1, O1 At the point, when the implementation retries it with only word 1 due due your recursive aproach, it will result in int val = word.charAt(0) - 64; // 49-64 and thats a value of val = -15 - and that's not a valid array index.
type: Answer
answers question: http://stackoverflow.com/q/23117151
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35477802
downvote count: 0
has comment: http://stackoverflow.com/comment/35340415

http://stackoverflow.com/comment/35158800
type: Comment
comment on: http://stackoverflow.com/a/23016809
has text: you can use contains, instead of find user, right?. Of course, if the equals/hashCode implementation discriminate by username
score: 0
type: AnswerComment

http://stackoverflow.com/q/23106093
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23106578
has comment: http://stackoverflow.com/comment/35319729
tagged with: java-8
has comment: http://stackoverflow.com/comment/35319623
type: AnsweredQuestion
tagged with: java-stream
possible better answer: http://stackoverflow.com/a/23556852
tagged with: java
has answer: http://stackoverflow.com/a/23556852
accepted answer: http://stackoverflow.com/a/23106578
type: Question
has body: I was learning how to use java 8 streams when I noticed something weird. Arrays.stream() has methods for everything but float arrays : Arrays.stream(int[]) : IntStream Arrays.stream(long[]) : LongStream Arrays.stream(double[]) : DoubleStream Similarly, there are Stream implementations for int, double etc but not floats : IntStream LongStream DoubleStream Is there a reason for that? what is the recommended way to work with float streams?
has title: How to get a Stream from a float[]
has answer: http://stackoverflow.com/a/37492716
has comment: http://stackoverflow.com/comment/35319351
score: 53
has comment: http://stackoverflow.com/comment/35347680
answer count: 3
upvote count: 53

http://stackoverflow.com/comment/35233962
has text: Thanks Avigen. Is there any conversion or migration tools available for conversion of controllers and other .net code to Java?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23057929
score: 0

http://stackoverflow.com/q/23041513
favorite count: 0
has comment: http://stackoverflow.com/comment/35203380
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23041578
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/32762784
tagged with: resources
type: Question
accepted answer: http://stackoverflow.com/a/23041578
has answer: http://stackoverflow.com/a/23041560
has answer: http://stackoverflow.com/a/32762784
score: 3
answer count: 3
has title: getResourceAsStream() hell
has body: Can someone explain me please how .getResourceAsStream() is really working. I try to figure out the painful facts, that in some cases getClass().getResourceAsStream(name); will work fine in eclipse but not in the deployed version (NPE). Another fact I am facing is, that sometimes getClass().getResource(name); returns a perfectly valid url but getClass().getResourceAsStream(name); returns null. Has someone written a library where I just pass the package (path) and filename and receive the stream without nagging? EDIT: This is something general which affects me everytime I have to use getResourceAsStream(). Yes I could provide a code snipped for the actual situation but this is not helping me for the next time until I do not understand how getResourceAsStream is working. EDIT 2: And what is the difference between: MyClass.class.getResourceAsStream(...) this.getClass().getResourceAsStream(...), MyClass.class.getClassLoader().getResourceAsStream(...) Thread.currentThread().getContextClassLoader().getResourceAsStream(...) EDIT 3: Also, while some.package.SomeClass.class.getResourceAsStream("/path/only/holding/resource.files") is not able to load resources in a classpath holding no classes but only files. This variant is able to do so: ClassLoader.class.getResourceAsStream("/path/only/holding/resource.files") this confuses me a lot so I would really prefere something like spring does with URI the schema classpath:
downvote count: 0

http://stackoverflow.com/comment/59320880
has text: Is there a specific reason why this is only for String comparisons? I think it can be useful for the generic object comparison as well. *Typically* we write a good toString for the method that captures the essential elements in the object that are included in equals and hence the toString output *might* be a good proxy for a quick clickable diff that outlines the differences?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23100288
score: 1

http://stackoverflow.com/a/22970663
type: AcceptedAnswer
score: 0
type: Answer
has body: Create a new jsonPhotos item on every iteration of the loop. What's happening is that you create a single JSON object before the loop starts, and then you are continually updating it's "itemData" through every iteration of the loop. I suspect that "claim.accumulate" is holding on to a reference of the JSONObject passed into it instead of making a deep copy. This should fix it. if (photos != null) { try { JSONArray jsonObj = new JSONArray(photos); for (int i = 0; i &lt; jsonObj.length(); i++) { ... JSONObject jsonPhotos = new JSONObject(); // add this line here jsonPhotos.put( "imageData", encodedString); jsonPhotos.put( "caption", cap); claim.accumulate( "photos", jsonPhotos); }
answers question: http://stackoverflow.com/q/22970564
accepted answer of: http://stackoverflow.com/q/22970564

http://stackoverflow.com/comment/35160566
score: 0
type: QuestionComment
has text: Are you referring to views in your fragment layout instead of activity layout?
type: Comment
comment on: http://stackoverflow.com/q/23017689

http://stackoverflow.com/comment/35357983
type: Comment
comment on: http://stackoverflow.com/q/23126916
type: QuestionComment
has text: You can't prevent it, you have -no- power over the client, nor should you. At best you can design your web application properly such that the user is redirected away or blocked if he's somewhere where he/she is not supposed to be.
score: 0

http://stackoverflow.com/comment/35104861
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22987084
has text: @m2rt Without digging too deep, I'd say that a reasonable for-loop would have a lower bound of 1 (or 2) and upper bound equal to the _current_ integer you are trying to divide... see Harmlezz's answer for instance.
score: 0

http://stackoverflow.com/comment/35119749
score: 0
has text: break the loop once `IsPrime` is false. Follow the java naming convention.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22994873

http://stackoverflow.com/comment/35318397
type: AnswerComment
type: Comment
has text: Yes, either a variable for each thread, or one variable with a state for each thread. e.g. you could have an atomic integer and one thread waits on it to be 1, one on 2, etc. But that design makes it really easy to mess up I think.
comment on: http://stackoverflow.com/a/23105337
score: 1

http://stackoverflow.com/a/23085195
accepted answer of: http://stackoverflow.com/q/23084548
has body: To connect to a remote machine you need that machines IP address or hostname, then you can use InetAddress.getByName(String). You'd use the IP address if there's no DNS server available to resolve the IP from the hostname, like this: Socket socket = new Socket(InetAddress.getByName("1.2.3.4"), 5000); Or is there's is a DNS server, then you can just pass the servers hostname like this: Socket socket = new Socket(InetAddress.getByName("myserver"), 5000);
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23084548

http://stackoverflow.com/q/23107578
tagged with: spring-amqp
score: 0
has title: RabbitMQ Listener stopping automatically
has comment: http://stackoverflow.com/comment/35321724
has comment: http://stackoverflow.com/comment/37797577
answer count: 0
type: UnansweredQuestion
has body: I am using spring rabbit mq template based listener Under increased load, the listener simply shuts down How to prevent the listener from shutting down? Or how to restart the listener immediately after shutdown? I am using following config: &lt;rabbit:connection-factory id="connectionFactory" host="localhost" password="guest" port="5672" username="guest" /&gt; &lt;rabbit:template id="amqpTemplate" connection-factory="connectionFactory" exchange="${amqp_exchange_name}"/&gt; &lt;rabbit:admin connection-factory="connectionFactory"/&gt; &lt;rabbit:queue name="${amqp_queue_name}"/&gt; &lt;rabbit:listener-container connection-factory="connectionFactory" concurrency="5"&gt; &lt;rabbit:listener ref="joblistener" queue-names="${amqp_queue_name}"/&gt; &lt;/rabbit:listener-container&gt; &lt;bean id="joblistener" class="com.org.sample.Consumer"/&gt; Consumer is my listener with following function in it @Override public void onMessage(Message message) { //do something }
tagged with: rabbitmq
has comment: http://stackoverflow.com/comment/35327254
tagged with: java
has comment: http://stackoverflow.com/comment/35474918
type: Question
tagged with: shutdown

http://stackoverflow.com/comment/35089074
has text: 0x0F was chosen because it isolates the 4 bits they are checking. From looking at the documentation, it seems that the a, b and c bits are not the bits this expression is checking. Though I don't really understand the importance of the four they *are* checking. The doc says there are actually 5 unused bits so it seems to me the mask should be 0x1F. (Unless the tagging library has decided to use the extra bit for something of its own.)
score: 1
comment on: http://stackoverflow.com/a/22978127
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35142858
type: QuestionComment
comment on: http://stackoverflow.com/q/23008264
score: 0
has text: count++ it is increasing
type: Comment

http://stackoverflow.com/comment/35156931
type: Comment
type: QuestionComment
has text: You can change the width height and almost any position by code. I suggest you to use code.
comment on: http://stackoverflow.com/q/23015528
score: 0

http://stackoverflow.com/comment/35132948
comment on: http://stackoverflow.com/a/23002561
has text: I think you and I posted the exact same thing at the exact same time--looking at the timestamps XD (+1 by the way since it's still the right answer)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23036384
tagged with: java
tagged with: servlets
type: Question
answer count: 2
tagged with: weblogic
has comment: http://stackoverflow.com/comment/35194531
accepted answer: http://stackoverflow.com/a/23037196
score: 0
has title: Forward from servlet to servlet
has comment: http://stackoverflow.com/comment/35194627
possible better answer: http://stackoverflow.com/a/23037324
has body: Working on Front Controller for servlet-based application but cant find out how to forward from front contoller to regular controllers. Here is my web.xml: FrontServlet FrontServlet IndexServlet application.controllers.IndexServlet FrontServlet /* FrontServlet public class FrontServlet extends HttpServlet { protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletContext context= getServletContext(); RequestDispatcher rd = context.getRequestDispatcher("IndexServlet"); rd.forward(request, response); } } This code returns: java.lang.NullPointerException. I'm using an WebLogic server.
has answer: http://stackoverflow.com/a/23037324
has answer: http://stackoverflow.com/a/23037196
type: AnsweredQuestion

http://stackoverflow.com/q/23031131
answer count: 2
has body: This is an assignment working with Java interfaces. In total there are 3 classes and an interface: Seller, SellerImpl, SellerTestDriver, and Product. I am to implement the Seller interface in the SellerImpl class and test the output with code I write in the SellerTestDriver class. So far only one method gives the result I want – getName(). The other methods seem to call on the Product class but I have been unable write any code that will work. What I want are the methods to read: name – Baker (it does so already); product - Bread; provide product – true; sellProduct() – just a line of text summarizing the seller and product. Any assistance will be appreciated! The Seller Interface: public interface Seller { public String getName(); public Product getProduct(); public boolean provideProduct(String productName); public Product sellProduct(); } The SellerImpl class: public class SellerImpl implements Seller { protected String name; protected Product product; // TODO: Complete this constructor public SellerImpl(String name, Product product) { this.name = name; this.product = product; } // TODO: Complete these methods public String getName() { return name; } public Product getProduct() { return product; } public boolean provideProduct(String productName) { if (productName.length() == 0) { return null != null; } else { return true; } } public Product sellProduct() { return product; } } SellerTestDriver class: public class SellerImplTestDriver { public static void main(String[] args) { Seller seller = new SellerImpl("Baker", new Product("Bread", 1.95)); // TODO: Write a test for the getName() method System.out.println("Seller is a: " + seller.getName()); // TODO: Write a test for the getProduct() method System.out.println("Seller offers: " + seller.getProduct()); // TODO: Write a test for the provideProduct() method System.out.println("Does this seller supply this item? " + seller.provideProduct("Bread")); // TODO: Write a test for the sellProduct() method System.out.print…
downvote count: 0
has answer: http://stackoverflow.com/a/23031433
favorite count: 0
has title: Writing Java methods that use a combination of an interface and a separate class
has answer: http://stackoverflow.com/a/23031227
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/23124152
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23127340
score: 0
answer count: 1
favorite count: 0
has body: I've been tasked to develop a Recursive Descent Parser for a specific Grammar. The language I am parsing for essentially just adds "" to the beginning and end of an argument. For example, the following input: start 'Begin' { top { text {Top of the world} } } Would output: &lt;start&gt; Begin &lt;top&gt; Top of the world &lt;/top&gt; &lt;/start&gt; So here's where I am at with the Parser thus far: public String parser(String s){ StreamTokenizer st = new StreamTokenizer(new StringReader(s)); String output=""; try { while (st.nextToken() != st.TT_EOF){ if (st.ttype == st.TT_WORD){ if (st.sval.equals("start")){ st.nextToken(); if (st.nextToken() == '\''){ //I need to get the remaining string that //we haven't parsed yet to recursively call parser on it. return "&lt;start&gt;" + st.sval + parser(??) + "&lt;/start&gt;"; } } if (st.sval.equals("top")){ //Need to get remaining string again return "&lt;top&gt; " + parser(??) + " &lt;/top&gt; "; } if (st.sval.equals("text")){ st.nextToken(); if (st.nextToken() == '{'){ //I need to capture everything inside the curly braces String inside = //Everything inside the curly braces return inside; } } } }catch (Exception ex) {} } So as you can see, I am having difficulty with the following: Getting the remaining String after we've removed a token. We need this so we can recursively parse the entire String. Detecting and capturing everything inside of curly braces. I believe I have the form and flow of a Recursive Descent Parser down, but if I am mistaken in anything please don't hesitate to correct me.
accepted answer: http://stackoverflow.com/a/23127340
has title: Recursive Descent Parser Details
type: AnsweredQuestion

http://stackoverflow.com/a/23067354
type: Answer
answers question: http://stackoverflow.com/q/23067287
score: 0
has body: You could search the string with indexOf(), which returns the index at which the character is found. This will check if a colon is in the string and if it's in the right position. if("10:00".indexOf(':') == 2) // do something It will return -1 if the value is not found. Check out the java documentation for more information.

http://stackoverflow.com/comment/35105519
has text: `while(true) {}` is never a good idea. Are you launching the MyListener in a separate thread? You should at least add a `Thread.sleep(...)` to your loop.
comment on: http://stackoverflow.com/q/22987170
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35272193
score: 0
comment on: http://stackoverflow.com/q/23066476
type: QuestionComment
type: Comment
has text: Thanks, I will try to implement this with the Visitor Pattern and then write a comment how it worked.

http://stackoverflow.com/comment/35180837
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23027739
has text: @KorayTugay: You mean to say that setting the locale causing a cookie created?

http://stackoverflow.com/a/23029042
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35181370
has comment: http://stackoverflow.com/comment/35181576
type: Answer
has comment: http://stackoverflow.com/comment/35181406
score: 2
has comment: http://stackoverflow.com/comment/35181322
downvote count: 0
has comment: http://stackoverflow.com/comment/35181272
accepted answer of: http://stackoverflow.com/q/23028825
upvote count: 2
answers question: http://stackoverflow.com/q/23028825
has body: Do not update the GUI from your implementation of doInBackground(). Do update the GUI from your implementation of process() or done(), as shown here, and here. You may have to re-factor your checkNDownloadFile() method to provide the desired granularity for a sensible progress display. See also Watching a Directory for Changes.

http://stackoverflow.com/comment/35239051
comment on: http://stackoverflow.com/q/23061030
type: Comment
type: QuestionComment
has text: **3 parameters != 4 parameters**.
score: 1

http://stackoverflow.com/q/23115179
accepted answer: http://stackoverflow.com/a/23120503
type: Question
tagged with: variables
tagged with: class
score: 0
possible better answer: http://stackoverflow.com/a/23115528
has answer: http://stackoverflow.com/a/23115528
answer count: 4
has answer: http://stackoverflow.com/a/23115226
has answer: http://stackoverflow.com/a/23120503
has title: class as a variable in Java
type: AnsweredQuestion
tagged with: java
has body: I've been looking at some code and I'm wondering if anyone can explain how this works for example public class DataTable { } Then it is used in another class public class UsingDatatable { public DataTable checktables = null; } Why does this other class use another class as a variable?
has answer: http://stackoverflow.com/a/23115320

http://stackoverflow.com/q/23117149
downvote count: 0
has answer: http://stackoverflow.com/a/23117219
score: 1
favorite count: 0
tagged with: exception
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23117616
has answer: http://stackoverflow.com/a/23120928
tagged with: java
tagged with: hibernate
tagged with: orm
upvote count: 1
has body: I have a problem to save more than one objects to database. I get org.hibernate.NonUniqueObjectException: A different object with the same identifier value was already associated with the session My code: Configuration cfg = new Configuration(); cfg.configure("hibernate.cfg.xml"); ServiceRegistry registry = new StandardServiceRegistryBuilder().applySettings( cfg.getProperties()).build(); SessionFactory factory = cfg.buildSessionFactory(registry); Session session = factory.openSession(); Transaction t = session.beginTransaction(); Person p1 = new Person(); p1.setFirstName("Name1"); p1.setLastName("Surname1"); session.persist(p1); Person p2 = new Person(); p2.setFirstName("Name2"); p2.setLastName("Surname2"); session.persist(p2); t.commit(); session.close(); All works fine, when I persist only one object. Please help. Edited: Problem was in mapping file (*.hbm.xml): This code means, that i must define IDs in java code &lt;id name="id" type="int"&gt; &lt;column name="ID" /&gt; &lt;generator class="assigned" /&gt; &lt;/id&gt; This code sets IDs automaticaly: &lt;id name="id" type="int"&gt; &lt;column name="ID" /&gt; &lt;generator class="increment" /&gt; &lt;/id&gt; Now each new object automaticly has unique ID
type: Question
has title: Hibernate - NonUniqueObjectException when persist two objects
accepted answer: http://stackoverflow.com/a/23120928
answer count: 3
possible better answer: http://stackoverflow.com/a/23117219

http://stackoverflow.com/comment/35080147
has text: maybe I should change this question b/c of it being in android?
comment on: http://stackoverflow.com/q/22973112
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35147075
has text: I am using 4.3.3 of apche httpclient
comment on: http://stackoverflow.com/a/22993884
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/23118096
answers question: http://stackoverflow.com/q/23117749
score: 0
type: Answer
has body: Activity's onCreate() gets called before the Fragment's onCreateView() finishes. You need to wait until onCreateView() finishes to get a hold of your Fragment and its GoogleMap. For example, onResume() or onStart() in the Activity are good places to get a hold of your Fragment. Also, googleMap will always be null here: private void setupMapIfNeeded() { // TODO Auto-generated method stub if (googleMap == null){ } And will never be null here (once you move the code to onStart() or onResume(): private void setupMapIfNeeded() { // TODO Auto-generated method stub if (...){ googleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); if (googleMap !=null) { setUpMap(); } } } so no need for all the extra checks.

http://stackoverflow.com/comment/35077319
has text: Line 51 is in the public void play(); at the command human.getCurrent();
score: 0
comment on: http://stackoverflow.com/q/22971712
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35219147
comment on: http://stackoverflow.com/a/23036585
has text: extends and implements are not conversions. explicit conversion is a cast. for example int x = (int)0x00; A "cast" between types is not a conversion. it is just instructions to the compiler to "treat this reference as though it was a reference to this other type".
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35159876
type: Comment
has text: what do you mean by `the acknowledgement`? do you mean that the send succeeded or some type of response from the processor of the message?
type: QuestionComment
comment on: http://stackoverflow.com/q/23017347
score: 0

http://stackoverflow.com/q/23054758
score: -1
downvote count: 2
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35227416
type: UnansweredQuestion
has body: I am reversing a string for an assignment and I am getting one error since yesterday that is driving me crazy, it's at the third curly bracket }. Would anyone be able to advise me?. Here is what I have done anyway below, many thanks in advance!!. public class RecursionQ2 { public RecursionQ2() { } // TODO Auto-generated constructor stub public static void main(String[] args) { // TODO Auto-generated method stub public static String reverse(String str) { String Cheryl; if ((Cheryl == str) || (str.length() &lt;=1)){ return str; } return reverse(str.substring(1)) + str.charAt(0); "}" + "
has answer: http://stackoverflow.com/a/23054796
has comment: http://stackoverflow.com/comment/35227458
favorite count: 0
has comment: http://stackoverflow.com/comment/35227422
type: Question
has title: Reversing a string, getting the same syntax error, any advice?
tagged with: recursion
tagged with: java
has comment: http://stackoverflow.com/comment/35227438

http://stackoverflow.com/q/23078660
answer count: 1
type: UnansweredQuestion
tagged with: spring
has body: salem, I work with jboss 7 , spring ,hibernate, under eclipse I make this config in order to increase the memory : -Xms1024M this is the config of VM arguments -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true "-Dorg.jboss.boot.log.file=C:/test/jboss-as-7.1.1.Final/standalone/log/boot.log" "-Dlogging.configuration=file:/C:/test/jboss-as-7.1.1.Final/standalone/configuration/logging.properties" "-Djboss.home.dir=C:/test/jboss-as-7.1.1.Final" -Xms1024M and when I work in my application I have this error : I have a message which repeats : 11:08:35,098 ERROR [org.directwebremoting.impl.DefaultConverterManager] (http-localhost-127.0.0.1-8080-6) No converter found for 'org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer' 11:08:35,098 ERROR [org.directwebremoting.impl.DefaultConverterManager] (http-localhost-127.0.0.1-8080-6) No converter found for 'org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer' 11:08:35,109 ERROR [org.directwebremoting.impl.DefaultConverterManager] (http-localhost-127.0.0.1-8080-6) No converter found for 'org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer' 11:08:35,129 ERROR [org.directwebremoting.impl.DefaultConverterManager] (http-localhost-127.0.0.1-8080-6) No converter found for 'org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer' 11:08:35,136 ERROR [org.directwebremoting.impl.DefaultConverterManager] (http-localhost-127.0.0.1-8080-6) No converter found for 'org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer' 11:08:35,143 ERROR [org.directwebremoting.impl.DefaultConverterManager] (http-localhost-127.0.0.1-8080-6) No converter found for 'org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer' 11:08:35,182 ERROR [org.directwebremoting.impl.DefaultConverterManager] (http-localhost-127.0.0.1-80…
has title: jboss 7 java.lang.OutOfMemoryError: Java heap space
has answer: http://stackoverflow.com/a/23078710
score: 0
tagged with: java
tagged with: hibernate
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35271389
type: Question
has comment: http://stackoverflow.com/comment/35271282
tagged with: jboss

http://stackoverflow.com/comment/35075575
has text: @LeeDanielCrocker what is the alternative?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22969061
type: Comment

http://stackoverflow.com/comment/35217190
type: Comment
type: QuestionComment
has text: @Kyle it is set above the while loop
comment on: http://stackoverflow.com/q/23048655
score: 0

http://stackoverflow.com/q/23025248
tagged with: java
has answer: http://stackoverflow.com/a/23025337
has body: Java: how to tell if an object is of a specific subclass. I want to have a check to see if an object is of a particular subclass and have the check NOT come back true for other classes that have inherited from the same superclass. So, for example: superclass: fruit subclass: apple and banana extend fruit Then I have a check (if appleObject.isThisClass(apple)) {do stuff} So far all I've been able to find are ways to check that will still return true because they share the same superclass. Hopefully that makes sense. Thanks for the help.
has title: Java: how to tell if an object is of a specific subclass
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35175029
tagged with: inheritance
has answer: http://stackoverflow.com/a/23025303
downvote count: 0
score: 1
favorite count: 0
type: Question
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/35352096
type: AnswerComment
comment on: http://stackoverflow.com/a/23123952
type: Comment
has text: Change your code with if..else if..else like.., add else before if in second condition.i.e. `else if(des=="calc" || des=="calculator")` instead of just `if(des=="calc" || des=="calculator")`
score: 0

http://stackoverflow.com/comment/35130047
has text: without extracting the contents
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23000741

http://stackoverflow.com/q/22985124
tagged with: java
has comment: http://stackoverflow.com/comment/35100845
has answer: http://stackoverflow.com/a/22985271
has body: I want to create an interface having two methods, say uploadFile and downloadFile. While I only need the implementors to just implement these two methods, I am not sure and want to care about what arguements these methods need to take. I mean, different implementors may ask for different parameters. In that case, should I still go ahead by creating an interface by making the above methods as var-arg methods, like below boolean uploadFile(Object ... parameters) OutputStream downloadFile(Object ... parameters) Or is there even a better approach than this? Is it even right to create an interface if I cannot generalize method parameters? I am only sure about the method names and say return types.
type: Question
has title: Do we need an interface/contract if we cannot generalize method parameters
upvote count: 2
favorite count: 0
accepted answer: http://stackoverflow.com/a/22985283
has answer: http://stackoverflow.com/a/22985315
tagged with: interface
possible better answer: http://stackoverflow.com/a/22985315
answer count: 4
has answer: http://stackoverflow.com/a/22985283
score: 2
has answer: http://stackoverflow.com/a/22985250
type: AnsweredQuestion
tagged with: oop
downvote count: 0

http://stackoverflow.com/comment/35290613
comment on: http://stackoverflow.com/q/23089648
type: Comment
has text: What don't you understand about the javadoc entry?
score: 2
type: QuestionComment

http://stackoverflow.com/comment/35239869
score: 0
comment on: http://stackoverflow.com/q/23061533
has text: I Know cookies, but the question arise when cookies are disabled on client machine.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35252829
has text: They aren't *incrementing*. The values you are seeing as incrementing is actually where the recursion is unwinding. Take a paper and pencil and try and trace the code as an exercise. Write down each function call and the values being passed. Then it should become more clear.
comment on: http://stackoverflow.com/q/23068380
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/35140826
has text: I found chapters in "Java How to Program (9th Edition) - Harvey Deitel" so started working on it.
comment on: http://stackoverflow.com/q/22989003
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35229605
type: Comment
type: QuestionComment
score: 0
has text: what's your full path you want to save your image.
comment on: http://stackoverflow.com/q/23055713

http://stackoverflow.com/comment/35317652
score: 0
has text: Try this tablelayout.setVisibility(View.INVISIBLE); or tablelayout.setVisibility(View.GONE);
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23104964

http://stackoverflow.com/a/22973734
has comment: http://stackoverflow.com/comment/35081807
score: 1
upvote count: 1
has body: I would consider removing the unnecessary arrays and use a StringTokenizer... public static void main(String[] args) { String number; String address; String aptNumber; String str = "This is String , split by StringTokenizer"; StringTokenizer st = new StringTokenizer(str); System.out.println("---- Split by space ------"); while (st.hasMoreElements()) { String s = System.out.println(st.nextElement()); if (StringUtils.isNumeric(s) { number = s; continue; } if(s.indexOf("Apt")) { aptNumber = s.substring(s.indexOf("Apt"),s.length-1); continue; } } System.out.println("---- Split by comma ',' ------"); StringTokenizer st2 = new StringTokenizer(str, ","); while (st2.hasMoreElements()) { System.out.println(st2.nextElement()); } }
has comment: http://stackoverflow.com/comment/35081694
has comment: http://stackoverflow.com/comment/35081494
downvote count: 0
answers question: http://stackoverflow.com/q/22973633
has comment: http://stackoverflow.com/comment/35081751
has comment: http://stackoverflow.com/comment/35081755
has comment: http://stackoverflow.com/comment/35081576
type: Answer

http://stackoverflow.com/q/23056806
has answer: http://stackoverflow.com/a/23057191
type: Question
tagged with: types
score: 0
has answer: http://stackoverflow.com/a/23057933
has answer: http://stackoverflow.com/a/23056899
has answer: http://stackoverflow.com/a/23056951
has answer: http://stackoverflow.com/a/23056892
answer count: 5
type: UnansweredQuestion
tagged with: file-extension
tagged with: file
has body: How do I find a file type, for example if .xls go to xlsconvertcsv method or .xlsx go to xlsscsv method, How to do that.? I used getCanonicalPath() method,I found the file type, but I did not able to convert string to file. public static void main(String[] args) throws IOException { File inputFile = new File("test.xls"); File outputFile = new File("output1.csv"); String out=inputFile .getCanonicalPath(); if(out.endsWith(".xls")) { System.out.print("Text filei\n"+out); convertToXls(out, outputFile); } //System.out.println("out"+out); //convertToXls(inputFile, outputFile); }
has title: how to find file type in java
tagged with: java

http://stackoverflow.com/a/23081839
score: 0
answers question: http://stackoverflow.com/q/23081743
has body: You are fetching the text of whole Select element instead of just the selected option. You may use the inbuilt function to fetch selected option then fetch the text from this. Use Following: String selectedOption = new Select(driver.findElement(By.id("p-param-L4:80000"))).getFirstSelectedOption().getText(); However if you want to use xpath. You may try following: String selectedOption = driver.findElement(By.xpath("//select[@id='p-param-L4:80000']/option[@selected='selected']")).getText(); I would recommend Id to fetch your required text.
type: Answer

http://stackoverflow.com/comment/35437811
score: 0
type: Comment
has text: Have you read all the links that I have shared because I can't set up GWT Youtube API on my system due to slow network.
comment on: http://stackoverflow.com/a/23044606
type: AnswerComment

http://stackoverflow.com/q/23047825
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35215341
has comment: http://stackoverflow.com/comment/35215323
has comment: http://stackoverflow.com/comment/35215514
has body: This is my code : public void handleBlogResponse() { mProgressBar.setVisibility(View.INVISIBLE); if (mVideoData == null) { updateDisplayForError(); } else { try { HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); HttpGet request = new HttpGet("http://sql.gamedayxtra.com/api/Club/GetClubVideos/1"); HttpResponse response = httpclient.execute(request); HttpEntity resEntity = response.getEntity(); String _response=EntityUtils.toString(resEntity); JSONArray jr = new JSONArray("_response"); for(int i=0;i&lt;jr.length();i++) { JSONObject jb = (JSONObject) jr.get(i); String id =jb.getString("$id"); String clubvid = jb.getString("ClubVideoId"); String clubid = jb.getString("ClubId"); String title = jb.getString("Title"); String thumb = jb.getString("ThumbURL"); String video = jb.getString("VideoURL"); String date = jb.getString("DataAdded"); } } catch (JSONException e) { Log.e(TAG, "Exception caught!!", e); } } }' I don't know how to put these string into a list view.
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 0
has comment: http://stackoverflow.com/comment/35216856
tagged with: android-listview
tagged with: android
has title: How should I parse JSON data into a listview?
tagged with: parsing

http://stackoverflow.com/a/23060848
has comment: http://stackoverflow.com/comment/35239071
has comment: http://stackoverflow.com/comment/35264177
type: AcceptedAnswer
has body: tv2.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(Contact.this,Discution.class); String str = tv2.getText().toString(); startActivity(intent); }
has comment: http://stackoverflow.com/comment/35264093
type: Answer
has comment: http://stackoverflow.com/comment/35264232
accepted answer of: http://stackoverflow.com/q/23060792
has comment: http://stackoverflow.com/comment/35264249
answers question: http://stackoverflow.com/q/23060792
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/35239267

http://stackoverflow.com/comment/35120387
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22994667
has text: @user3394902, you learn by trying. The first approach is the easiest. So you start by moving the code that builds the Path2D objects to a separate method that you execute in the constructor of you class. Ass you create each Path2D object you add it to an ArrayList. Then in the paintComponent() method all you need is a couple of lines of code to iterate through the ArrayList and paint each Path2D object.

http://stackoverflow.com/comment/35158006
type: Comment
score: 0
type: QuestionComment
has text: The xml is complete, but for some reason the opening layout don't appear in the gray part of the code. The problem occur when I insert the first person number and click the button. I get an Unfortunately message in the emulator and then the program crashes.
comment on: http://stackoverflow.com/q/23016209

http://stackoverflow.com/q/23070864
has comment: http://stackoverflow.com/comment/35257358
has comment: http://stackoverflow.com/comment/35257727
has answer: http://stackoverflow.com/a/23071055
has title: How do I solve each compiling error in this program code(java)?
has comment: http://stackoverflow.com/comment/35257333
answer count: 1
has comment: http://stackoverflow.com/comment/35257389
has body: I have been trying to solve this, and I am not very fluent in java's module and call ref. Can someone help me make this program work? It's very confusing. It has a lot of problems with the pass by reference in java, along with any extra errors that I have in there. I keep getting errors like incompatible types and cannot find symbols. //This program is designed to have the user enter 10 golf scores, then display them in ascending order. import java.util.Scanner; public class SortedGolfScoresMT { public static void main(String[] args) { //Declares the size for the variable, which is 10 int SIZE = 10; //Declares the array and utilize it with SIZE variable int[] scores = new int[SIZE]; getScores(scores, SIZE); insertionSort(scores, SIZE); displayScores(scores, SIZE); } public static int[] getScores(int scores[], int SIZE) { // Scanner object for keyboard input. Scanner keyboard = new Scanner(System.in); //Declares the index as a counter int index; //Get the scores for each golf player for ( index = 0; index &lt;= SIZE - 1; index++) { System.out.print("Enter the golf scores for player " + (index + 1) + ": "); scores[index] = keyboard.nextInt(); } return scores[index]; } public static int[] insertionSort(int array[], int SIZE) { int unsortedValue; int scan; int index; for ( index = 1; index &lt;= SIZE -1; index++) { unsortedValue = scores[index]; scan = index; while (scan &gt; 0 &amp;&amp; array[scan - 1] &lt; array[scan]) { swapModule(); scan = scan - 1; } array[scan] = unsortedValue; } return array[scan]; } public static int[] swapModule(int a, int b) { int temp; temp = a; a = b; b = temp; return b; } public static int[] displayScores(int scores[], int SIZE) { int index; System.out.print("The scores are now displayed: "); for (index = 0; index &lt;= SIZE - 1; index++) { System.out.print(scores[index]); } } }
favorite count: 0
downvote count: 5
has comment: http://stackoverflow.com/comment/35258065
type: UnansweredQuestion
upvote count: 0
score: -5
tagged with: java
type: Question

http://stackoverflow.com/comment/35253177
comment on: http://stackoverflow.com/q/23068380
has text: @mpromonet:I think you are right.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23073566
has body: You are very close. Here are the problems that prevent your code from completing correctly: You initialize min and max too soon. For min this creates problems when all numbers are positive; for max, when all numbers are negative. You should declare/initialize both variables after the reading has been completed. Moving the declaration to the point after the reading loop will fix this problem. Although you correctly defined the type of avgNum as double, the expression that you assign it remains an int, because both its elements are int. Therefore, the division is truncated. Change the division as follows: avgNum = (double)sum/numbers.length; or better yet, declare sum as double, and remove the cast.
answers question: http://stackoverflow.com/q/23073521
has comment: http://stackoverflow.com/comment/35262599
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/35262690
accepted answer of: http://stackoverflow.com/q/23073521
type: AcceptedAnswer

http://stackoverflow.com/a/22991301
has body: It is possible that you add both grids, but the second one is displayed on top of the first one. This may happen if your mainPanel_ is a LayoutPanel, for example. Try adding both grids to a FlowPanel and then add this FlowPanel to your mainPanel_, or, if the mainPanel_ is a LayoutPanel, set the position of each grid when you add it.
answers question: http://stackoverflow.com/q/22988620
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/22988620
upvote count: 1
has comment: http://stackoverflow.com/comment/35112593
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35115279
comment on: http://stackoverflow.com/a/22991998
has text: In addition, `Land` could be selected from a `JComboBox` with all countries (or a subset of them).
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35117685
score: 0
has text: What do you mean, you can't "use a variable?" Please provide more context or show some code. Your question is too ambiguous to provide any concrete answer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22994140

http://stackoverflow.com/q/22984403
has answer: http://stackoverflow.com/a/23079533
has body: I am developing a web application with spring mvc framework and java. I am using active directory user authentication in the application. Now i want to assign role to these users from a sql database. So the whole authentication process will be done by taking information from two sources: [ user id &amp; password from active directory &amp; roles of user from sql database ]. I have searched on internet to get any tutorial/samples to do so but I'm unable to get any useful stuff. So any help on the issue will be appreciated. Here is the current code of my spring security file, &lt;bean id="adAuthenticationProvider" class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider"&gt; &lt;constructor-arg value="abbl.org"/&gt; &lt;constructor-arg value="LDAP://abbl.org"/&gt; &lt;property name="convertSubErrorCodesToExceptions" value="true"/&gt; &lt;property name="useAuthenticationRequestCredentials" value="true"/&gt; &lt;/bean&gt; &lt;bean id="customAuthenticationProvider" class="org.abbl.exhbp.templates.CustomAuthorityProvider"&gt; &lt;constructor-arg ref="adAuthenticationProvider"/&gt; &lt;/bean&gt; &lt;security:authentication-manager&gt; &lt;security:authentication-provider ref="customAuthenticationProvider"/&gt; &lt;/security:authentication-manager&gt; my authenticate function in AuthenticationProvider class, public Authentication authenticate(Authentication authentication) { final Authentication a = delegate.authenticate(authentication); // Load additional authorities and create an Authentication object final List&lt;GrantedAuthority&gt; authorities = getGrantedAuthorities(a.getName()); return new AbstractAuthenticationToken(authorities) { @Override public Object getCredentials() { //return null; //To change body of implemented methods use File | Settings | File Templates. throw new UnsupportedOperationException(); } @Override public Object getPrincipal() { //return null; //To change body of implemented methods use File | Settings…
accepted answer: http://stackoverflow.com/a/23079533
answer count: 1
tagged with: spring-security
linked to: http://stackoverflow.com/q/9228932
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35156801
tagged with: roles
has comment: http://stackoverflow.com/comment/35103220
has comment: http://stackoverflow.com/comment/35103248
tagged with: java
has comment: http://stackoverflow.com/comment/35103815
type: Question
tagged with: database
tagged with: active-directory
has comment: http://stackoverflow.com/comment/35266830
score: 0
has title: Java Spring Security - Application Role Based Active Directory User Authentication

http://stackoverflow.com/q/23112353
has comment: http://stackoverflow.com/comment/35331624
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35331376
favorite count: 0
tagged with: jdialog
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/23113243
tagged with: java
has title: How to get to JDialog methods?
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/35331697
accepted answer: http://stackoverflow.com/a/23113243
has body: I just get stuck with app. The thing is in second actionListener, I want to get object or more specifically access to methods in my JDialog class. I got few dialogs created, but not visible. In first actionListener I get to them by getDialog function which is returning JDialog. So I can each one of them visible. 2nd actionListener which I need help with, is showing JOptionPane and if user pick the YES_OPTION I want to run my method from specific dialog. I it's not clear I'd try to fix my explanations so you can understand it. modifyButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JButton thisButton = (JButton) e.getSource(); JPanel parentPanel = (JPanel) thisButton.getParent(); Container topLevel = parentPanel.getTopLevelAncestor(); MainFrame mainFrame = (MainFrame) topLevel; mainFrame.getDialog(TABLECOUNTER).setVisible(true); } }); abortButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Object[] options = {"Tak", "Nie"}; int userReply = JOptionPane.showOptionDialog(null, "Czy na pewno chcesz anulować rachunek?", "Probujesz anulować rachunek!", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); if (userReply == JOptionPane.YES_OPTION) { JButton thisButton = (JButton) e.getSource(); JPanel parentPanel = (JPanel) thisButton.getParent(); Container topLevel = parentPanel.getTopLevelAncestor(); MainFrame mainFrame = (MainFrame) topLevel; mainFrame.getDialog(TABLECOUNTER).myMethod(); //here } } });

http://stackoverflow.com/q/23026183
upvote count: 20
has answer: http://stackoverflow.com/a/58132117
downvote count: 0
answer count: 6
favorite count: 0
tagged with: mbeans
tagged with: ear
has comment: http://stackoverflow.com/comment/35190217
has body: I want to move a startup MBEAN file (startup-client-service.xml) from my EJB >META-INF, to EAR> META-INF folder. I tried with the maven-resources-plugin plugin but it just copy the file from EJB >META-INF to Target in ear folder. But in built ear the startup-client-service.xml file is not available in META-INF How can I move my startup file to META-INF into ear > META-INF ? This is the pom file of ear. <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.testapp my-client-parent 0.0.1-SNAPSHOT Test app EAR my-client-ear ear com.testapp my-client-ejb 0.0.1-SNAPSHOT ejb org.apache.maven.plugins maven-ear-plugin 2.8 lib org.apache.maven.plugins maven-resources-plugin 2.6 copy-resources validate copy-resources META-INF ${project.parent.basedir}/ejb/src/main/resources/META-INF true org.eclipse.m2e lifecycle-mapping 1.0.0 <lifecycleMappingMetadata> org.apache.maven.plugins maven-ear-plugin [2.8,) generate-application-xml </lifecycleMappingMetadata> copy_bundle <install.dir>${jboss.dir}\server\default\deploy</install.dir> maven-antrun-plugin Copying bundle to destination folder package run <copy file="${project.build.directory}/${project.build.finalName}.${project.packaging}" overwrite="true" todir="${install.dir}" /> Below is the project workspace screen grab
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/55678434
has answer: http://stackoverflow.com/a/48148175
has title: How to add a file to EAR META-INF folder - Maven
has answer: http://stackoverflow.com/a/54906201
has answer: http://stackoverflow.com/a/24648472
tagged with: java
tagged with: jboss
type: Question
score: 20
has answer: http://stackoverflow.com/a/25245051
has comment: http://stackoverflow.com/comment/35197518

http://stackoverflow.com/a/23231065
type: Answer
score: 91
upvote count: 91
has body: This is a very interesting issue! It seems like JLS section 12.4.1 ought to cover this definitively. However, the behavior of Oracle JDK and OpenJDK (javac and HotSpot) differs from what's specified here. In particular, the Example 12.4.1-3 from this section covers interface initialization. The example as follows: interface I { int i = 1, ii = Test.out("ii", 2); } interface J extends I { int j = Test.out("j", 3), jj = Test.out("jj", 4); } interface K extends J { int k = Test.out("k", 5); } class Test { public static void main(String[] args) { System.out.println(J.i); System.out.println(K.j); } static int out(String s, int i) { System.out.println(s + "=" + i); return i; } } Its expected output is: 1 j=3 jj=4 3 and indeed I get the expected output. However, if a default method is added to interface I, interface I { int i = 1, ii = Test.out("ii", 2); default void method() { } // causes initialization! } the output changes to: 1 ii=2 j=3 jj=4 3 which clearly indicates that interface I is being initialized where it wasn't before! The mere presence of the default method is enough to trigger the initialization. The default method doesn't have to be called or overridden or even mentioned, nor does the presence of an abstract method trigger initialization. My speculation is that the HotSpot implementation wanted to avoid adding class/interface initialization checking into the critical path of the invokevirtual call. Prior to Java 8 and default methods, invokevirtual could never end up executing code in an interface, so this didn't arise. One might think this is part of the class/interface preparation stage (JLS 12.3.2) which initializes things like method tables. But perhaps this went too far and accidentally did full initialization instead. I've raised this question on the OpenJDK compiler-dev mailing list. There's been a reply from Alex Buckley (editor of the JLS) in which he raises more questions directed at the JVM and lambda implementation teams. He also notes that ther…
has comment: http://stackoverflow.com/comment/49113021
answers question: http://stackoverflow.com/q/23096084
has comment: http://stackoverflow.com/comment/112009562
has comment: http://stackoverflow.com/comment/35572332
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35543388
has comment: http://stackoverflow.com/comment/35637561
downvote count: 0
has comment: http://stackoverflow.com/comment/35545086
has comment: http://stackoverflow.com/comment/49110343
has comment: http://stackoverflow.com/comment/35558731
accepted answer of: http://stackoverflow.com/q/23096084

buildpath
tags question: http://stackoverflow.com/q/23085245
type: Tag
tags question: http://stackoverflow.com/q/23074381
tag name: buildpath

http://stackoverflow.com/a/23038689
has body: You should avoid use of setBounds(...) and 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. Instead if you want one JButton on top of the other and that they be equal sides, why not simply use a GridLayout(0, 1)?
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23038674
type: Answer
has comment: http://stackoverflow.com/comment/35198891
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/35198904
has comment: http://stackoverflow.com/comment/35198935
answers question: http://stackoverflow.com/q/23038674

http://stackoverflow.com/comment/35258191
comment on: http://stackoverflow.com/a/23064248
type: AnswerComment
score: 0
has text: NOTE: The **`@var`** user defined variables can be used in regular SQL as well as stored programs. Using the special `VALUES(foo)` function as a reference to the value supplied for a column in the INSERT (i.e. the value that would have been inserted if the insert had succeeded) is the normal way we avoid having to pass the same values; and this is especially useful when it's more than one row being inserted.
type: Comment

http://stackoverflow.com/q/23097675
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23097699
has answer: http://stackoverflow.com/a/23097830
tagged with: eclipse
type: Question
answer count: 2
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/23097699
has title: How do I run same eclipse project multiple times simultaneously?
has body: I have a console based java project in eclipse. I pass in 2 arguments during runtime - customer id and environment Eg: 21 DEV I want to run the project simultaneously for 3 different customers at the same time. Can this be done? and How?
accepted answer: http://stackoverflow.com/a/23097830

http://stackoverflow.com/q/22998951
upvote count: 0
has answer: http://stackoverflow.com/a/22999053
favorite count: 0
has title: Error in passing variable arguments
type: Question
has comment: http://stackoverflow.com/comment/35126784
has comment: http://stackoverflow.com/comment/35126797
has answer: http://stackoverflow.com/a/22999014
tagged with: parameter-passing
score: -1
tagged with: java
answer count: 2
downvote count: 1
tagged with: argument-passing
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35126672
has body: I have an interface import javax.naming.AuthenticationException; import com.unboundid.ldap.sdk.LDAPException; public interface AuthenticationServiceManager { /** * Creates the Connection for the specific user logging in, and binds the * user's credentials to object. * * @param userName * The user name to authenticate . * @param password * The user's password to check . * @param args * is an object that holds variable arguments which can be used * to authenticate using both LDAP and OpenId * @return boolean The connection status showing whether the user has been * successfully authenticated or not. * @throws AuthenticationException * If there is an error authenticating with the passed * parameters **/ boolean authenticate(String username, String password, Object... args) throws AuthenticationException, LDAPException; /** * Disconnects the connection. */ void disconnect(); } A class that implements this interface package com.cerner.jira.plugins.esig.servicemanagerimpl; import javax.naming.AuthenticationException; import com.cerner.jira.plugins.esig.servicemanager.AuthenticationServiceManager; import com.unboundid.ldap.sdk.LDAPException; public class AuthenticationManagerImpl implements AuthenticationServiceManager { @Override public boolean authenticate(String username, String password) throws AuthenticationException, LDAPException { return false; } @Override public boolean authenticate(String username, String password, String url) { return false; } @Override public void disconnect() { // TODO Auto-generated method stub } } I'm trying to create an interface that can be used to implement a connection class. I should be able to use this for different authentication like LDAP, OpenId etc; So I want to pass username,password(if its LDAP) and variable number of arguments(If OpenId). How do I do that? I tried this. It is throwing error. How do I initialize the object to hold variable parameters? Error :The method authenticate(String, String) of type AuthenticationManagerImp…

http://stackoverflow.com/comment/35328794
score: 0
type: Comment
has text: Thanks for the down vote, but if you didn't see he loops to **256** so he know in advance how many number will check if it's prime. if the **100** was a problem we can change it to a dynamic Array. and please flag this comment too.
type: AnswerComment
comment on: http://stackoverflow.com/a/23105768

http://stackoverflow.com/q/22994195
score: -1
type: Question
tagged with: mobile
answer count: 1
downvote count: 1
favorite count: 0
has body: I am currently making a smart phone application in Java, and this application would require sending files from the smart phone to a server that is running Ubuntu 12.04. What would be the best way to go about doing this? I have come across many ways, but which would be the easiest to implement? Is there source code that already exists for this that I can use?
tagged with: android
upvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4126625
has title: Sending files from a mobile application to a server?
has answer: http://stackoverflow.com/a/22994277
tagged with: java

http://stackoverflow.com/q/23008757
tagged with: struts
tagged with: struts2
type: Question
answer count: 1
downvote count: 0
tagged with: javascript
has comment: http://stackoverflow.com/comment/35191258
favorite count: 0
has body: i am sending दर्शन as a request parameter value from javascript and while i am fetching in my struts action using requestMap.get(key)[0] then it gives me à¤¦à¤°à¥à¤¶à¤¨ junk character? here my action implements ServletResponseAware and i declare requestMap variable so it directly map request parameter value to requestMap object
has answer: http://stackoverflow.com/a/23008866
has title: Getting junk value while sending hindi characher in request string
has comment: http://stackoverflow.com/comment/35236342
tagged with: multilingual
score: 2
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/19410508
tagged with: java

http://stackoverflow.com/a/55678434
answers question: http://stackoverflow.com/q/23026183
has body: I managed to do it using maven-resources-plugin maven-resources-plugin 3.1.0 copy-resources validate copy-resources ${basedir}/target/${env.APPLICATION_NAME}/META-INF/ src/main/application/ true example project structure Note:resource need to be located in src\main\application\META-INF\weblogic-application.xml
score: 0
type: Answer

http://stackoverflow.com/comment/35218061
has text: @icemanind: ok, I've updated by answer (use `BorderLayout.NORTH`)
type: Comment
comment on: http://stackoverflow.com/a/23049324
score: 0
type: AnswerComment

jboss
tags question: http://stackoverflow.com/q/23026183
tags question: http://stackoverflow.com/q/23002749
tags question: http://stackoverflow.com/q/23105304
tags question: http://stackoverflow.com/q/23006001
tags question: http://stackoverflow.com/q/23078660
tags question: http://stackoverflow.com/q/23097405
tags question: http://stackoverflow.com/q/23015793
tags question: http://stackoverflow.com/q/23032391
tags question: http://stackoverflow.com/q/22982090
tag name: jboss
tags question: http://stackoverflow.com/q/23116695
tags question: http://stackoverflow.com/q/23064824
tags question: http://stackoverflow.com/q/22987325
type: Tag
tags question: http://stackoverflow.com/q/23066125
tags question: http://stackoverflow.com/q/23109340
tags question: http://stackoverflow.com/q/23023817
tags question: http://stackoverflow.com/q/23013141
tags question: http://stackoverflow.com/q/23081092
tags question: http://stackoverflow.com/q/23025461
tags question: http://stackoverflow.com/q/22970218
tags question: http://stackoverflow.com/q/23087782
tags question: http://stackoverflow.com/q/22993331
tags question: http://stackoverflow.com/q/23007323
tags question: http://stackoverflow.com/q/23113662
tags question: http://stackoverflow.com/q/23042014
tags question: http://stackoverflow.com/q/23105496
tags question: http://stackoverflow.com/q/23101112
tags question: http://stackoverflow.com/q/22987980
tags question: http://stackoverflow.com/q/23014644
tags question: http://stackoverflow.com/q/23064960

http://stackoverflow.com/comment/35397627
score: 0
comment on: http://stackoverflow.com/q/23105469
has text: If you want to avoid printing, you can *encrypt* the file using an owner password and make sure the permission for printing isn't set. However: whether or not this option is respected depends entirely on the viewer.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35424489
score: 1
type: Comment
comment on: http://stackoverflow.com/a/23000190
type: AnswerComment
has text: @Lentejas, can you look in the client application logs and see if there are any log messages with a more specific SSL-related exception? It would be generated from here: https://github.com/mongodb/mongo-java-driver/blob/2.12.x/src/main/com/mongodb/ServerStateNotifier.java#L99 and should contain a more specific SSL-related exception.

http://stackoverflow.com/comment/35108738
comment on: http://stackoverflow.com/a/22987029
has text: Hi, thanks for your answer. I've got rid of the `.class` extension, as you suggested, and looked through the tutorial you linked to, trying what it suggested, and I can now get the Hello World applet running and displaying in a popup window when I run the class directly from Eclipse... But I'm still getting the same error when trying to view the applet in the browser- i.e. the 'error: click for details' message. I noticed that in the code example in the link you provided, it is referencing a JAR file-
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35350489
score: 0
type: AnswerComment
type: Comment
has text: Yea, Thanks man! Works great. Next time I'll draw it out on a piece of paper or something.
comment on: http://stackoverflow.com/a/23123154

http://stackoverflow.com/comment/35073905
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22969844
has text: Two pieces of general advice relating to (but not answering) your problem: Firstly, use an IDE. Their syntax and error highlighting (particularly brace matching) are very useful tools, not just for beginners. Secondly, indent your code consistently: the closing brace from the first `if` should be on a separate line.

http://stackoverflow.com/comment/35253841
has text: Yeah, I can't reproduce this. Show us the context file that your `DispatcherServlet` loads in its entirety. Get rid of the `@Autowired` parts, they are not relevant here. One thing bugging me is this `[${telephoneId}]`. There shouldn't be `[]` there.
score: 0
comment on: http://stackoverflow.com/q/23067838
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23017689
has comment: http://stackoverflow.com/comment/35163783
has comment: http://stackoverflow.com/comment/35160530
possible better answer: http://stackoverflow.com/a/23018421
has comment: http://stackoverflow.com/comment/35161583
has answer: http://stackoverflow.com/a/23018421
has comment: http://stackoverflow.com/comment/35160659
has answer: http://stackoverflow.com/a/23020155
tagged with: android-4.4-kitkat
has comment: http://stackoverflow.com/comment/35160566
tagged with: android
has comment: http://stackoverflow.com/comment/35160798
has comment: http://stackoverflow.com/comment/35160750
has comment: http://stackoverflow.com/comment/35160918
accepted answer: http://stackoverflow.com/a/23020155
type: AnsweredQuestion
has title: Android Runtime Crash
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35166212
has answer: http://stackoverflow.com/a/23018698
type: Question
has comment: http://stackoverflow.com/comment/35160887
has comment: http://stackoverflow.com/comment/35160587
has comment: http://stackoverflow.com/comment/35160707
has comment: http://stackoverflow.com/comment/35160479
has body: I'm new to Android development and trying to build my first application. I'm currently trying to build a simple counter that allows the user to increment the total by +1, -1, +5, -5 with the starting value being 20. When I try to run my app it always crashes immediately and I'm completely stuck on how to fix it. Here is my code: package com.example.mtglifecounter; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.os.Build; public class MainActivity extends ActionBarActivity { int Total=20; Button Plus1, Min1, Plus5, Min5; EditText Display; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Total = 20; Plus1 = (Button) findViewById(R.id.btnPlus1); Min1 = (Button) findViewById(R.id.btnMin1); Plus5 = (Button) findViewById(R.id.btnPlus5); Min5 = (Button) findViewById(R.id.btnmin5); Display = (EditText) findViewById(R.id.tvTotal); Display.setText(Total); Plus1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Adds 1 to the counter Total = Total + 1; Display.setText(Total); } }); Min1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Subtract 1 from counter Total = Total - 1; Display.setText(Total); } }); Plus5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Adds 1 to the counter Total = Total + 5; Display.setText(Total); } }); Min5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Subtract 1 from counter Total = Total - 5; Display.setText(Total); } }); if (savedI…
answer count: 3

http://stackoverflow.com/q/23068518
has answer: http://stackoverflow.com/a/23068796
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35252993
score: 1
tagged with: java
has title: How to override method used in contructor in Java?
has answer: http://stackoverflow.com/a/23068712
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23068796
has body: I am very new to Java programming and I am trying to define a hierarchy of classes where the constructor of the base class calls a method that can be overridden in subclasses. Now, I have understood that a constructor can only call class (i.e. static) methods, not instance methods. But static methods cannot be overridden (they are only masked). So the following example prints "1 1" instead of "1 2", as I would like... Is there a simple, elegant way to implement such behaviour ? class A { private int data; public A(int input) { data = computeData(input); } static private int computeData(int i) { return i; } public String toString() { return "" + data;} } class B extends A { public B(int input) { super(input); } static private int computeData(int i) { return 2*i; } } class Example { public static void main(String[] args) { System.out.println(new A(1) + " " + new B(1)); } }
answer count: 3
has comment: http://stackoverflow.com/comment/35252895
has comment: http://stackoverflow.com/comment/35253107
downvote count: 0
has comment: http://stackoverflow.com/comment/35252891
favorite count: 0
has comment: http://stackoverflow.com/comment/35325498
tagged with: constructor
possible better answer: http://stackoverflow.com/a/23068545
has answer: http://stackoverflow.com/a/23068545

http://stackoverflow.com/comment/35354027
has text: check if stubs (client classes) are generated properly ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23125068

gson
tags question: http://stackoverflow.com/q/23039819
tags question: http://stackoverflow.com/q/23072733
tags question: http://stackoverflow.com/q/23035446
tags question: http://stackoverflow.com/q/23118407
tags question: http://stackoverflow.com/q/22988646
tags question: http://stackoverflow.com/q/23061611
tag name: gson
tags question: http://stackoverflow.com/q/22986541
tags question: http://stackoverflow.com/q/23032173
tags question: http://stackoverflow.com/q/23070298
tags question: http://stackoverflow.com/q/22970087
tags question: http://stackoverflow.com/q/23085396
tags question: http://stackoverflow.com/q/23095793
type: Tag
tags question: http://stackoverflow.com/q/23008824
tags question: http://stackoverflow.com/q/23071765
tags question: http://stackoverflow.com/q/23082431

http://stackoverflow.com/comment/35259690
comment on: http://stackoverflow.com/q/23068927
score: 0
type: Comment
type: QuestionComment
has text: @KenWolf FML i put the main activity lol fixed it though

http://stackoverflow.com/q/23076009
upvote count: 1
has answer: http://stackoverflow.com/a/32749928
type: Question
has answer: http://stackoverflow.com/a/23076100
has comment: http://stackoverflow.com/comment/53340325
tagged with: sonarqube
has body: I updated SonarQube to 4.2 and it is not working at Jenkins now. T.T Jenkins and SonarQube are installed in same server and I'm using mysql. also, Jenkins setting for SonarQube is pointing the mysql db. ... and Maven version in Jenkins is 3.0.5 I don't set the sonar maven plugin in the java project. It worked fine with Sonar 3.4.1 and I didn't change any setting on Jenkins after update the SonarQube. here is error trace. [ERROR] Expected one result (or null) to be returned by selectOne(), but found: 2 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 16.495s [INFO] Finished at: Tue Apr 15 06:10:08 GMT 2014 [INFO] Final Memory: 20M/89M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.2:sonar (default-cli) on project java-utils: Can not execute SonarQube analysis: Expected one result (or null) to be returned by selectOne(), but found: 2 -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.2:sonar (default-cli) on project java-utils: Can not execute SonarQube analysis at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.do…
has answer: http://stackoverflow.com/a/23245134
has answer: http://stackoverflow.com/a/23297201
downvote count: 0
favorite count: 0
answer count: 5
has title: Sonarqube is not working after update
type: UnansweredQuestion
tagged with: jenkins
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23077815

http://stackoverflow.com/comment/35262404
has text: The new edit seems base on my comment in another answer, doesn't it? I think it worth mentioning
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23073310

http://stackoverflow.com/comment/35211472
has text: Oh no. Its printing default `toString()` method implemention of `Object` class. Just override the `toString)` method of `Pirateword` class. or its object. print its instance fields value rather than object itself.
type: AnswerComment
comment on: http://stackoverflow.com/a/23033370
score: 0
type: Comment

http://stackoverflow.com/a/73636349
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23042450
has body: This question is outdated, but I have a suggest anyway. Be carefull, you have twice times the permission : <uses-permission android:name="android.permission.READ_PHONE_STATE" /> This could generate some errors when you try to run your application.

http://stackoverflow.com/comment/35358068
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23127323
has text: If reader is `closed` then after `read` is called again then what will happen?
score: 0

http://stackoverflow.com/comment/35075157
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22970183
has text: Can u explain bit more about the final part which involves the handler method. Instead of login-welcome file name, I need to place the handler method name?

return
tags question: http://stackoverflow.com/q/23045859
type: Tag
tags question: http://stackoverflow.com/q/23058029
tags question: http://stackoverflow.com/q/22973505
tag name: return
tags question: http://stackoverflow.com/q/23087795
tags question: http://stackoverflow.com/q/23101700
tags question: http://stackoverflow.com/q/23036776
tags question: http://stackoverflow.com/q/23096329
tags question: http://stackoverflow.com/q/23112830
tags question: http://stackoverflow.com/q/23050826
tags question: http://stackoverflow.com/q/22998525

http://stackoverflow.com/comment/35119381
type: Comment
type: QuestionComment
has text: Have you got, or can you make, a sample output image?
comment on: http://stackoverflow.com/q/22994696
score: 0

http://stackoverflow.com/a/23068362
has body: A lambda expression (and a method reference) only makes sense in a context that expects an instance of some functional interface. It would otherwise be impossible to determine if the lambda is valid (and it would also be useless as you don't do anything with it). Something like Consumer&lt;String&gt; c = (String s) -&gt; { s = "hello"; System.out.println(s); }; // as a Consumer, it doesn't really make sense for you to change s Note that as a Consumer, it doesn't really make sense to reassign the value of s.
upvote count: 9
score: 9
accepted answer of: http://stackoverflow.com/q/23068305
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23068305
type: Answer

http://stackoverflow.com/comment/35243366
has text: Yes there is. It's called [ToolTip text](http://docs.oracle.com/javase/tutorial/uiswing/components/tooltip.html)
comment on: http://stackoverflow.com/q/23063400
type: QuestionComment
score: 5
type: Comment

http://stackoverflow.com/q/23001047
tagged with: jlabel
answer count: 0
type: UnansweredQuestion
tagged with: mouselistener
tagged with: swing
has body: As the title says I am trying to add a MouseMotionListener to a class(Magnet) that I created which extends JLabel. The program is using RMI to communicate between client and server. The class that is extending the JLabel is the data that is being transferred. My issue is that when I add the MouseMotionListener in the client, the program doesn't register the movements. As I said the code I have below doesn't print anything even though it should. I don't get any warnings or error. I am really lost. Here is the Magnet class private static final long serialVersionUID = 1L; private Font FONT = new Font("comic sans ms", Font.BOLD, 20); private char letter; private int x; private int y; private int id; public Magnet(int x, int y, char letter, int id) { super(); this.x = x; this.y = y; this.id = id; this.letter = Character.toUpperCase(letter); setText(Character.toString(this.letter)); setFont(FONT); setBounds(x, y, 25, 25); } public char getLetter() { return letter; } public int getID() { return id; } public int getX() { return x; } public int getY() { return y; } public void relocate(int x, int y) { this.x = x; this.y = y; setBounds(x, y, 25, 25); } The client class setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 400, 400); setResizable(false); contentPane = new JPanel(); contentPane.setLayout(null); try { magnets = (MagnetInterface) Naming .lookup("//localhost:6667/MagnetServer"); System.out.println("client: connected!"); for (int i = 0; i &lt; magnets.getSize(); i++) { magnets.getMagnet(0).addMouseMotionListener( new MouseMotionListener() { @Override public void mouseMoved(MouseEvent arg0) { // TODO Auto-generated method stub System.out.println("test"); } @Override public void mouseDragged(MouseEvent arg0) { // TODO Auto-generated method stub System.out.println("test"); } }); contentPane.add(tmp); } } catch (MalformedURLException | RemoteException | NotBoundException e) { System.out.println(e.getMessage()); // e.printStackTrace(); } setContentPane(con…
tagged with: rmi
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35130287
score: 0
has comment: http://stackoverflow.com/comment/35139807
has comment: http://stackoverflow.com/comment/35130351
has title: How to add MouseMotionListenter to a class that extends JLabel?

http://stackoverflow.com/comment/35315853
score: 0
has text: I am trying to paste the image. But Stack Overflow site says that i should have 10 reputations :(
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23076073

http://stackoverflow.com/a/23118944
answers question: http://stackoverflow.com/q/23118772
type: Answer
has body: The URI in &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; is not really a reference to the internet. Even after putting the Jar file in WEB-INF/lib/ you will leave the uri as that address. The servlet container is always looking for the jar in WEB-INF/lib/ and never downloads it from http://java.sun.com/jsp/jstl/core. That URI is more like a unique name identifying the taglib. Check for yourself by clicking the link to http://java.sun.com/jsp/jstl/core There is no jar file to download there. Its just an identifier.
downvote count: 0
type: AcceptedAnswer
score: 8
accepted answer of: http://stackoverflow.com/q/23118772
upvote count: 8

http://stackoverflow.com/comment/35166350
type: QuestionComment
comment on: http://stackoverflow.com/q/23020604
has text: Your `numberUsr` field is redundant. `ArrayList` maintains it's elements' count itself (`size():int` method in Collection interface).
score: 0
type: Comment

http://stackoverflow.com/comment/35127850
type: AnswerComment
has text: Wouldn't referencing the Cat class in that way mean I'd have to have the interface class extend the Cat class and then have to invoke the Cat constructor?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22999301

http://stackoverflow.com/comment/35354752
type: QuestionComment
type: Comment
has text: @user3543906 i can say that there is no need for a constructor in a Activity class. comment the log statements. And run again. It should work. And i don't know who downvoted my answer but i can say the constructor is definitely no needed.
comment on: http://stackoverflow.com/q/23125418
score: 0

http://stackoverflow.com/a/23126457
has body: You can use a combination of do while loop and switch to make decisions based on user input public class Test{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int choice; do{ choice = sc.nextInt(); switch(choice){ case 1: function1(); break; case 2: function2(); break; case 3: function3(); break; case 4: function4(); break; } }while(choice!=0); } public static void function1(){/*definition*/} public static void function2(){/*definition*/} public static void function3(){/*definition*/} public static void function4(){/*definition*/} }
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23126246
accepted answer of: http://stackoverflow.com/q/23126246
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/35381367
score: 0
type: AnswerComment
type: Comment
has text: I'm not seeing an analyzer being set in the code provided, so I assume you are using the default, `StandardAnalyzer`, in which case it is split into tokens on whitespace/punctuation (generally, see [UAX-29](http://www.unicode.org/reports/tr29/)), lowercased, and english stopwords are removed. None of this, on the other hand, is being done to the query text. Do your queries look like they agree with this? Are the terms in lowercase, for instance, or do they have punctuation or spaces in them?
comment on: http://stackoverflow.com/a/23088354

http://stackoverflow.com/q/23031121
has comment: http://stackoverflow.com/comment/35185091
has title: How can I CLOSE showOptionDialog?
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35185544
has body: One of my codes in Java is like below. When I first click 'No', the showOptionDialog pops up again asking me same question 'Yes' or 'No'. I click 'No' and it shows up again. Then when I click 'No' at third time, it will dispose itself. Though I haven't implemented any code for 'No' in the below code. Can you see any error in the code please? mainFrame.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent windowEvent) { Object[] options = {"Yes", "No"}; int n = JOptionPane.showOptionDialog(mainFrame,"Do you really want to close iDiary?","Exit", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE,null,options,options[1]); if(n==0) { System.out.println(n++); System.exit(1); } } ); Note In the JFrame called mainFrame has JTabbedPane tab = new JTabbedPane(); in it. There are 3 tabs in the mainFrame. I strongly assume that the 3 tabs are related to popping up three times. Any suggestion so it will only pops up once only?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35185749
answer count: 0
has comment: http://stackoverflow.com/comment/35185139
type: Question
has comment: http://stackoverflow.com/comment/35190392
has comment: http://stackoverflow.com/comment/35185726
has comment: http://stackoverflow.com/comment/35185180

http://stackoverflow.com/comment/35243447
comment on: http://stackoverflow.com/q/23053265
type: Comment
type: QuestionComment
has text: What difference in behaviour are you actually seeing? Probably just your environment is different? same user? same kettle.properties? same JVM version?
score: 0

http://stackoverflow.com/comment/35237130
has text: Actually, one more thing. Why is A last? When D goes through the method, it has null for both children so shouldn't it be popped off as well? So it would look like: ABD -> AB -> A -> E -> EF -> E -> G?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23059471

http://stackoverflow.com/q/22987623
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35105371
has title: Synchronization using System.currentTimeMillis() for timer schedule
possible better answer: http://stackoverflow.com/a/22987849
has comment: http://stackoverflow.com/comment/35105346
upvote count: 1
tagged with: android
tagged with: datetime
tagged with: scheduled-tasks
favorite count: 0
accepted answer: http://stackoverflow.com/a/22987960
has answer: http://stackoverflow.com/a/22987849
has body: I want to synchronise an action across multiple Android devices. For this I have a telnet client that I can send message to them. Currently I send a message like DoWork On 1397131360435 to the devices. As you can notice the last argument is timestamp. At the moment in my code I calculate the time difference between the given argument and use a TimerTask to call the method I want. But this doesn't work exactly like I want because of influence of network delay and the time that this command arrives at devices is a bit different which results in few milliseconds of delay between devices. Is there a way that I can wait for a specific timestamp and then run the method I want? Currently I do like this: msDelay = Long.parseLong(args.get(2)) - System.currentTimeMillis(); //inside a listener new java.util.Timer().schedule( new java.util.TimerTask() { @Override public void run() { mySyncMethod(); } }, msDelay ); So what I mean is, I want to run the mySincMethod when the timestamp is 1397131360435....not just its difference with local System.currentTimeMillis()
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22987960
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35105454

http://stackoverflow.com/comment/35137178
type: Comment
comment on: http://stackoverflow.com/a/23005011
type: AnswerComment
has text: Yes.It worked. Now i understand the issue. Thank you very much.
score: 0

http://stackoverflow.com/a/22989610
type: Answer
has body: Try with a Filter if this path /path1 is called most of the times and put your logic there. You have full control on this filter. You can define skip URLs in web.xml separated by commas. I used this Filter for compression logic. web.xml: MyFilter com.x.y.z.servlet.MyFilter skipEqualsURIs skipStartsWithURIs skipEndsWithURIs MyFilter /* MyFilter.java: public class MyFilter implements Filter { /** The skip equals ur is set. */ private Set<String> skipEqualsURIsSet = new HashSet<String>(); /** The skip starts with ur is set. */ private Set<String> skipStartsWithURIsSet = new HashSet<String>(); /** The skip ends with ur is set. */ private Set<String> skipEndsWithURIsSet = new HashSet<String>(); @Override public void init(FilterConfig filterConfig) throws ServletException { String skipEqualsURIs = filterConfig.getInitParameter("skipEqualsURIs"); if (skipEqualsURIs != null && skipEqualsURIs.trim().length() > 0) { for (String skipURI : skipEqualsURIs.split(",")) { skipEqualsURIsSet.add(skipURI); } } String skipStartsWithURIs = filterConfig.getInitParameter("skipStartsWithURIs"); if (skipStartsWithURIs != null && skipStartsWithURIs.trim().length() > 0) { for (String skipURI : skipStartsWithURIs.split(",")) { skipStartsWithURIsSet.add(skipURI); } } String skipEndsWithURIs = filterConfig.getInitParameter("skipEndsWithURIs"); if (skipEndsWithURIs != null && skipEndsWithURIs.trim().length() > 0) { for (String skipURI : skipEndsWithURIs.split(",")) { skipEndsWithURIsSet.add(skipURI); } } } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws ServletException, IOException { HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; String uri = httpServletRequest.getRequestURI(); if (isSkip(uri)) { // do what you want to do based on skip logic // filterChain.doFilter(servletRequest, servletResponse); } else { // do what you want to do based on skip logic // filterChain.doFilter(servletReque…
answers question: http://stackoverflow.com/q/22989154
has comment: http://stackoverflow.com/comment/35110248
has comment: http://stackoverflow.com/comment/35109993
score: 0
has comment: http://stackoverflow.com/comment/35110484
has comment: http://stackoverflow.com/comment/35110304

http://stackoverflow.com/comment/35236152
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23058239
has text: An object of type `java.sql.Date` should never be used outside of jdbc layer! And in JDK-pre8 there is no plain date type. In Java 8 you have the extra method [toLocalDate()](http://docs.oracle.com/javase/8/docs/api/java/sql/Date.html#toLocalDate--).

http://stackoverflow.com/comment/35093298
has text: when I pulled the zip file out the device and tried to unzip on my Windows PC, it is saying "! C:\Users\Hardik\Desktop\products.zip: The archive is corrupt ! C:\Users\Hardik\Desktop\products.zip: The archive is corrupt ! C:\Users\Hardik\Desktop\products.zip: CRC failed in Product_images\UITWEJSDJ.JPG. The file is corrupt ! C:\Users\Hardik\Desktop\products.zip: The archive is corrupt "
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22980007
type: AnswerComment

http://stackoverflow.com/a/23102337
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/23102193
upvote count: 1
has body: There is property name mismatch: private Properties emails=null; should ideally be: private Properties adminEmails=null; getters and setters should be renamed accordingly. This will match with what you have mentioned in the configuration files.

http://stackoverflow.com/q/23094428
has title: Why is my ListView empty?
has comment: http://stackoverflow.com/comment/35385839
answer count: 0
has comment: http://stackoverflow.com/comment/35389022
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35400833
has comment: http://stackoverflow.com/comment/35396424
type: Question
has comment: http://stackoverflow.com/comment/35384984
has comment: http://stackoverflow.com/comment/35386525
has comment: http://stackoverflow.com/comment/35390305
tagged with: sqlite
downvote count: 0
has body: I am new in Android. I have followed some tutorials about ContentProviders and Loaders. I have created a Notepad application, but I think it fails to save the content into database. I have two activities: NoteList with the list of notes and NoteEdit where the notes are created, and one ContentProvider: NotesDbAdapter. When I save the note , the list is empty. NoteEdit.java public class NoteEdit extends Activity{ public static int numTitle = 1; public static String curDate = ""; public static String curText = ""; private EditText mTitleText; private EditText mBodyText; private TextView mDateText; private Long mRowId; private String mode; private Cursor note; private NotesDbAdapter mDbHelper; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // mDbHelper = new NotesDbAdapter(this); // mDbHelper.open(); setContentView(R.layout.note_edit); setTitle(R.string.app_name); mTitleText = (EditText) findViewById(R.id.title); mBodyText = (EditText) findViewById(R.id.body); mDateText = (TextView) findViewById(R.id.notelist_date); long msTime = System.currentTimeMillis(); Date curDateTime = new Date(msTime); SimpleDateFormat formatter = new SimpleDateFormat("d'/'M'/'y"); curDate = formatter.format(curDateTime); mDateText.setText(""+curDate); mRowId = (savedInstanceState == null) ? null : (Long) savedInstanceState.getSerializable(NotesDbAdapter.KEY_ROWID); if (mRowId == null) { Bundle extras = getIntent().getExtras(); mode = extras.getString("mode"); mRowId = extras != null ? extras.getLong(NotesDbAdapter.KEY_ROWID) : null; } populateFields(); } public static class LineEditText extends EditText{ // we need this constructor for LayoutInflater public LineEditText(Context context, AttributeSet attrs) { super(context, attrs); mRect = new Rect(); mPaint = new Paint(); mPaint.setStyle(Paint.Style.FILL_AND_STROKE); mPaint.setColor(Color.BLUE); } private Rect mRect; private Paint mPaint; @Override protected void onDraw(Canvas canvas) { int h…
has comment: http://stackoverflow.com/comment/35387176
favorite count: 0
has comment: http://stackoverflow.com/comment/35317515
tagged with: android-listview
tagged with: android
tagged with: android-adapter
has comment: http://stackoverflow.com/comment/35319362
has comment: http://stackoverflow.com/comment/35384670

http://stackoverflow.com/comment/35108983
score: 0
comment on: http://stackoverflow.com/a/22987029
type: AnswerComment
type: Comment
has text: @someone2088 You don't need to create the jar file, unless you have more then one class.

http://stackoverflow.com/a/23049345
accepted answer of: http://stackoverflow.com/q/23049088
has comment: http://stackoverflow.com/comment/35218582
has comment: http://stackoverflow.com/comment/35218967
answers question: http://stackoverflow.com/q/23049088
has body: Probability of getting 5 cards with the same value, using method you implemented, is ~1/28500. In such cases, your code tries to choose different suits for all 5 cards and falls into infinite while loop.
has comment: http://stackoverflow.com/comment/35219152
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35259445
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/23117422
upvote count: 2
has body: The problem is not that you use mid, which is an int, to index an array of Strings. This is perfectly fine. The problem is that you try to use the &gt; operator with Strings. To compare Strings, you can use compareTo instead of &gt;. So, instead of: a[mid] &lt; key You would use: a[mid].compareTo(key) &lt; 0
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35340266
has comment: http://stackoverflow.com/comment/35340226
answers question: http://stackoverflow.com/q/23117344

http://stackoverflow.com/q/22981586
tagged with: jsf-2
has comment: http://stackoverflow.com/comment/35101026
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22985309
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35101919
score: 2
tagged with: jsf
tagged with: java
type: Question
has body: When I authenticate to my JSF app as an authenticated user via different browsers, different user sessions are maintained by JSF for me even when I am authenticating with a single user account. Is there any way to avoid this &amp; use just a single session instance on server for all concurrent different browsers sessions whenever using same user account ? Edit: What about storing the user session data in application scope, so that it can be made available more globally for different browsers sessions) &amp; using a PreDestroy method on a session scoped bean to destroy the user session data in application scope (so that it has same lifetime as that of @SessionScoped data) ? I would maintain a map &lt;userId, userSessionInstance&gt; in application scope, for all currently authenticated users to my app. So it would allow me to check when creating session for a user if an instance is already available, in application scope.
has title: Same JSF session for same user account in different browsers sessions?
tagged with: session
tagged with: jsf-2.2

http://stackoverflow.com/comment/35227253
score: 0
type: AnswerComment
has text: wrong answer please run the program it is not going inside while .
type: Comment
comment on: http://stackoverflow.com/a/23054000

http://stackoverflow.com/comment/35218457
type: Comment
has text: @codeNinja It would help for the OP to learn variable assignments. One is not going to nest function calls in arguments for an entire program.
comment on: http://stackoverflow.com/a/23049623
type: AnswerComment
score: 0

http://stackoverflow.com/a/23021748
type: Answer
answers question: http://stackoverflow.com/q/23021377
upvote count: 3
score: 3
has body: Let me point you in right direction. As others have commented, this stack does not work properly Consider doing something like this: public class ListStack { private class Node { private int value; private Node next; //inner class which holds your each element and reference to next //fill all details required } private Node head; private int size; public ListStack() { head = null; size = 0; } public void push(int value) { Node temp = new Node(value); if(head == null) head = temp; else { temp.setNext(head); // provide link to already existing stack head = temp; // bring new element on top } } public int pop() { if(head==null); //throw exception int temp = head.getValue(); head = head.getNext(); //remove element and bring down the stack return temp; } }
downvote count: 0

http://stackoverflow.com/a/23056036
has comment: http://stackoverflow.com/comment/35267535
has comment: http://stackoverflow.com/comment/35359527
type: Answer
has comment: http://stackoverflow.com/comment/35363389
has comment: http://stackoverflow.com/comment/35370219
accepted answer of: http://stackoverflow.com/q/23055906
has comment: http://stackoverflow.com/comment/35274289
has comment: http://stackoverflow.com/comment/35376884
has comment: http://stackoverflow.com/comment/35229893
has comment: http://stackoverflow.com/comment/35359414
upvote count: 1
has comment: http://stackoverflow.com/comment/35231244
has comment: http://stackoverflow.com/comment/35269203
has body: Try to add it to web.xml check order of your declaration AppName contextConfigLocation classpath:applicationContext*.xml //... instead of your tag And then put your applicationContext.xml into src->java->resources that should help. Be sure that you have dispatcherServletContext.xml in your WEB-INF the same directory as you have your web.xml. dispatcherServletContext.xml: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"> <context:component-scan base-package="yourPackage"/> /WEB-INF/${pagesPath} .jsp </beans> Properly configure your pom <?xml version="1.0" encoding="UTF-8"?> 4.0.0 groupId ArtifactName 1.0-SNAPSHOT war name <cxf.version>2.7.10</cxf.version> <spring.version>4.0.2.RELEASE</spring.version> <junit.version>4.11</junit.version> <hibernate.version>4.3.0.Final</hibernate.version> RondoServer maven-compiler-plugin 1.7 1.7 UTF-8 maven-war-plugin 2.1 {path_to_webxml}/WEB-INF/web.xml APP_NAME org.apache.maven.plugins maven-resources-plugin 2.6 UTF-8 src/test/resources/ true src/main/resources true org.apache.cxf cxf-rt-frontend-jaxws ${cxf.version} org.apache.cxf cxf-rt-transports-http ${cxf.version} org.springframework spring-core ${spring.version} //...other spring dependency on the same lvl
score: 1
has comment: http://stackoverflow.com/comment/35268250
has comment: http://stackoverflow.com/comment/35365764
has comment: http://stackoverflow.com/comment/35231151
has comment: http://stackoverflow.com/comment/35357622
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35348520
downvote count: 0
has comment: http://stackoverflow.com/comment/35230744
answers question: http://stackoverflow.com/q/23055906
has comment: http://stackoverflow.com/comment/35365800
has comment: http://stackoverflow.com/comment/35368487

http://stackoverflow.com/q/23005071
tagged with: swing
has title: Can't get my JComboBox to Populate from the Database
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/35137422
has comment: http://stackoverflow.com/comment/35139535
type: Question
has body: I have been trying for hours to get my JComboBox to populate with the column names in my database, With no success. At first I loaded three column names that are within my table to put into it and then stripped it down to just one to see if it will even work. And yet I get a NullPointerException Can someone please give me guidance on how to make this work? Thanks. public BlankStock() { conman = new ConnectionManager(); con = conman.CreateConnection(); initComponents(); BlankBox.setModel(fillBlankBox()); BlankBox.removeAllItems(); BlankBox.addItem("Please Select..."); fillBlankBox(); } public DefaultComboBoxModel fillBlankBox() { try { String qry = "SELECT MCOBlanks FROM `blanks` WHERE MCOBlanks = 'blanks' "; //Connection con = null; // con = getConnection(); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(qry); System.out.println(rs.getStatement().toString()); ComboBoxModel cbm = new DefaultComboBoxModel(); DefaultComboBoxModel dcbm = new DefaultComboBoxModel(); while (rs.next()) { Object data1 = BlankBox.getSelectedItem(); cbm.addListDataListener(BlankNo); } dcbm.addElement(BlankBox); BlankBox.setModel(cbm); rs.close(); stmt.close(); } catch (SQLException e) { System.out.println(e); } // } finally { // try {con.close();} catch (SQLException e){;} // } return cbm;
has comment: http://stackoverflow.com/comment/35137259
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/35138065
has comment: http://stackoverflow.com/comment/35137264
tagged with: jcombobox
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23050177
accepted answer: http://stackoverflow.com/a/23050255
score: 0
has title: adding spring resources to eclipse
has comment: http://stackoverflow.com/comment/35239361
tagged with: maven
tagged with: spring
type: AnsweredQuestion
has body: I'm struggling with adding spring framework libaries to my eclipse (with maven plug-in m2eclipse) How can I achieve it in easiest way and why is it so complicated for a newbe user? It's really frustrating that I can't move on with thing that simple like this. Main goal is add spring libaries to my pom.xml file in depedencies tab in my dynamic web project in eclipse. Pom.xml is generated thanks to maven plug-in. First of all I moved to the Eclipse Marketplace and installed Spring Tool Suite for Eclipse Kepler 4.3 and the result is nothing - still can't add libaries. Second attempt was installing the same suite for my whole windows, nothing worked so far. Sample screenshot (all I can add is this): Where is spring-web, spring-context, spring-webmvc etc. ? For me it's night and I don't have fresh eye on it but what am i missing here?
tagged with: java
tagged with: eclipse
tagged with: m2eclipse
type: Question
has answer: http://stackoverflow.com/a/23050255
answer count: 1

http://stackoverflow.com/a/23008295
has body: Suppose your previous frame is myPreviousFrame just write myPreviousFrame.setVisible(true); when you want to make visible. Example: currentFrame.dispose(); myPreviousFrame.setVisible(true); Note: if you write code System.exit(0) it will close (terminate) your application. When your application goes terminate you can not make login frame as visible. You need to restart your application. So you need to write dispose(). UPDATED: I suppose you have a method exitForm() which invokes when you click the Close (X). Example: private void exitForm(java.awt.event.WindowEvent evt) { //System.exit(0); which was used // to fullfill your requirement you need to write below code this.dispose();// here [this] keyword means your current frame //OR simply you can use this.setVisible(false); instead of this.dispose(); myPreviousFrame.setVisible(true); // this will displays your login frame }
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35145762
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23008246
upvote count: 1
answers question: http://stackoverflow.com/q/23008246
has comment: http://stackoverflow.com/comment/35144416
has comment: http://stackoverflow.com/comment/35143009
type: Answer

http://stackoverflow.com/comment/35260585
comment on: http://stackoverflow.com/a/23057594
type: AnswerComment
has text: This answer helped solve part of the problem (the biggest). But the main point is that without that annotation the DB use the ordinals (Which is bad because this format can be broken by reordering the enum constants like some auto-refactoring tools do).
score: 0
type: Comment

http://stackoverflow.com/a/23647661
upvote count: 6
answers question: http://stackoverflow.com/q/23006777
score: 6
accepted answer of: http://stackoverflow.com/q/23006777
has body: After a deep analysis by the Eclipse Team (btw great thanks!) their answer on this problem is following Quoted after Stephan Herrmann from Eclipse Bugzilla: This line doesn't apply for the following reason: Type inference starts by resolving this expression: Optional.fromNullable(entry.getValue()) In this expression all elements can be typed as stated above: entry : Entry entry.getValue: capture#2-of ? fromNullable(..) : (capture#2-of ?) -&gt; Optional&lt;capture#2-of ?&gt; In short: T is inferred to be "capture#2-of ?". Inference succeeds. Only after all these have been decided, does resolution proceed to inspect the .or(..) method call. No reason to fill in un-inferred inference variables with "Object". With a receiver of type Optional, we have these three overloads of "or": Optional or(Optional) capture#2-of ? or(Supplier&lt;? extends capture#2-of ?&gt; supplier) capture#2-of ? or(capture#2-of ? defaultValue) None of these methods is applicable for an argument of type Object. ecj arbitrarily picks the first method for error reporting: "The method or(Optional) in the type Optional is not applicable for the arguments (Object)" The difference between ecj and javac is most certainly covered by the mentioned javac bug: https://bugs.openjdk.java.net/browse/JDK-8016207 As mentioned in that bug, a future update of the JLS may possibly adopt parts of the current javac behavior. Until such a spec update is released, the only reliable point of reference for ecj is the JLS. In this specification I see no reason for changing the behavior of ecj in this regard. BTW, the canonical fix (no cast needed) is: Optional.&lt;Object&gt;fromNullable(entry.getValue()).or(NO_VALUE); For now that would be the conclusion.
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35242453
comment on: http://stackoverflow.com/q/23062918
has text: Simplest way is to get hash of it (_using default hashCode() method_).
type: Comment
score: 2
type: QuestionComment

http://stackoverflow.com/q/23036432
type: Question
upvote count: 2
answer count: 2
has title: Basic things about object creation :is it a good practice to create a new object of listener,every time we want to set a listener for a View
tagged with: android
favorite count: 0
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/23036496
has answer: http://stackoverflow.com/a/23036502
type: AnsweredQuestion
has body: Well i was working on optimizing my app,and i thought that each time we are setting up a listener,generally we do it like this fadeOut.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationStart(Animation animation) { } }); and in this way,are we creating a new object everytime by not providing a variable name to it?i mean suppose I want to set the listener for fadeOut twice,won't it take twice the space for the two listeners that have been created ?shouldn't I create a variable instead ?and keep writing it over whenever needed? will fadeOut.setAnimationListener(null) clear out all the variables that have been created ? Does this common practice takes so less memory that it can be ignored?
tagged with: java
has answer: http://stackoverflow.com/a/23036496
linked to: http://stackoverflow.com/q/2129044
possible better answer: http://stackoverflow.com/a/23036502

http://stackoverflow.com/q/22990290
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35111117
score: 1
tagged with: java
tagged with: jax-ws
type: Question
has answer: http://stackoverflow.com/a/22991000
downvote count: 0
answer count: 1
tagged with: glassfish
has body: I am learning how to create a Java Web Service JAX-WS. To achieve this I followed this Netbeans 8.0 guide: https://netbeans.org/kb/docs/websvc/jax-ws.html In the guide we learn how to create a Web Server, and a Client. Before running the server, I deploy it to NetBeans GlassFish server, and then the client access it. Everything works well locally. However, now I wish to export the web server into an external file (war, jar, etc) and to run it on a remote machine, so I can then try to access it using my local client. I have tried using "right-click" on project and searched for export options, but I found none. In the File menu, I am only allowed to export to a ZIP file, which is not what I want because I want to be able to run my code on a remote server that has no NetBeans and no GlassFish installed. How do I do this? EDIT I wish to launch this without maven or any other tools of the kind. After reading a completely unrelated article from Oracle for Java EE7 I found that i can create wars build building and cleaning the project (following is the version of that article for Java EE6, because I cannot find the one for EE7 :S ): http://docs.oracle.com/javaee/6/tutorial/doc/bnayn.html Having this in mind the challenge is now to launch the generated .war file using java -jar something.jar. For this purpose I am considering using Jetty 8.
accepted answer: http://stackoverflow.com/a/22991000
has comment: http://stackoverflow.com/comment/35111263
favorite count: 0
tagged with: netbeans
has title: How to export Java Web Service using Netbeans 8.0?
upvote count: 1
tagged with: web-services

http://stackoverflow.com/q/23109869
favorite count: 0
has comment: http://stackoverflow.com/comment/35325866
accepted answer: http://stackoverflow.com/a/23109940
has title: android String numberformatexception
possible better answer: http://stackoverflow.com/a/23109938
has comment: http://stackoverflow.com/comment/35326012
upvote count: 1
type: AnsweredQuestion
has body: i try to split String array and show rundom values in this array.i wrote function witch can split String public int Cal(String ab) { String[] arr=ab.split(":"); int av=(Integer.parseInt(arr[0])*60 + Integer.parseInt(arr[1]))*1000; return av; } and i call this function like this String[] st = {"00:49 ","00:49","02:17","03:26","03:55", "04:26", "05:25" }; Random random = new Random(); String index = st[random.nextInt(st.length)]; Log.e("randommmmmmmmmmmm", String.valueOf(Cal(index))); i have numberformatexception exception. i have not idea what i am doing wrong
has comment: http://stackoverflow.com/comment/35325899
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35325962
type: Question
has answer: http://stackoverflow.com/a/23109949
has comment: http://stackoverflow.com/comment/35325834
has answer: http://stackoverflow.com/a/23110050
has answer: http://stackoverflow.com/a/23109940
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/23109938
tagged with: android
answer count: 4

http://stackoverflow.com/comment/35140034
score: 0
type: Comment
type: QuestionComment
has text: How would you create the different sequences? Using `@GeneratedValue(generator = "seq")` with `@SequenceGenerator(name="seq", initialValue=1, allocationSize=100)`?
comment on: http://stackoverflow.com/q/23006172

http://stackoverflow.com/a/23801583
has comment: http://stackoverflow.com/comment/36811174
answers question: http://stackoverflow.com/q/22977955
has body: Events feed = client.events().list("calendarId").setQ("search text").execute();
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36656915
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36893432
accepted answer of: http://stackoverflow.com/q/22977955

http://stackoverflow.com/a/23105775
has body: Do this Store prime numbers retrived in loop in ArrayList&lt;Integer&gt; Get the size of arraylist and use random function to access number from that array list for example. Say ArrayList size is 10 than use Random function to generate random number between 0 to 9 so what ever number you get use that number to access arrayList element.
upvote count: 1
answers question: http://stackoverflow.com/q/23105604
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35261608
type: Comment
has text: Is there a way I can dynamically get that page?
comment on: http://stackoverflow.com/a/23073068
type: AnswerComment
score: 0

http://stackoverflow.com/a/23019414
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23019260
downvote count: 0
has body: The exact size of a reference is not mandated by the Java Specifications (you can see what is mandated here). This size is completely dependent on the Java Virtual Machine implementation, and so in some system it can be of 32bits, in other 64bits. About you sample code, both are exactly the same for the JVM (see footnote #1 nonetheless). Remember that space for variables created inside functions is kept in the Stack and so before entering the function the JVM will make room for that variable (strReference). Source: here. So it is not about where/how you create your references but about where/how you create the data that will be inside your references. If you want to see more, try compiling your code and then using javap to see the generated bytecode. That way you can see if the implementation really changes. Footnote #1: The first 4 variables/parameters/this in each method have special management inside the bytecode, so there can be a difference in that case if you declare your reference early in the code. This difference is about the size and speed of the bytecode as those 4 first variables have special "opcodes" for them.
accepted answer of: http://stackoverflow.com/q/23019260
type: AcceptedAnswer

http://stackoverflow.com/q/22978482
tagged with: android
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: unit-testing
has answer: http://stackoverflow.com/a/36468310
has comment: http://stackoverflow.com/comment/35089488
type: Question
has comment: http://stackoverflow.com/comment/35090196
has title: Difference between @VisibleForTesting and @Deprecated int unit test
has body: Let's say that there just so happens to be an existing long private method (one of which i'm not allowed to refactor into smaller pieces at this stage in the development process) but i really want to write a couple of regression-protection unit test for it, just for now. i just heard of this @VisibleForTesting annotation, but am not too sure of its benefits and gotchas. Previously, i had always been marking things with @Deprecated and comments to try and make it VERY CLEAR like: ... some code ... // ====================================== TESTING USE ONLY BELOW ====================================== @Deprecated // TESTING ONLY, DO NOT USE! boolean testGiveAccessToSomethingPrivate() { // call some private method and get the results } it seems that whenever i mark something as @VisibleForTesting it seems to expose the method for realz, without any indication to the user of the API that this method was only meant for testing... (whereas if i mark the method with @Deprecated, most IDEs will put a strike-through that warns other developers to not accidentally use the test method for their actual code
tagged with: java
has comment: http://stackoverflow.com/comment/35090888
has comment: http://stackoverflow.com/comment/35089641
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23048532
upvote count: 2
has comment: http://stackoverflow.com/comment/35231896
has body: I'm new to struts2. I'm doing form validation using xml. But few of my feilds are getting invalidated everytime. The filds which are getting invalidated are: police station, father's name, phone number and id number. My validation for phone number is showing two error messages. One that i have provided in my xml and other is Invalid field value for field "phone". Further, for client side validation, if i add validate=true" to my <s:form> tag, following error appears just after my form in jsp FreeMarker template error! Method public java.util.List org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception when invoked on org.apache.struts2.components.Form@17bb1c6 The problematic instruction: ---------- ==> list tag.getValidators("${tagName}") as aValidator [on line 66, column 9 in template/~~~xhtml/form-close-validate.ftl] in include "/${parameters.templateDir}/${parameters.expandTheme}/form-close-validate.ftl" [on line 25, column 1 in template/xhtml/form-close.ftl] ---------- Java backtrace for programmers: ---------- freemarker.template.TemplateModelException: Method public java.util.List org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception when invoked on org.apache.struts2.components.Form@17bb1c6 at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130) at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93) at freemarker.core.Expression.getAsTemplateModel(Expression.java:89) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94) at freemarker.core.Environment.visit(Environment.java:221) at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167) at freemarker.core.Environment.visit(Environment.java:428) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102) at freemarker.core.Environment.visit(Environment.java:221) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:221) at freemar…
has comment: http://stackoverflow.com/comment/35271493
possible better answer: http://stackoverflow.com/a/48095939
has answer: http://stackoverflow.com/a/48095939
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35218452
has title: Struts2 validations not working properly
tagged with: java
has answer: http://stackoverflow.com/a/23052611
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35268174
tagged with: jsp
tagged with: struts2
accepted answer: http://stackoverflow.com/a/23052611
has comment: http://stackoverflow.com/comment/35237149
tagged with: validation
downvote count: 0
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0

http://stackoverflow.com/a/22980178
type: Answer
has comment: http://stackoverflow.com/comment/35394617
upvote count: 2
has body: Readers are not meant to read octet streams. Reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines. You're looking for a BufferedInputStream. The getContent() method on the HttpEntity returns an InputStream. Wrap this around a BufferedInputStream and write it to a file or a ByteArrayOutputStream. byte[] buffer = new byte[5 * 1024]; int numRead = -1; while( (numRead = bufferedInputStream.read(buffer))!= -1) { byteArrayOutputStream.write(buffer, 0, numRead); } byteArrayOutputStream.flush(); byteArrayOutputStream.close(); byte[] result = byteArrayOutputStream.toByteArray(); To save on memory I'd advise you to write to a BufferedOutputStream instead of trying to get the bytes from the stream into a data structure. The android device is likely to run out of memory for large zip files.
has comment: http://stackoverflow.com/comment/35400251
has comment: http://stackoverflow.com/comment/35400532
has comment: http://stackoverflow.com/comment/84652906
score: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22979647
downvote count: 0
answers question: http://stackoverflow.com/q/22979647

http://stackoverflow.com/comment/35261917
score: 1
comment on: http://stackoverflow.com/q/23073284
has text: You could do a check at the beginning of the method to see if the index you have reached is greater than the length of the array.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35116415
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22993407
has text: define "format it to long". 1234567890989 is a long (the java primitive type) value.
score: 0

http://stackoverflow.com/comment/35130462
type: QuestionComment
comment on: http://stackoverflow.com/q/23001085
score: 1
has text: `Byte` is an integer value represented in base 10. `36` in base 10 is `24` in base 16. They are the same number.
type: Comment

http://stackoverflow.com/a/23055308
answers question: http://stackoverflow.com/q/23054640
has comment: http://stackoverflow.com/comment/35229624
has comment: http://stackoverflow.com/comment/35228975
has comment: http://stackoverflow.com/comment/35228964
has comment: http://stackoverflow.com/comment/35228765
score: 0
type: Answer
has body: A simple scenario is to use two Tomcat instances (Tomcat-7one, Tomcat-7two). Edit the server.xml file from tomcat/config folder the following way: For the first instance: &lt;Connector port="8080" protocol="HTTP/1.1" For the second instance: &lt;Connector port="8081" protocol="HTTP/1.1" Put one war in the webapp folder of the 1st tomcat instance and the second war - in the webapp folder of the second tomcat instance. start both tomcats. your apps should be available at: localhost:8080/ROOT/ and localhost:8081/sky/ prefixed by http://

http://stackoverflow.com/a/23119000
has comment: http://stackoverflow.com/comment/35365541
score: 0
answers question: http://stackoverflow.com/q/23118478
type: Answer
has comment: http://stackoverflow.com/comment/35343905
has body: In case your Spring MVC configuration is correct I recommend to do the following: Remove the headers attributes and try to reach the URL within the browser. If this works, your Request Mapping is ok. If not there is something wrong with your MVC config and/or the servlet mapping. In case the first step is successful, you can try to add the headers again, but like this: headers = "x-requested-with=XMLHttpRequest" The consequence of setting this is header: The URL is not reachable by a normal browser GET. The request header "x-requested-with" is expected to be set. (just a note) Have fun!

http://stackoverflow.com/comment/35152213
type: AnswerComment
comment on: http://stackoverflow.com/a/22998888
type: Comment
has text: I think that you should go and learn the programming basics, like how to use these accessors, what would help you a lot.
score: 0

http://stackoverflow.com/q/22977247
tagged with: java
has comment: http://stackoverflow.com/comment/35087413
linked to: http://stackoverflow.com/q/34571
type: Question
has answer: http://stackoverflow.com/a/22977389
score: 2
answer count: 1
downvote count: 0
duplicate of: http://stackoverflow.com/q/34571
favorite count: 0
has body: I have some abstract class and some classes that inheritance from it. I want to make JUNIT tester for it. I tried use reflect on the sub classes but in this way I cant see the private variables in the absract class. how can I get to, Or maybe I can create instance of the abstract class for this?
has comment: http://stackoverflow.com/comment/35087442
accepted answer: http://stackoverflow.com/a/22977389
upvote count: 2
has title: java reflect private variables
has comment: http://stackoverflow.com/comment/35087340
type: AnsweredQuestion
tagged with: reflection

http://stackoverflow.com/a/23024089
has body: Depending on how you restored the other files, you might run into merge conflicts once you pull from your remote repository. Make sure to make a backup first. Eclipse: In the context menu of your Eclipse project, you should see the entries Team -> Remote -> Configure Fetch from Upstream / Configure Push to Upstream There you can configure where to fetch from, and where to push to, respectively. Once you have configured the URI to your remote repo, you might want to use the Dry-Run button to check that it is linked correctly. Command line: You can also use the command line to organize your remote repositories. Navigate to your project and run git remote to get a list of your remote repositories. If that list is empty, you can use git remote add &lt;remote-name&gt; &lt;your-remote-repo-url&gt; to add a remote repository. So, e.g. git remote add origin https://github.com/yourUsername/yourRepo Then you should be able to pull from your remote as usual. Alternatively, you could follow this guide to import the remote repository as a new project. This will bring back the source code in its current state in the remote repository. But you mentioned that the remote repo does not contain the whole project. So you would probably have to add all files manually from your restored project that were not tracked by the git repository.
has comment: http://stackoverflow.com/comment/35175012
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23023751
upvote count: 1
has comment: http://stackoverflow.com/comment/35174686
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23023751
type: Answer

http://stackoverflow.com/q/23022383
favorite count: 0
has answer: http://stackoverflow.com/a/23022487
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23022475
score: 0
tagged with: java
has body: The assignment is to read the maximum value of the ArrayList and return it, and if it's 0 or empty return and print null. But when I run it, the output is null for negative numbers when it should only return null for 0. public static void main(String[] args) { Scanner input = new Scanner(System.in); ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); int addNum = -1; //User inputs numbers for the list until they input 0 while (addNum != 0) { addNum = input.nextInt(); list.add(addNum); } //Sends it to the method to check for the biggest number Integer i = max(list); //It returns null if it's negative for some reason if (i == null) { System.out.println((String) null); } else { System.out.println("The greatest number is " + i); } } public static Integer max(ArrayList&lt;Integer&gt; list) { Integer i = Collections.max(list); //Even though the if statement says only if it is equal to 0 if (i == 0) { return (null); } else { return i; } } Sample Run -12 -151 -1221 -2121 -61 -42 0 null
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35169789
type: UnansweredQuestion
has title: Why is this returning null?

http://stackoverflow.com/a/43351511
score: 1
has body: Answer taken from Book "Java: A Beginner's Guide" The answers mentioned above are right as well. Just for more clarification, I will post this. do { System.out.print("Pres a key followed by Enter: "); //get a char ch = (char) System.in.read(); //REFERRING TO THIS PART do{ ignoreNewLineENTER = (char) System.in.read(); } while (ignoreNewLineENTER != '\n'); } while (ch != 'q'); console input is line buffered—you have to press ENTER before characters are sent. Pressing ENTER causes a carriage return and a line feed (newline) sequence to be generated. These characters are left pending in the input buffer. Also, if you typed more than one key before pressing ENTER, they too would still be in the input buffer. This loop discards those characters by continuing to read input until the end of the line is reached. If they were not discarded, then those characters would also be sent to the program as guesses, which is not what is wanted. (To see the effect of this, you might try removing the inner do-while loop.) In Chapter 10, after you have learned more about Java, some other, higher-level ways of handling console input are described. However, the use of read( ) here gives you insight into how the foundation of Java's I/O system operates. It also shows another example of Java's loops in action.
answers question: http://stackoverflow.com/q/22979452
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/35182587
score: 2
comment on: http://stackoverflow.com/q/23029833
has text: Because all you print is the name. Did you even look at the Javadocs?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35271363
type: QuestionComment
has text: And the answer is: it depends on the locale.
comment on: http://stackoverflow.com/q/23078603
type: Comment
score: 1

http://stackoverflow.com/q/22975171
tagged with: unit-testing
tagged with: java
has title: Unit Test for get getResourceAsStream
has answer: http://stackoverflow.com/a/22975288
has answer: http://stackoverflow.com/a/22975428
has body: I have a controller with InputStream inStream = ControllerClass.getClass().getResourceAsStream(doc); doc is a stream that I send in via httpservletrequest (it will be /doc/xxx.json). If I want to unit test this controller, I have to create a mock resource first for the code above to fetch my mock resource. As I know, the above code will fetch the file from the path project/target/classes/doc/xxx.json. How can you create a mock file at the path in order to unit test the controller?
type: UnansweredQuestion
type: Question
score: 0
answer count: 2

http://stackoverflow.com/comment/35225042
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23053385
has text: I have tried URL configURL = new URL("" + Transcriber.class.getResourceAsStream("config.xml")); as well and config.xml is in the same package as the Transcriber class.
type: AnswerComment

http://stackoverflow.com/a/22981777
has comment: http://stackoverflow.com/comment/35099773
has comment: http://stackoverflow.com/comment/35099305
has comment: http://stackoverflow.com/comment/35135680
has comment: http://stackoverflow.com/comment/35099907
upvote count: 1
has comment: http://stackoverflow.com/comment/35099791
has comment: http://stackoverflow.com/comment/35099219
has comment: http://stackoverflow.com/comment/35102180
has comment: http://stackoverflow.com/comment/35099445
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35177227
has comment: http://stackoverflow.com/comment/35177481
has body: SwingWorker has... Progress change functionality built in, via the PropertyChange support Has helper methods that allow you to synchronise updates to the UI via the publish and process methods, making the process significantly easier... A self contained workflow concept which makes it (generally) easier to use than rolling your own. There are exceptions to the rule, but your outline doesn't fit those exceptions (IMHO) - this is both and advantage and disadvantage... For example... java swingworker thread to update main Gui JProgressBar won&#39;t update Populating jTable using database data (relates to updating a JTable from a SQL source, but shows how a SwingWorker might be used to update a JTable) One of the (possible) drawbacks to SwingWorker is it will only allow (I believe) 10 workers to be executed simultanously
has comment: http://stackoverflow.com/comment/35135746
type: Answer
has comment: http://stackoverflow.com/comment/35100871
answers question: http://stackoverflow.com/q/22981569
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35101300
has comment: http://stackoverflow.com/comment/35099587
accepted answer of: http://stackoverflow.com/q/22981569
has comment: http://stackoverflow.com/comment/35099468
has comment: http://stackoverflow.com/comment/35097840
has comment: http://stackoverflow.com/comment/35106993

http://stackoverflow.com/a/22982674
has body: I am not sure if the above code will work in case you have odd number of entries May be you can use something like below : public static ArrayList&lt;Integer&gt; returnList(ArrayList&lt;Integer&gt; tList,boolean flag){ int size=tList.size(); int t; //print odd positions - flag is true if(flag){ if(size&gt;0 &amp;&amp; size%2==0){ t = tList.remove(size-1); tList=returnList(tList,flag); tList.add(t); } else if(size%2 == 1){ t = tList.remove(size-1); tList=returnList(tList,flag); } else{ } System.out.println("Printing.."+tList); } else{ } return tList; }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22978193

http://stackoverflow.com/comment/35187501
type: QuestionComment
has text: Ok Thanks, and i want to store int values in the backing bean for example, it is necessary too to set the JSF specific converter component directly in my xhtml page?
comment on: http://stackoverflow.com/q/23031746
score: 0
type: Comment

http://stackoverflow.com/comment/35190939
comment on: http://stackoverflow.com/q/23034375
score: 0
type: Comment
type: QuestionComment
has text: Good practice is not to write apps such that.

http://stackoverflow.com/comment/60672306
comment on: http://stackoverflow.com/q/23018553
has text: Today I ran into this problem myself. It appears it happens only on the first time that I open this dialog box after initializing the application, but it returns to normal every time after that. Perhaps maybe it's some sort of instantiation issue where the FileChooser class takes longer to properly load before the actual box opens.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22977536
tagged with: timer
type: UnansweredQuestion
has title: Can I use the Java timer class for timed data collection?
score: 0
tagged with: java
has body: I am writing a program that collects a series of angle inputs during a trial and saves these to a file with their corresponding timestamps. For example: 1 sec 260 degrees 2 sec 45 degrees 3 sec 60 degrees etc. When running a trial, the user should be able to pause and restart or fully abort the trial if need be. I am running into trouble with the pause functionality. I have been using the Java Timer and TimerTask classes to time the input, as it provides much of the functionality I am looking for (start a task after a delay, only record data at certain intervals, etc.). Within my timerTask, I have been storing the collected angles and times in parallel arrays, and then at the end of the trial, writing these arrays to a file. However, when I "pause" my timerTask via the timer.cancel() function and restart it, the old data arrays are thrown away. I have tried to sidestep this issue by saving the "paused" array and then merging it with the "restarted" array at the end of the restarted trial, but this doesn't account for the fact that a trial could be paused numerous times. Are the timer/timerTask classes the wrong classes to be using for this job? Is there a better way to collect time-based data in Java? Or am I just overlooking a solution?
type: Question
has answer: http://stackoverflow.com/a/22977605
answer count: 1

http://stackoverflow.com/a/23033459
downvote count: 0
has body: An ActionListener listens for ActionEvents. An ActionEvent is something that happens; an ActionListener is something that responds to it.
answers question: http://stackoverflow.com/q/23033439
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/22997527
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22997381
has body: When you use a parameterized type like List, the compiler does some type binding and type checking at compilation time. So with a variable declared as List&lt;A&gt; listA; any use of listA will be with the type argument A. With a variable declared as List&lt;?&gt; data; any use of data will be with the type argument ? which is the wildcard, but the actual type is unknown. Given that it doesn't know the actual type, the compiler can't let you make use of it. The add(E) method of List depends on the type variable. So List&lt;A&gt; listA = ...; listA.add(someA); would be fine since someA is of type A. Now you may think List&lt;?&gt; data = listA; data.add(someA); // theoretically fine should word, but like this List&lt;?&gt; data = someMethod(); data.add(someA); it doesn't. What if the referenced List isn't meant to hold A objects? The compiler simply can't allow this. That is what type-checking all about with generics.
type: Answer
score: 3

http://stackoverflow.com/comment/35238474
type: Comment
has text: Ok, I am using Eclipse, so I do not know, how to make Netbeans see this file when running there. In Eclipse, the four directories main/java, main/resources, test/java, and test/resources are on the build path and thus on the class path when running a main class. For such properties files, we put it into test/resources. So it is in the class path, as I told before. Regarding the packaging, I think, I have answered this.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23059688

http://stackoverflow.com/comment/71779438
comment on: http://stackoverflow.com/q/22975117
score: 0
type: QuestionComment
has text: Have you tried Intellij? It suggests such changes by default.
type: Comment

http://stackoverflow.com/comment/35271230
comment on: http://stackoverflow.com/q/23077008
has text: @AlexisPigeon, due to itext developers moved to AGPL license,sticking with itext2.1.7 itself.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23020090
downvote count: 1
has answer: http://stackoverflow.com/a/23020245
type: Question
has comment: http://stackoverflow.com/comment/35165226
has comment: http://stackoverflow.com/comment/35213707
upvote count: 0
score: -1
linked to: http://stackoverflow.com/q/161738
has comment: http://stackoverflow.com/comment/35165208
has answer: http://stackoverflow.com/a/23020199
answer count: 3
has comment: http://stackoverflow.com/comment/35165443
possible better answer: http://stackoverflow.com/a/23020295
has answer: http://stackoverflow.com/a/23020295
favorite count: 0
has title: Replacing occurrences of generic string
has body: I never was good enough with regex, and I assume this is the job for it. I have a link like www.somelink/phoyto.jpg/?sz=50 I need to replace 50 with my value, let's say 100. Trouble is, that I cannot be sure, that this will be always sz=50 and not sz=150 or sz=10 or any other value. What I need is to find an occurence of string contains of 'sz' + number and replace it with 'sz=100'. Sure, I can do that 'manually" in some for loop, but that wouldn't be nor smar nor efiicient.
linked to: http://stackoverflow.com/q/22937618
tagged with: regex
accepted answer: http://stackoverflow.com/a/23020199
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22983584
has body: Here an improved version of given answer by @drkunibar: SimpleDateFormat inFormat = new SimpleDateFormat("yyyy-MM-dd-'T'HH:mm:ss'Z'"); inFormat.setTimeZone(TimeZone.getTimeZone("GMT")); // Z denotes UTC in ISO-8601 Date inDate = inFormat.parse("2014-01-11-T00:00:00Z"); SimpleDateFormat outFormat = new SimpleDateFormat("yyyyMMdd"); outFormat.setTimeZone(TimeZone.getTimeZone("...")); // set your timezone explicitly! String output = outFormat.format(inDate); System.out.println("Date: " + output); Note that the format YYYYMMDD is also ISO-8601-compliant (a so-called basic calendar date). The question you have to ask yourself is in which timezone you want to get your output. If in UTC you have to set "GMT", too. Without setting timezone it can happen that your output date differs from input UTC date by one day dependent where your default system timezone is (for example US is several hours behind UTC, in this case one calendar day before UTC midnight).
has comment: http://stackoverflow.com/comment/119035921
has comment: http://stackoverflow.com/comment/119079629
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22982688

http://stackoverflow.com/comment/36054057
has text: Nosid's answer is right, except I'd correct one point, the bullet about what streams are and are not designed for. There's nothing wrong with using streams to express heavy computations on small data sets.
comment on: http://stackoverflow.com/a/23055675
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/35341849
type: Comment
has text: As an aside, 3 replicas on a 7 node cluster is probably overkill and will require a relatively high amount of resource to handle that particular workload. Under 10 nodes a single replica is generally sufficient.
score: 1
comment on: http://stackoverflow.com/q/23106200
type: QuestionComment

http://stackoverflow.com/comment/35270618
has text: It worked with returning `String` with path and annotated by ` @ResponseStatus(value=HttpStatus.NOT_FOUND)` but formaly, this is not quite a response to my question - no re-throw occured but simple duplicated, decentralized code. I will wait more and If no one respond I will accept and update notice.
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/23077603

http://stackoverflow.com/q/23096533
favorite count: 0
accepted answer: http://stackoverflow.com/a/23096844
tagged with: sampling
tagged with: audio
type: AnsweredQuestion
tagged with: java
has title: How to play a sound with a given sample rate in Java?
type: Question
score: 5
has body: I was wondering if there is a library or something to play a sound on a given sample rate (20–20,000 Hz). Actually, I found something but I'm not understanding how I can make it work!
has answer: http://stackoverflow.com/a/23096844
upvote count: 5
answer count: 1
downvote count: 0

http://stackoverflow.com/a/23121509
score: 0
has comment: http://stackoverflow.com/comment/35347694
has body: You can use: list[k-1].printComputer().split("\\s+")[0]
has comment: http://stackoverflow.com/comment/35347660
type: Answer
answers question: http://stackoverflow.com/q/23121321
has comment: http://stackoverflow.com/comment/35347639

http://stackoverflow.com/comment/35159906
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23017348
type: AnswerComment
has text: +1, this last bit is probably the most useful advice.

http://stackoverflow.com/a/23028023
score: 2
has comment: http://stackoverflow.com/comment/35202978
downvote count: 0
upvote count: 2
has body: I'm sure someone might make some suggestions, but this probably isn't the best venue to get help with library selection. If, on the other hand, you ask concrete questions about certain libraries/implementations you might get intelligent answers. A common problem with that approch is that the asker doesn't know what questions to ask! (And that leads to re-inventions of wheels and commonly, poor decisions around security). The JSON-RPC (1.0/1.1/2.0) group of protocols are extremely simple. There are hundreds of PHP implementations. I don't know much about evaluating Android libraries but this prior SO question gives a suggested client-side implementation for Android. I'll primarily deal with the server-side part of your question by giving you concrete answers you can ask about a particular implementation you might be evaluating. Considerations for the server-side PHP JSON-RPC implementation: How will you handle transport authentication? How will you handle RPC-method authorization? How will you handle transport security? Will you need to handle positional/named/both style method arguments Will you need to handle/send notification messages? Will you need to handle batch requests? Will you need to send batch responses? How does the PHP implementation behave under a variety of exception/warning conditions? How does the PHP implementation advise against or mitigate the PHP array set/list duality? Will you need to implement SMD? Will your web-service also need to perform other HTTP-level routing? (e.g: to static resources) How will you handle transport authentication? Assuming you use HTTP as the transport-layer protocol, how will you authenticate HTTP requests? Will you use password/HTTP-auth/certificate/SRP/other authentication? Will you continue to trust an open socket? Will you use cookies to extend trust after authentication? These aren't really JSON-RPC related questions, but many server-side implementations make all sorts of assumptions about how you'll do authentic…
accepted answer of: http://stackoverflow.com/q/22992702
answers question: http://stackoverflow.com/q/22992702
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/22985543
tagged with: split
has comment: http://stackoverflow.com/comment/35101954
tagged with: java
has comment: http://stackoverflow.com/comment/35105909
has comment: http://stackoverflow.com/comment/35101773
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35101528
tagged with: string
has answer: http://stackoverflow.com/a/22985829
favorite count: 0
type: UnansweredQuestion
tagged with: text
has body: I'm having a text file with the texts like this 67 #SUPPORT: 5 67 76 #SUPPORT: 10 76 #SUPPORT: 10 here the item 67 and 76 occurs two times, i need to take these two values to my mysql database for further processing. I tried with HashMap and other things but it is not working for me. Need some help here!!
has title: how to read text from notepad and store it without any duplicates?
type: Question

http://stackoverflow.com/comment/35435035
type: Comment
score: 0
has text: I do not know if this is that what I need. I have JavaFx app with e.q. 1000 buttons and I have to repaint all content of this window in loop (100x) and count how much microseconds it was for one loop.
type: AnswerComment
comment on: http://stackoverflow.com/a/23035353

http://stackoverflow.com/comment/135677431
score: 5
has text: What was wrong with all the other answers saying the same?
type: AnswerComment
comment on: http://stackoverflow.com/a/76964288
type: Comment

http://stackoverflow.com/q/23122668
tagged with: dalvik
type: UnansweredQuestion
tagged with: android
tagged with: java
tagged with: dexopt
type: Question
has comment: http://stackoverflow.com/comment/35350973
has answer: http://stackoverflow.com/a/23131351
has title: Invalid name: 'enum constant initialization$2' while installing app
score: 0
tagged with: dex
answer count: 1
has comment: http://stackoverflow.com/comment/35363112
has body: While installing android app from eclipse to any emulator I start getting error: 04-17 00:36:53.043: E/dalvikvm(20216): Invalid name: ' enum constant initialization$2' 04-17 00:36:53.043: E/dalvikvm(20216): Trouble with item 10075 @ offset 0x611ec 04-17 00:36:53.043: E/dalvikvm(20216): Cross-item verify of section type 0005 failed 04-17 00:36:53.043: E/dalvikvm(20216): ERROR: Byte swap + verify failed 04-17 00:36:53.043: E/dalvikvm(20216): Optimization failed I have checked my enums but not sure what can be the problem. Don't find anything similar enough on net so need a bit of help here :)
linked to: http://stackoverflow.com/q/4468388

http://stackoverflow.com/comment/35141490
comment on: http://stackoverflow.com/a/23007330
score: 0
type: AnswerComment
has text: @Duncan - the problem is most likely that the OP has not *formed* an intention. What I'm saying is that he needs to do that; i.e. he needs to understand what he is trying to get his program to do ... *before* he he can write his code.
type: Comment

http://stackoverflow.com/a/23060934
answers question: http://stackoverflow.com/q/23060863
score: 3
has body: Look for finalName tag under the plugin maven-ear-plugin <build> YourCool-Name <build>
has comment: http://stackoverflow.com/comment/35239409
upvote count: 3
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35239311

http://stackoverflow.com/q/22970634
has answer: http://stackoverflow.com/a/27611531
answer count: 1
tagged with: tomcat
score: 0
has title: Maven profile filter works when building WAR but not in Tomcat7 run
type: UnansweredQuestion
tagged with: maven
tagged with: java
has body: I'm trying to use Maven to pull in a different config point within my web.xml file in dev and production. It looks like using profiles and filters is the way to go, and this does in fact work when I build the WAR file with "mvn install" or "mvn package." However, running it via the Tomcat 7 plugin, always results in a "cannot resolve placeholder" error. Here are the relevant lines: in web.xml - this is the placeholder I'm trying to set /WEB-INF/${sec-file-path} in pom.xml development one-thing-for-dev.xml production one-thing-for-prod.xml .... org.apache.tomcat.maven tomcat7-maven-plugin 2.0 maven-war-plugin 2.4 true src/main/webapp **/web.xml src/main/webapp src/main/webapp/WEB-INF/web.xml Running the command "mvn package -P development" works as expected and fills in the placeholder appropriately. However, running "mvn tomcat7:run -P development" results results in a "cannot resolve placeholder" error. Any suggestions would be welcome.
type: Question

http://stackoverflow.com/comment/35212342
comment on: http://stackoverflow.com/q/23046292
score: 0
type: Comment
type: QuestionComment
has text: You should read about variable shadowing and scope.

http://stackoverflow.com/a/23135181
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/36387974
accepted answer of: http://stackoverflow.com/q/23128335
has comment: http://stackoverflow.com/comment/36379616
answers question: http://stackoverflow.com/q/23128335
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36358050
has comment: http://stackoverflow.com/comment/36389154
upvote count: 8
has body: This change is described in the issue JDK-6695379 - Copy method annotations and parameter annotations to synthetic bridge methods. There doesn't seem to be much discussion about this feature but the request and justification do make sense to me. A DESCRIPTION OF THE REQUEST : When a class extends a generic classes or implements a generic interface, synthetic method may be generated to bridge between the method taking specific parameters/return and the one of the super-class/interface which is defined with Objects, because of erasure. A bridge method redirects the call to the actual method, according to Java Language Specification. However the bridge method lacks the annotations defined for the original method and its parameters. JUSTIFICATION : The problem arises when trying to retrieve annotations of such a method at run-time. Since it's impossible to find out reliably what classes substitute the generic parameters, we don't know what parameter to send to getMethod(...) in order to receive the correct method back. When sending Object.class (while generic parameter is a different class) getMethod will return the bridge method, which won't have the information about the original method annotations. It is also documented in the JDK 8 compatibility guide: Area: Tools / javac Synopsis As of this release, parameter and method annotations are copied to synthetic bridge methods.This fix implies that now for programs like: @Target(value = {ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @interface ParamAnnotation {} @Target(value = {ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @interface MethodAnnotation {} abstract class T&lt;A,B&gt; { B m(A a){return null;} } class CovariantReturnType extends T&lt;Integer, Integer&gt; { @MethodAnnotation Integer m(@ParamAnnotation Integer i) { return i; } public class VisibilityChange extends CovariantReturnType {} } Each generated bridge method will have all the annotations of the method it redirects to. Parameter…

http://stackoverflow.com/comment/35230379
has text: Please try to understand my question. I understand the default partitioning case. I want to know what will happen when we write custom partition class and we mention 12 keys in it and we set job.setNumReduceTsk to 8. In this case what will happen?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23010773
type: Comment

jeditorpane
tags question: http://stackoverflow.com/q/23061785
tags question: http://stackoverflow.com/q/22992602
tag name: jeditorpane
type: Tag
tags question: http://stackoverflow.com/q/22994647

http://stackoverflow.com/comment/35255153
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23068983
has text: Sorry I didn't get it. Please explain a bit more.
type: AnswerComment

http://stackoverflow.com/q/23046897
has comment: http://stackoverflow.com/comment/35213431
has comment: http://stackoverflow.com/comment/35213427
tagged with: regex
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/23046924
tagged with: java
linked to: http://stackoverflow.com/q/22937618
has body: I understand that ? can be used to make modifiers only match the first occurence and prevent the greediness, but maybe I've misunderstood how it's supposed to work. If the string is: one two three four four four five six ...and I want to capture three. I've been trying: ^one two (.*)(four)+?.*$ ...but this gives me three four four. What am I doing wrong? I've tried ?? and .? and just (four)?, but it's not working.
has answer: http://stackoverflow.com/a/23047029
type: Question
has answer: http://stackoverflow.com/a/23046935
score: 3
accepted answer: http://stackoverflow.com/a/23046935
has comment: http://stackoverflow.com/comment/35213485
has title: Greedy Java regex
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/23046924
favorite count: 0

http://stackoverflow.com/a/23121162
has comment: http://stackoverflow.com/comment/35348627
type: Answer
has body: You've created your buttons at xml but haven't added the reference, this should help you. Add it before you start using it. add = (Button) findViewById(R.id.bAdd); sub = (Button) findViewById(R.id.bSub); You could also instead add the reference from your listeners at your xml as you have done android:onClick="xxx" android:onClick="yyy" You can add it programmatically, like this. add.setOnClickListener(xxx); View.OnClickListener xxx = new View.OnClickListener() { public void onClick(View v) { // Do something in response to button counter--; display.setText(""+ counter); } }; I believe that this depends entirely on you. Also, check your log, it says your button is null; it pretty much says what's going wrong. 04-16 23:07:04.414: E/AndroidRuntime(22562): Caused by: java.lang.NullPointerException 04-16 23:07:04.414: E/AndroidRuntime(22562): at com.example.myapp1.CalculateActivity.yyy(CalculateActivity.java:83) 04-16 23:07:04.414: E/AndroidRuntime(22562): ... 14 more Anyhow, just remember to add the reference to your views before doing anything with then.. That should avoid future null pointers exceptions.
upvote count: 0
has comment: http://stackoverflow.com/comment/35349299
has comment: http://stackoverflow.com/comment/35374042
score: -2
answers question: http://stackoverflow.com/q/23120454
downvote count: 2

http://stackoverflow.com/a/22978076
has body: While I'm not familiar with cacls, and what exactly it does, a brief look at the documentation says that your denying access to the file for the user executing the command, then you want that same user to access the file. I would recommend using the /p switch to give the current user the rights they need to read and write to the file, then do what you need to do to the file in code, then use cacls /d to revoke the rights for the current user again. Try doing something like this: Process pcs = Runtime.getRuntime().exec( "cmd /c start cacls E:\\PJ\\testing2.txt /e /p %username% : f"); //Logic that manipulates the file here Process pcs = Runtime.getRuntime().exec( "cmd /c start cacls E:\\PJ\\testing2.txt /e /d %username%"); Just as a note, be especially suspect of that " : f " part, I'll say it again, I am not familiar with cacls, but I did read the documentation Edit - It also occurs to me that this logic will only revoke rights for the current user, and thus the file is NOT 'undeleteable'. One could delete this file by using a different user account to delete the file (eg Administrator).
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22977978
answers question: http://stackoverflow.com/q/22977978
type: Answer
upvote count: 1

http://stackoverflow.com/q/23032375
has comment: http://stackoverflow.com/comment/35187477
type: Question
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23032613
has body: i am currently working on a text based game for class and cannot figure out how to add items to the game class. the game and moving between rooms has worked fine but this one part is confusing the hell out of me. here are the three classes that pertain to this sitch. public class Item{ private String itemName; public Item(String itemName){ this.itemName = itemName; } public String getItemName(){ return itemName; } } import java.util.Set; import java.util.HashMap; import java.util.Iterator; import java.util.ArrayList; /** * Class Room - a room in an adventure game. * * This class is part of the "World of Zuul" application. * "World of Zuul" is a very simple, text based adventure game. * * A "Room" represents one location in the scenery of the game. It is * connected to other rooms via exits. For each existing exit, the room * stores a reference to the neighboring room. * * @author Michael Kölling and David J. Barnes * @version 2011.08.09 */ public class Room { private String description; private HashMap&lt;String, Room&gt; exits; // stores exits of this room. private HashMap&lt;String, Item&gt; itemList; private String name; private ArrayList&lt;Item&gt; items; /** * Create a room described "description". Initially, it has * no exits. "description" is something like "a kitchen" or * "an open court yard". * @param description The room's description. */ public Room(String description) { this.description = description; exits = new HashMap&lt;String, Room&gt;(); items = new ArrayList&lt;Item&gt;(); } /** * Define an exit from this room. * @param direction The direction of the exit. * @param neighbor The room to which the exit leads. */ public void setExit(String direction, Room neighbor) { exits.put(direction, neighbor); } /** * @return The short description of the room * (the one that was defined in the constructor). */ public String getShortDescription() { return description; } /** * Return a description of the room in the form: * You are in the kitchen. * Exits: north…
tagged with: items
type: UnansweredQuestion
has title: Adding Items to text based java game
has comment: http://stackoverflow.com/comment/35187523
downvote count: 1
tagged with: text
tagged with: java
score: -1

http://stackoverflow.com/comment/35210707
comment on: http://stackoverflow.com/a/23045493
score: 0
type: AnswerComment
has text: Oh yeah I realized this too. Changed it and removed the semi colon from the if statement
type: Comment

http://stackoverflow.com/a/23072019
score: 6
type: Answer
has body: The molecule sample application from Oracle does much of what you are asking. Read the linked tutorial and study the source code provided for the sample application. Regarding a couple of your questions. if there is for example 2 cylinder between two sphere it must an arc or curved cylinder This is possible. You would have to generate a custom TriangleMesh rather than using the pre-built Cylinder class. Essentially, you need to create an elliptical Torus and only display an arc portion of the Torus between your two nodes. I will not provide detailed instructions on how to do this in the context of a StackOverflow answer. I want to know how the rotation can help in such situation and last question is it possible to make a scrollbar or just using event of Zoom ? Study the Molecule sample code linked earlier as that has rotation and zoom capability.
upvote count: 6
accepted answer of: http://stackoverflow.com/q/23071593
answers question: http://stackoverflow.com/q/23071593
has comment: http://stackoverflow.com/comment/35259710
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35178558
has text: What is a locking transaction?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23015279

http://stackoverflow.com/a/22991711
type: Answer
has comment: http://stackoverflow.com/comment/35114814
downvote count: 0
has comment: http://stackoverflow.com/comment/35114024
accepted answer of: http://stackoverflow.com/q/22986474
has body: This isn't so much about the openssl command (which might not be on your path anyway) than about the OpenSSL library. If you're using Tomcat, you would be relying on the OpenSSL library if you've set up the APR connector. Otherwise, you'll be using the JSSE (unless you've providing your own SSLImplementation classes, which is very unlikely).
score: 1
answers question: http://stackoverflow.com/q/22986474
has comment: http://stackoverflow.com/comment/35114948
has comment: http://stackoverflow.com/comment/35143464
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35113794

http://stackoverflow.com/comment/35344430
type: Comment
has text: +1 This works too, it really depends on how fine of a grain of control you want; for example, you may not want to print the division result line if `operand2` is 0. You probably want to use whatever line separator the current platform uses, by the way; not sure if `MessageFormat` supports that automatically (maybe it does?). Consider using `print` as well (conceptually, it's a bit odd to mix `println` with a string containing line breaks) -- `println` conveys the intention that you mean to print a single line.
type: AnswerComment
comment on: http://stackoverflow.com/a/23119567
score: 0

http://stackoverflow.com/comment/35141615
score: 0
type: AnswerComment
type: Comment
has text: @Octopus Now it's ok. But output keep throwing `Exception in thread "pool-1-thread-7" java.lang.ArrayIndexOutOfBoundsException: 100000 at concurrency.BaseLine.accumulate(SynchronizationComparisons.java:94)` here is 94 line - `value += preLoaded[index++]; // index validity is done and controlled` from BaseLine.
comment on: http://stackoverflow.com/a/22990961

http://stackoverflow.com/q/23063585
type: Question
has answer: http://stackoverflow.com/a/70799584
tagged with: java
has comment: http://stackoverflow.com/comment/35252931
downvote count: 0
answer count: 1
has body: I have a set of services written in Java using spring framework. Some of the services have scheduled tasks(using spring's @Scheduled annotation) to do some house keeping stuff (generating processed data, data cleanup etc.). Because of these schedule tasks, I cannot run multiple instances of the services since all instances are picking up the same task and it is executed multiple times, resulting in repeated/corrupted data. To resolve this, I want to check at time of execution of the task and allow the execution only on one instance. How can I do it? Is there a better approach to the problem?
tagged with: scheduled-tasks
favorite count: 0
has comment: http://stackoverflow.com/comment/35246514
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/35252729
has title: Controlling spring scheduled tasks at run time
score: 2
upvote count: 2

http://stackoverflow.com/comment/35202089
has text: Create static object and use it throughout the app..
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23040583

http://stackoverflow.com/comment/35294635
comment on: http://stackoverflow.com/q/23087724
has text: I didn't say that - I asked are you opening the developer tools within Chrome?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35354419
type: Comment
comment on: http://stackoverflow.com/a/23067677
score: 0
type: AnswerComment
has text: In this way, my aplication just exits after printing stacktrace for one time which I don't want. I want to print the stack trace once and then move onto other connections. @Sireesh

http://stackoverflow.com/comment/94712123
type: Comment
has text: Welcome, please try to use capital letters at the start of each sentence.
comment on: http://stackoverflow.com/a/52725012
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35171100
score: 0
comment on: http://stackoverflow.com/q/23023079
type: Comment
has text: Can you give us some example input/output? If you put "sally" and "jim" into the array of size 2 and try to add "john", what is in the array after your add operation?
type: QuestionComment

http://stackoverflow.com/a/23114395
downvote count: 0
has comment: http://stackoverflow.com/comment/35335476
type: Answer
score: 2
has body: Generate and return array of duplicated values. If it has zero size, then no duplicates were found.
upvote count: 2
answers question: http://stackoverflow.com/q/23112830
has comment: http://stackoverflow.com/comment/35335532

http://stackoverflow.com/comment/64876918
score: 0
type: Comment
comment on: http://stackoverflow.com/a/30482241
has text: Fantastic answer indeed. +1 for the source code snippet.
type: AnswerComment

http://stackoverflow.com/a/22976104
answers question: http://stackoverflow.com/q/22975965
type: Answer
has body: Because a jar file only has Java code in it. OpenCV has more than just Java code, it also has some C/C++ code that is in the native library. That code can't be put in the jar, so it has to be put somewhere else, and you have to say where it is.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35086443
has comment: http://stackoverflow.com/comment/35086397
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22975965

http://stackoverflow.com/comment/35324100
type: Comment
type: QuestionComment
has text: but it can change during execution
comment on: http://stackoverflow.com/q/23055745
score: 0

http://stackoverflow.com/q/23043692
has title: viewscope bean gets instantiated on every request
score: 0
has comment: http://stackoverflow.com/comment/35211050
type: UnansweredQuestion
has body: There are other questions about this but none of them solved my problem. viewscope bean is instantiated(its constructor is called) whenever I refresh same page in browser. here is xhtml: <f:view contentType="text/html"> <h:head> </h:head> <h:body> <h:form> <h:dataTable value="#{products.list}" var="p" id="betDt1" styleClass="tableSorter"> <h:column> <f:facet name="header">name </f:facet> #{p.pname} </h:column> </h:dataTable> </h:form> </h:body> </f:view> viewscoped bean: import java.io.Serializable; import java.util.List; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import org.hibernate.Session; import model.Product; @ViewScoped @ManagedBean public class Products implements Serializable { private List<Product> list; private Session ss; @SuppressWarnings("unchecked") public Products() { this.ss = FaceUtils.openHibernateSession(); System.out.println("products constructor called"); ss.getTransaction().begin(); list = ss.createCriteria(Product.class).list(); this.ss.getTransaction().commit(); } public List<Product> getList() { return list; } public void setList(List<Product> list) { this.list = list; } public String delete(Product pro) { FaceUtils.log.finest("delete pro.id" + pro.getId()); FaceUtils.hibernateDelete(this.ss, pro); list.remove(pro); return null; } /** * */ private static final long serialVersionUID = -2018425860394584424L; } And web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> fazlastoks Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet *.xhtml index.xhtml javax.faces.PROJECT_STAGE Development org.omnifaces.FACES_VIEWS_SCAN_PATHS /*.xhtml Any idea what may cause the problem?
tagged with: jsf
answer count: 0
has comment: http://stackoverflow.com/comment/35209249
tagged with: java
has comment: http://stackoverflow.com/comment/35209022
type: Question
tagged with: view-scope

http://stackoverflow.com/q/23126951
upvote count: 1
has answer: http://stackoverflow.com/a/23127006
tagged with: object
has comment: http://stackoverflow.com/comment/35357255
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35357390
type: Question
has title: Java: How are classes like the "System" class are implemented so that they are readily available and accessible everywhere?
has body: I come from a C background, so not so familiar with the Java naming conventions, and still new to Java, so I am sorry if this question is overly simple. I would like to implement a class/object that is readily available by simply importing its header? Thanx!
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35361465
has text: Nothing will change your you, just the speed of get method. ArrayList source: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/ArrayList.java (p.s your elements will be limited by Integer.MAX_INT size, but i don't think it could be a problem)
score: 0
comment on: http://stackoverflow.com/q/23128751
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23073581
has body: p1 and p2 are two different objects and hence when you compare them with ==, the result is false. But a and b are primitives and get the values through auto-unboxing. As they are getting the same integer value, therefore a &amp; b comparison using == results in true
has comment: http://stackoverflow.com/comment/35264918
has comment: http://stackoverflow.com/comment/35264106
downvote count: 0
has comment: http://stackoverflow.com/comment/35263572
type: Answer
score: 4
answers question: http://stackoverflow.com/q/23073562
upvote count: 4

http://stackoverflow.com/q/23015083
has comment: http://stackoverflow.com/comment/35155421
answer count: 0
type: UnansweredQuestion
has title: How to validate whether an ip in the white list
tagged with: java
has comment: http://stackoverflow.com/comment/35155430
type: Question
tagged with: ip
has comment: http://stackoverflow.com/comment/35155748
tagged with: wildcard
has comment: http://stackoverflow.com/comment/35155548
score: 0
has body: I have a IP white list , it's a string array like {"192.168.1.1" ,"172.8.9.9", "198.2.3.", "89.90.9.9-78"}, seen from this array we know that it contains ip with wildcard "", and ip between 89.90.9.9 to 89.90.9.78 that expressed by "89.90.9.9-78". The question is how can I judge an ip is in this array, can i use the regular expression? I'm using java. code snippet I write code like this ` String[] ipWhiteList = {"192.168.1.1" ,"172.8.9.9", "198.2.3.", "89.90.9.9-78"}; List&lt;String&gt; ipWithoutWildcard = new ArrayList&lt;String&gt;(); List&lt;String&gt; ipWithWildcard = new ArrayList&lt;String&gt;(); private void analyzeIPWhiteList(String[] ipWhiteList){ for (String ip : ipWhiteList) {if(ip.endsWith("*")){ ipWithWildcard.add(ip.substring(0,ip.lastIndexOf("."))); break; } if(ip.contains("-")){ String partionOfIP = ip.substring(0,ip.lastIndexOf("-")); int ipBegin = Integer.parseInt(ip.substring(ip.lastIndexOf(".")+1,ip.lastIndexOf("-"))); int ipEnd = Integer.parseInt(ip.substring(ip.lastIndexOf("-")+1)); for (int index=ipBegin; index&lt;=ipEnd; index++) { ipWithoutWildcard.add(partionOfIP+"."+ index); } break; } ipWithoutWildcard.add(ip); } } private boolean isExist(String ip,List&lt;String&gt; ipWithoutWildcard,List&lt;String&gt; ipWithWildcard){ //compare the ip in ipWithoutWildcard and ipWithWildcard return false; } `
has comment: http://stackoverflow.com/comment/35155787

http://stackoverflow.com/comment/35169279
comment on: http://stackoverflow.com/q/23022146
has text: Can you specify what you don't understand from the documentation? Perhaps highlight what sentence(s) you're having trouble with?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23024603
type: Question
answer count: 1
has body: I created my Table like this: create table persona( id bigint (10) NOT NULL auto_increment, Nombre varchar(32) not null, appPaterno varchar (32) not null, appMaterno varchar (32), mail varchar (32) default '@hotmail.com', PRIMARY KEY (id) ) My question is: how from Java send data and add that default into the same column where the data will be stored? Can i do that?
has comment: http://stackoverflow.com/comment/35174176
has title: How to add a DEFAULT VALUE stored to one Column
score: 0
tagged with: sql
tagged with: netbeans
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23024740
tagged with: java
tagged with: mysql

http://stackoverflow.com/comment/35238855
comment on: http://stackoverflow.com/q/23060559
score: 0
has text: @JordanD sir its a valid json object. I checked already. Here also i checked http://jsonformatter.curiousconcept.com/
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23070529
linked to: http://stackoverflow.com/q/22968926
score: -3
possible better answer: http://stackoverflow.com/a/23070549
duplicate of: http://stackoverflow.com/q/22968926
has answer: http://stackoverflow.com/a/23070549
accepted answer: http://stackoverflow.com/a/23070553
type: AnsweredQuestion
tagged with: java
downvote count: 3
has body: This is an unusual problem I have: I've created a 2d int array with dimensions of 3X3, no parameters and when I try to print it out on the screen it displays something like this : [[I@49d67b41. Any suggestions? public static void main (String[] args) { System.out.println(test2()); } static int [][] test2 () { int [][] l = new int[3][3]; return l; }
type: Question
has comment: http://stackoverflow.com/comment/35256706
has title: I@49d67b41 prints when trying to print a 2d array
answer count: 2
upvote count: 0
linked to: http://stackoverflow.com/q/4479683
has answer: http://stackoverflow.com/a/23070553
duplicate of: http://stackoverflow.com/q/4479683
favorite count: 0

http://stackoverflow.com/q/22996820
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35123995
has comment: http://stackoverflow.com/comment/35176323
has comment: http://stackoverflow.com/comment/35125567
has comment: http://stackoverflow.com/comment/35177652
has comment: http://stackoverflow.com/comment/35124042
tagged with: stack-overflow
has comment: http://stackoverflow.com/comment/35125485
has comment: http://stackoverflow.com/comment/35124256
tagged with: windows
has title: Can't find the mistake (StackOverflowError)
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35179829
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35123868
tagged with: swing
tagged with: sudoku
score: 2
has answer: http://stackoverflow.com/a/22997884
upvote count: 3
tagged with: java
has body: I'm writing a Sudoku-solving program, but I'm encountering the following error: Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError at java.util.HashMap.hash(Unknown Source) at java.util.HashMap.getEntry(Unknown Source) at java.util.HashMap.get(Unknown Source) at sun.awt.AppContext.get(Unknown Source) at sun.awt.SunToolkit.flushPendingEvents(Unknown Source) at java.awt.EventQueue.postEvent(Unknown Source) at java.awt.EventQueue.invokeLater(Unknown Source) at javax.swing.SwingUtilities.invokeLater(Unknown Source) at javax.swing.text.DefaultCaret.changeCaretPosition(Unknown Source) at javax.swing.text.DefaultCaret.handleSetDot(Unknown Source) at javax.swing.text.DefaultCaret.setDot(Unknown Source) at javax.swing.text.DefaultCaret$Handler.insertUpdate(Unknown Source) at javax.swing.text.AbstractDocument.fireInsertUpdate(Unknown Source) at javax.swing.text.AbstractDocument.handleInsertString(Unknown Source) at javax.swing.text.AbstractDocument.insertString(Unknown Source) at javax.swing.text.PlainDocument.insertString(Unknown Source) at javax.swing.text.AbstractDocument.replace(Unknown Source) at javax.swing.text.JTextComponent.setText(Unknown Source) I can't find the reason for this error. The code of my programm is as follows: package code; import java.awt.Color; //Import nötiger Klassen import javax.swing.*; import javax.swing.border.Border; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class SOLVE implements ActionListener{ private int[][] matrix; //Eingelesenes Sudokufeld private boolean[][]input; //Überfrüfungsfeld zur bestimmung von eingegebenen Zahlen private JFrame fenster; //GUI Fenster private JTextArea field[][]; //GUI Text Sudoku Feld private JButton start; //Start Button private JButton reset; public void gui(){ //Erstellt die Grafische Oberfläche Border b1 = BorderFactory.createLineBorder( Color.black ); //Erstellt Fenster fenster = new JFrame(); fenster.setLocation(100, 100); fenster.setSize(500, 320); fe…

http://stackoverflow.com/a/23024565
type: Answer
answers question: http://stackoverflow.com/q/23024512
has body: Your answer looks correct, alternative way: Since they are not specifying if the very large number has a primitive type or not, you can assume that the number acts as int, double, long etc... String largeNumber = VERY_LARGE_NUMBER + ""; boolean isEven(String input){ return Integer.parseInt(input.charAt(input.length()-1)+"")%2 == 0; }
has comment: http://stackoverflow.com/comment/35178324
score: 0

http://stackoverflow.com/q/23000480
score: 0
tagged with: random
has answer: http://stackoverflow.com/a/23000529
has answer: http://stackoverflow.com/a/23000884
type: UnansweredQuestion
has title: Random variable generation in a Computation class
has body: I am trying to run a class that performs calculations from data obtained from a random variable generator class. What I want is that 3 random variables be generated at any given time, then all calculation in that class be performed without another set of random variables be generated. Once all calculations have been performed then a new set of random variables can be generated. The Computation class is as shown below : public class Computation { public int meltTemp; //public void mTemp; public int mouldTemp; public int setTemp; public int Q; public int volume; public double Cp; public int actualMouldTemp; public double dT; public int AMT ;//= Math.abs(dT); public double mTemp; public Hashtable catalogue1; protected void setup() { //create Hashtable catalogue1 = new Hashtable(); } public double getAnswer() { int rand1[] = new int[3]; int input [] = new int [2]; ControlGUI par = new ControlGUI (); //input = ControlGUI.getArray(); //catalogue am = new catalogue(); RandomVariableGenerator var = new RandomVariableGenerator(); rand1 = RandomVariableGenerator.getRand(); //int rand[] = Arrays.copyOf(rand1, rand1.length); meltTemp = 245; System.out.println("Melt Temp is : "+ meltTemp); actualMouldTemp = (int) ((0 - 51.4)+(0.302 * meltTemp) +(1.64 * rand1[0])+(0.201 * rand1[1])); System.out.println("The actual mould temperature is :" +actualMouldTemp + " Degrees celcius" ); return actualMouldTemp; } public int getDiff(){ Computation amg = new Computation(); double result[] = new double [4]; { setTemp = 55; dT = (actualMouldTemp - setTemp); AMT = (int) Math.abs(dT); System.out.println("The temperature difference is : "+ AMT); return AMT; } } The next method to try and use the generated variables is getHeatingTime1() which needs rand1[2] for the tank volume: public double getHeatingTime1(){ Computation jose = new Computation(); int [] Results = new int [4]; Results [0] = AMT; //Results [] = Computation.class; Q = 3; //heating in kW Cp = 4.2; //Specific heat capacity of water vo…
tagged with: java
type: Question
answer count: 2
tagged with: arrays

http://stackoverflow.com/a/23092918
score: 4
answers question: http://stackoverflow.com/q/23092530
type: Answer
upvote count: 4
downvote count: 0
has body: An orthographic projection is a rectangular parallelepiped (aka a box). The parameters for the glOrtho call define the clipping planes, or edges, of this box. Anything that lies outside of the projection box will not be rendered. In regards to your example calls, the first one (glOrtho(1,1,1,1,1,-1)) is invalid and generates an GL_INVALID_OPERATION). Why? An orthographic projection is defined as Notice the division by 0 errors due to right == left and top == bottom. The second example (glOrtho(-1,1,-1,1,1,-1)) simply creates an identity matrix. Chapter 3 - OpenGL Programming Guide - Projection Transforms ScratchPixel - Orthographic Projection Tutorial

http://stackoverflow.com/comment/35214843
has text: @AmitYadav Take a look at [this question](http://stackoverflow.com/questions/10607990/how-should-i-copy-strings-in-java) and see if that helps you understand what AmirBawab is talking about.
score: 1
comment on: http://stackoverflow.com/a/23047162
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22986973
tagged with: svn
has answer: http://stackoverflow.com/a/22988816
score: 0
has title: SVN Ignored folder shows again and again
answer count: 1
type: UnansweredQuestion
tagged with: tortoisesvn
has body: I have a local SVN folder which has many files/directories/sub-directories One of them is Project-Ear, which contains generated folders/files that I do not wish to check-in at all.. I have marked this Project-Ear folder as "unversion and add to ignore list" Now every time, I do SVN Commit, this folder Project-Ear and it's files show in the Commit dialog. How do I fix this? I do not want this Project-Ear to be shown at all.
tagged with: java
type: Question

http://stackoverflow.com/q/23020612
linked to: http://stackoverflow.com/q/504103
has answer: http://stackoverflow.com/a/23021584
type: UnansweredQuestion
has body: Item 5 in Effective Java Joshua Bloch says avoid creating your object pool unless the objects are extremely heavy weight but in jdk source I see IntergerCache in Integer class, LongCache and CharacterCache in Long and Character class. public class autobox { /** * @param args */ public static void main(String[] args) { long start=System.nanoTime(); Integer sum=0; sum=sum+94; //1-- takes most time long end=System.nanoTime(); System.out.println(end-start); for(int i=0;i&lt;1000;i++) sum=sum+i; end=System.nanoTime(); System.out.println(end-start); //--2 sum=0; for(int j=5;j&lt;1000;j++) sum=sum+j; end=System.nanoTime(); System.out.println(end-start); //--3 } } Output on my machine (with Java SE 1.7) 540686 984338 1450849 It looks like statement 1 is creating a too many objects all for the sake of creating just one Integer object!. I don't get the reason behind this. Though the documentation mentions -XX:AutoBoxCacheMax=&lt;size&gt; I get an error Unrecognized VM option 'AutoBoxCacheMax=0'. Shouldn't the cache only keep created objects instead of creating unnecessary objects?
has title: Role of cache in autoboxing
has comment: http://stackoverflow.com/comment/35166622
tagged with: java
has comment: http://stackoverflow.com/comment/35166598
has comment: http://stackoverflow.com/comment/35166467
type: Question
has comment: http://stackoverflow.com/comment/35166147
has comment: http://stackoverflow.com/comment/35166436
score: 0
tagged with: autoboxing
answer count: 1

http://stackoverflow.com/a/23112897
has body: This will be a finally fix. Close eclipse. Delete bin folder inside your project folder. Start eclipse and clean your project. Now run and the problem should begone. Even now you are getting the same error.Please consider updating the Eclipse IDE.
accepted answer of: http://stackoverflow.com/q/23085245
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35374609
has comment: http://stackoverflow.com/comment/35374463
type: Answer
answers question: http://stackoverflow.com/q/23085245

http://stackoverflow.com/a/23051829
has body: Since UDP is connection less, the DatagramPacket.sender will be your only option to route messages to the appropriate session. There is conceptually only one ChannelPipelineFactory and in fact only one Channel for UDP for the application. As far as I know it is not safe to attach the ChannelHandlerContext. The way to deal with multiple clients is to use a Map with the key as the DatagramPacket.sender address and value as your session.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35224350
accepted answer of: http://stackoverflow.com/q/23047266
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23047266

http://stackoverflow.com/q/23119149
has comment: http://stackoverflow.com/comment/35347177
upvote count: 1
has answer: http://stackoverflow.com/a/23121214
has comment: http://stackoverflow.com/comment/35346973
answer count: 1
linked to: http://stackoverflow.com/q/6127648
tagged with: java
type: UnansweredQuestion
has body: I tried to use FileChannel.transferFrom to move some content of a file to the begining. try (RandomAccessFile rafNew = new RandomAccessFile(_fileName, "rw"); RandomAccessFile rafOld = new RandomAccessFile(_fileName, "r");) { rafOld.seek(pos); rafOld.getChannel().transferTo(0, count, rafNew.getChannel()); } catch (IOException e) { throw new RuntimeException(e.getMessage()); } The result of this is a file with strange repetitions of data. The example works if I first transfer data to a buffer file and then from buffer file back to the origin file again. The Java Docs say nothing about the case where source and destination are the same file.
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: io
has comment: http://stackoverflow.com/comment/35344522
has comment: http://stackoverflow.com/comment/35384480
has title: FileChannel.transferFrom to shift file content

http://stackoverflow.com/comment/35354412
has text: You could put a constraint on the two times to be unique...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23125298

http://stackoverflow.com/q/22984276
has comment: http://stackoverflow.com/comment/35100139
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35099410
possible better answer: http://stackoverflow.com/a/22984378
has answer: http://stackoverflow.com/a/22986092
accepted answer: http://stackoverflow.com/a/22986092
type: Question
has comment: http://stackoverflow.com/comment/35100396
has answer: http://stackoverflow.com/a/22985917
downvote count: 0
has comment: http://stackoverflow.com/comment/35100075
has body: I'm using tomcat + spring. When use following config: &lt;bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp.BasicDataSource"&gt; &lt;property name="driverClassName" value="com.ibm.db2.jcc.DB2Driver" /&gt; &lt;property name="url" value="url" /&gt; &lt;property name="username" value="user" /&gt; &lt;property name="password" value="pass" /&gt; &lt;/bean&gt; I'm able to obtain connection. But when I try use Tomcat's CP as follows: &lt;bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource"&gt; &lt;property name="driverClassName" value="com.ibm.db2.jcc.DB2Driver" /&gt; &lt;property name="url" value="url" /&gt; &lt;property name="username" value="user" /&gt; &lt;property name="password" value="pass" /&gt; &lt;/bean&gt; I got nested root cause exception: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver The only change I'm making is rename class which is responsible for creating data source. Why this happen? How to solve that? UPDATE - STACK TRACE exception org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.sql.SQLException: com.ibm.db2.jcc.DB2Driver org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) root cause java.sql.SQLException: com.ibm.db2.jcc.DB2Driver org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:254) org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182) org.apache.tomcat.jdbc.pool.ConnectionPool.createCo…
tagged with: tomcat
has comment: http://stackoverflow.com/comment/35099552
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/35099650
has answer: http://stackoverflow.com/a/22984378
favorite count: 0
has title: DB2 driver not found with Tomcat CP but Commons works fine?
linked to: http://stackoverflow.com/q/9183321
has comment: http://stackoverflow.com/comment/35100200
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/comment/35289018
has text: Note that this becomes a classic concurrency problem at this point. Just because you guard _retrieval_ of the instance through a `synchronized` method, does not mean that your later interaction with that object is synchronized. The reference on Jena concurrency that I mentioned previously is not optional. You'll need to use [Model](http://jena.apache.org/documentation/javadoc/jena/com/hp/hpl/jena/rdf/model/Model.html)'s `enterCriticalSection` and `leaveCriticalSection` methods.
score: 0
comment on: http://stackoverflow.com/a/23062588
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35228887
score: 0
type: Comment
has text: yes maven is used.I am using spring tool suite.I have pom.xml.Please tell me how will I know now
comment on: http://stackoverflow.com/a/23055526
type: AnswerComment

http://stackoverflow.com/a/50226019
has body: in IntelliJ IDEA 2018, you can do this: ctrl+shift+f thanks @Ashutosh Jindal
downvote count: 0
has comment: http://stackoverflow.com/comment/90360898
has comment: http://stackoverflow.com/comment/90288656
type: Answer
has comment: http://stackoverflow.com/comment/90393772
has comment: http://stackoverflow.com/comment/90439020
answers question: http://stackoverflow.com/q/23128952
score: 22
upvote count: 22
has comment: http://stackoverflow.com/comment/96866216

http://stackoverflow.com/q/22978710
answer count: 3
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22978746
has body: I have an array consisting of a color shading (lightgreen, red, blue, etc.) as well as having a number in regards to the colors "strength" (1000, 1200, 400, etc.) The lines are read in through a .txt file as follows light green 1200 red 1000 blue 400 I was wondering if there is a way to split the two elements into distinct arrays (one for String and one for int) so that I can sort the array by the strengths into ascending order.
has comment: http://stackoverflow.com/comment/35089852
type: Question
has comment: http://stackoverflow.com/comment/35089982
has title: Splitting Elements in an Array
tagged with: java
has comment: http://stackoverflow.com/comment/35089846
possible better answer: http://stackoverflow.com/a/22978775
has comment: http://stackoverflow.com/comment/35090000
has answer: http://stackoverflow.com/a/22978775
score: 0
has answer: http://stackoverflow.com/a/22978932
has answer: http://stackoverflow.com/a/22978746
tagged with: arrays
tagged with: sorting
has comment: http://stackoverflow.com/comment/35090005
has comment: http://stackoverflow.com/comment/35089889

http://stackoverflow.com/q/23020717
tagged with: apache-poi
has title: Getting the x/y position of an XSSFChart (xlsx chart) with Apache POI
upvote count: 2
type: UnansweredQuestion
tagged with: excel
score: 2
has answer: http://stackoverflow.com/a/78712942
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35220834
answer count: 1
downvote count: 0
favorite count: 0
has body: If I have an XSSFChart (or an XSSFDrawing, which contains charts), how do I get the x/y position of that chart on the sheet? It seems like this should be an easy thing to do, but I have not been able to figure it out.
has comment: http://stackoverflow.com/comment/35185032
tagged with: openxml

http://stackoverflow.com/a/23057102
has body: i can't why into my lista[] there are: http://paste.ubuntu.com/7248880/ this is my list[] but i can't inverted order with: String[] invertedList = new String[lista.length]; for(int i = 0; i &lt; lista.length; i ++) { invertedList[i] = lista[lista.length - 1 - i]; } else invertedList[1] is ugual at "In orario" and into Compagnia print "In Orario" it's possible inverted only rows? Do you understand me? SOLVED: i have printed lista in reverse mode and changed order textview :( Thank you so much
answers question: http://stackoverflow.com/q/23049956
score: 0
type: Answer

http://stackoverflow.com/comment/35331093
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23112193
has text: No, I won't. The only thing I'll do is reverse engineer Jackson, but I hoped for a quick answer here. Well, then...
type: Comment

http://stackoverflow.com/a/22988890
upvote count: 2
has comment: http://stackoverflow.com/comment/35108037
has comment: http://stackoverflow.com/comment/35107945
has body: Cookie[] cookies = request.getCookies(); for (int i = 0; i &lt; cookies.length; i++) { String name = cookies[i].getName(); String value = cookies[i].getValue(); } try this in servlet.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35136333
has comment: http://stackoverflow.com/comment/35112069
answers question: http://stackoverflow.com/q/22988844
type: Answer
accepted answer of: http://stackoverflow.com/q/22988844
score: 2

http://stackoverflow.com/comment/35489210
type: QuestionComment
comment on: http://stackoverflow.com/q/23127955
has text: @Rocky111 Thank you for the information. Although before trying out it, I figured the boolean was always getting evaluated to false and so the mapper didn't emit any key,value pair. But when I evaluated the same expression using `if(siteId.equals(siteId1) || siteId.equals(siteId2) || ... 34 site Ids)` , i got the output in the hbase table. But still I am not sure why the boolean didn't work
score: 0
type: Comment

http://stackoverflow.com/q/23072568
tagged with: imap
has comment: http://stackoverflow.com/comment/46839617
has comment: http://stackoverflow.com/comment/35978056
has body: I'm writing a program that connects to gmail and checks the number of messages in the inbox. If I call getMessageCount() on the unopened Folder, it returns 554, but after opening it, it returns 541. Why the difference? By the way, I'm ultimately trying to check for deleted messages (that have not been expunged) and recover them if possible. Edit: some example code: Session session = Session.getDefaultInstance(System.getProperties()); Store store = session.getStore("imaps"); store.connect("imap.googlemail.com", 993, email, password); Folder inbox = store.getFolder("INBOX"); System.out.println(inbox.getMessageCount()); inbox.open(Folder.READ_ONLY); System.out.println(inbox.getMessageCount()); Edit: protocol trace: (In the meantime I got some more emails so the numbers are different from above) DEBUG: setDebug: JavaMail version 1.5.2 DEBUG: getProvider() returning javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle] DEBUG IMAPS: mail.imap.fetchsize: 16384 DEBUG IMAPS: mail.imap.ignorebodystructuresize: false DEBUG IMAPS: mail.imap.statuscachetimeout: 1000 DEBUG IMAPS: mail.imap.appendbuffersize: -1 DEBUG IMAPS: mail.imap.minidletime: 10 DEBUG IMAPS: trying to connect to host "imap.googlemail.com", port 993, isSSL true * OK Gimap ready for requests from &lt;ip&gt; vt17mb17567619iec A0 CAPABILITY * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN A0 OK Thats all she wrote! vt17mb17567619iec DEBUG IMAPS: AUTH: XOAUTH DEBUG IMAPS: AUTH: XOAUTH2 DEBUG IMAPS: AUTH: PLAIN DEBUG IMAPS: AUTH: PLAIN-CLIENTTOKEN DEBUG IMAPS: protocolConnect login, host=imap.googlemail.com, user=&lt;email&gt;, password=&lt;non-null&gt; DEBUG IMAPS: AUTHENTICATE PLAIN command trace suppressed DEBUG IMAPS: AUTHENTICATE PLAIN command result: A1 OK &lt;email&gt; authenticated (Success) A2 CAPABILITY * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 U…
tagged with: jakarta-mail
has comment: http://stackoverflow.com/comment/35966508
downvote count: 0
has comment: http://stackoverflow.com/comment/35969495
favorite count: 0
has title: JavaMail - getMessageCount changes after opening imap folder?
has comment: http://stackoverflow.com/comment/46822179
has comment: http://stackoverflow.com/comment/35300596
has comment: http://stackoverflow.com/comment/35261443
answer count: 0
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java

http://stackoverflow.com/a/23062048
accepted answer of: http://stackoverflow.com/q/23062012
score: 4
answers question: http://stackoverflow.com/q/23062012
type: AcceptedAnswer
type: Answer
upvote count: 4
has body: why not just not give a variable name? new FileCorrector("fileNotFound.txt"); It looks odd because constructors really shouldn't have side-effects. But they can throw, and they literally can have side effects, so it's not that this code doesn't do anything. And as far as Eclipse warnings are concerned, this is preferred to an unused variable.
downvote count: 0

http://stackoverflow.com/comment/35244450
comment on: http://stackoverflow.com/a/23063777
type: Comment
has text: @NimChimpsky no, they're not, for the reasons I just explained and you ignored. Yes, a map is better in this case since there's no difference in code, just difference in data.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23049759
favorite count: 0
has comment: http://stackoverflow.com/comment/35218858
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35218869
tagged with: android
type: AnsweredQuestion
has body: Every time I attempt to test this the app crashes when I hit the "Next" button (butHOURS button). I've tried redoing the XML's, looking over the code several times but I can't figure it out. Any help would be mighty appreciated. This is also the second class in a series of 5 and the first (main) class switches just fine to this class/xml layout. package com.pewpew.studentadvisor; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.RadioButton; public class Main2 extends Activity { public Button butHOURS; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main2); RadioButton hours1 = (RadioButton) findViewById(R.id.hours1); RadioButton hours2 = (RadioButton) findViewById(R.id.hours2); RadioButton hours3 = (RadioButton) findViewById(R.id.hours3); RadioButton hours4 = (RadioButton) findViewById(R.id.hours4); //Calculation based on ENROLLED question if (hours1.isChecked()){Main.calculation = Main.calculation + 1;} else{ if (hours2.isChecked()) {Main.calculation = Main.calculation + 2; } else{ if (hours3.isChecked()) {Main.calculation = Main.calculation + 3; } else{ if (hours4.isChecked()) {Main.calculation = Main.calculation + 4; } else{Main.calculation = 0.0; }}}} //Get button to do button stuff like go to the next page Button butHOURS = (Button) findViewById(R.id.butHOURS); butHOURS.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent i = new Intent(Main2.this, Main3.class); startActivity(i); } }); } } Here is the crash log 04-13 19:43:54.820: D/AndroidRuntime(26281): Shutting down VM 04-13 19:43:54.820: W/dalvikvm(26281): threadid=1: thread exiting with uncaught exception (group=0x41548360) 04-13 19:43:54.830: E/AndroidRuntime(26281): FATAL EXCEPTION: main 04-13 19:43:54.830: E/AndroidRuntime(26281): android.co…
has comment: http://stackoverflow.com/comment/35218897
has answer: http://stackoverflow.com/a/23049774
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23049805
upvote count: 1
type: Question
has title: I cannot get this class to open another class/xml via button
possible better answer: http://stackoverflow.com/a/23049805
accepted answer: http://stackoverflow.com/a/23049774
answer count: 3
has answer: http://stackoverflow.com/a/23049868
downvote count: 0
has comment: http://stackoverflow.com/comment/35218768

http://stackoverflow.com/comment/35092255
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22979952
has text: I replaced ; with {} but still no luck. Anyway, thank you for your time.

http://stackoverflow.com/comment/35227004
comment on: http://stackoverflow.com/a/23054497
score: 3
has text: I guess he wanted a uniform distribution, not a log-uniform one
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23095498
tagged with: java
accepted answer: http://stackoverflow.com/a/23095621
type: Question
has title: Exhausted Resultset when calling a method inside the while(rset.next)
score: 0
tagged with: sql
answer count: 1
has answer: http://stackoverflow.com/a/23095621
has body: I'm getting an Exhausted resultset form the following code. I've tried a few different things now and can't find a solution, if I don't call the songs method it works, but the songs method works when it's called, can't get my head around it, hoping I'm missing something simple. public void refreshList() { rset = po.getProduct(); if (plist.size() &gt; 0) { for (int i = plist.size() - 1; i &gt;= 0; i--) { plist.remove(i); } } try { while (rset.next()) { songs(rset.getString(1)); CD c = new CD(alist); Product p = new Product(rset.getString(1), rset.getString(2), rset.getString(3), rset.getDouble(4), rset.getDouble(5), rset.getInt(6), rset.getString(7), rset.getString(8), rset.getString(9), rset.getDouble(10), c); plist.add(p); } } catch (Exception ex) { System.out.println(ex); } } public void songs(String ID) { rset = po.getSongs(); alist = new ArrayList&lt;Song&gt;(); try { while (rset.next()){ Song s = new Song(rset.getString(1), rset.getString(2), rset.getString(3)); slist.add(s); } } catch (Exception ea) { System.out.println(ea); } for(int i = 0; i &lt; slist.size(); i++) { if(slist.get(i).getSong_id().equals(ID)) { alist.add(slist.get(i)); } } }
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35302272
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35301976

http://stackoverflow.com/a/23004730
downvote count: 1
type: Answer
upvote count: 0
has body: You can do this- Iterator&lt;String&gt; _names = _formObject.keys(); while (_names.hasNext()) { String key = _names.next(); try { Object value = _formObject.get(key); if(value.equals("No")) { /*Do your stuff for No*/ } if(value.equals("phone")) { /*Do your stuff for phone*/ } if(value.equals("Name")) { /*Do your stuff for Name*/ } if(value.equals("Sex")) { /*Do your stuff for Sex*/ } } catch (JSONException e) { } } So it doesn't matter in which order they appeared before. All you have to do is to check which key do you want in which order with _formObject.get(key). Please note that keys() function on a jsonObject doesn't give the ordered list as it is. You have to do it as suggested in this way.
score: -1
answers question: http://stackoverflow.com/q/23004663

http://stackoverflow.com/comment/35243523
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23049565
has text: Yes, when I was making the classes it was purely to demonstrate what has been the emphasis during this years school semester. If I wasn't concerned if I had the marks I would have kept them all as simply Medication objects. I found the issue, it was within my generibrand.txt file I needed to add delimeters at the end of each line. I discovered this upon close analysis of the `System.out.println();` of each line, and noticed every other line it was breaking early and going to the next line. Thanks for the help everyone!
score: 0

http://stackoverflow.com/comment/107862390
score: 1
type: Comment
comment on: http://stackoverflow.com/q/23079003
has text: You can find a lot of answers and guidance in the official docs of the package: https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html
type: QuestionComment

http://stackoverflow.com/q/23071450
has body: I would like to setup a JAXB-annotated Java class to generate some XML in the following format: The title of my page The "refId" field is optional, so I'd like to use Guava's Optional construct to reference the string in memory. I see Using generic @XmlJavaTypeAdapter to unmarshal wrapped in Guava's Optional, which gives a thorough example if you're using an element (even if that wasn't the original question), but how would you set up the annotations for an XML attribute? Here's what I have so far: @XmlRootElement(name="page") public final class Page { @XmlAttribute @XmlJavaTypeAdapter(OptionalAdapter.class) private Optional<String> refId; @XmlElement private String title; ... getters/setters, default constructor, etc. } And OptionalAdapter is a simple XmlAdapter: public class OptionalAdapter<T> extends XmlAdapter<T, Optional<T>> { @Override public Optional<T> unmarshal(T v) throws Exception { return Optional.fromNullable(v); } @Override public T marshal(Optional<T> v) throws Exception { if (v == null || !v.isPresent()) { return null; } else { return v.get(); } } } When I try to load up a unit test against the above code, it fails instantly during initialization, but if I change the annotation to @XmlElement, the test will run and pass, but obviously sets the refId as a child element instead of an attribute. Thanks in advance!
has title: Using Guava's Optional with @XmlAttribute
upvote count: 5
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/19360139
has answer: http://stackoverflow.com/a/23113540
downvote count: 0
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: Question
score: 5
answer count: 1
tagged with: guava
accepted answer: http://stackoverflow.com/a/23113540
tagged with: java
tagged with: jaxb

http://stackoverflow.com/comment/35272145
has text: look what i get [com.example.webservicetest.OrderDetails@40cf2238]
comment on: http://stackoverflow.com/a/23078046
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/23128649
score: 1
upvote count: 1
downvote count: 0
has body: request.setAttribute("key","value as Object") the value stored as Object (note big O) so when you retrieve back request.getAttribute("key") it returns as type Object so you need to caste it.
answers question: http://stackoverflow.com/q/23128429
type: Answer

http://stackoverflow.com/q/23122780
has body: The Issue I'm having a problem with ProGuard 4.11 (An application that can optimize, shrink and obfuscate Java code), using the proguard-maven-plugin (github.com/wvengen/proguard-maven-plugin) (Although that shouldn't matter that much, since the error is occurring at runtime and the maven plugin just calls the binary with some arguments as far as I know). I have an annotation class which is stuctured like this (nothing special): @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface SqlValueCache { String value(); SqlValueCache.Type type() default Type.OBJECT_UPDATE; //Type is just an ordinary enum } I also have some fields annotated with that annotation, but I'm skipping the type() parameter because I want to use the default value: @SqlValueCache("nickname") protected SqlValueHolder&lt;String&gt; nick; Now I want to process that annotation at runtime: SqlValueCache annotation = field.getAnnotation(SqlValueCache.class); //Skipped the validation annotation.value(); //Works fine, because specified annotation.type(); //java.lang.annotation.IncompleteAnnotationException, *not* using the default As stated in the comment above, I get an IncompleteAnnotationException, stating that my annotation declaration is missing the type() value. But that value should be implied by the default Type.OBJECT_UPDATE! So now I'm wondering, why is that happening? Assumptions I assume that the default thing is stored in some kind of attribute that I need to specify in -keepattributes, but I haven't been able to figure out if this is true or which one it is. Reproduction It does work just as intended when not using ProGuard. I have also made sure that the problem is in fact the missing implied value - The code runs as intended when using ProGuard, but explicitly specifying the type(), like so: @SqlValueCache(value = "nickname", type = Type.OBJECT_UPDATE) protected SqlValueHolder&lt;String&gt; nick; I am using this method as a temporary workaround, but this isn't the …
has answer: http://stackoverflow.com/a/23189071
type: AnsweredQuestion
tagged with: java
tagged with: annotations
accepted answer: http://stackoverflow.com/a/23189071
type: Question
score: 5
upvote count: 5
has title: ProGuard ignoring annotation default values
answer count: 1
downvote count: 0
favorite count: 0
tagged with: proguard

http://stackoverflow.com/q/23021860
answer count: 1
has body: In my Java project, I have three values in an existing properties file (version info file): Their values will be different for each build. value1=1 value2=2 value3=3 I want to use ant to read them and write them back at the end of the same properties file as this format: if the line exist, overwrite it. values=value1.value2.value3 i.e. values=1.2.3 How to do this? Resolved: I have figured out: use &lt;loadproperties&gt; to load the properties. use value1, value2 and value3 as properties with ${value1} to get value and then write to the file with &lt;propertyfile&gt;.
type: UnansweredQuestion
has title: ant reads values from properties entries and write back in a new line
tagged with: ant
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23023408
score: 0

http://stackoverflow.com/comment/35279197
type: QuestionComment
has text: Yep, the question is not very clear at all. What are "default methods" which you want to avoid? What do you mean by "close manually"? Also, since you are learning Swing I strongly suggest that you not use a windows builder utility but instead code by hand using the Swing tutorials as a guide until you learn the library.
score: 2
comment on: http://stackoverflow.com/q/23083378
type: Comment

http://stackoverflow.com/comment/35213837
type: AnswerComment
comment on: http://stackoverflow.com/a/23046848
type: Comment
has text: @user3529614 first tell me where do you get json from?? and what is `mVideoData`?
score: 0

http://stackoverflow.com/q/23093470
type: Question
has title: Java order of Initialization and Instantiation
has comment: http://stackoverflow.com/comment/35298379
answer count: 2
has answer: http://stackoverflow.com/a/23094875
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35298495
has body: I am trying to piece together the process of Initialization and Instantiation in the JVM but the JLS is a little obtuse on a few details, so if anyone would mind clearing up some details it would be appreciated. This is what I have been able to figure out so far. Initialization Recursively Initialize static final variables of the class and it's interfaces that are compile time constants. Back out of the recursion processing static blocks and static fields in textual order. Instantiation Recursively Initialize final instance variables of the class that are compile time constants. Back out of the recursion processing non-static blocks and instance fields in textual order prepending them to the constructors as it returns. Okay, so now for the questions. are interfaces processed in order of declaration? are interfaces processed in a separate recursive stack? a) if yes, do interfaces get processed before or after superclasses? b) if yes, am I correct in deducing that one or the others (Interface or Superclass) gets its non-compile-time constant fields initialized before the others compile-time constants. What role does calls to the nondefault super() constructor play in this process? Am I mistaken in any of my conclusions? Am I missing any other key details?
upvote count: 54
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23094875
score: 54
tagged with: java
possible better answer: http://stackoverflow.com/a/48131400
has answer: http://stackoverflow.com/a/48131400

http://stackoverflow.com/a/23083129
has comment: http://stackoverflow.com/comment/42136464
downvote count: 0
has comment: http://stackoverflow.com/comment/42136377
answers question: http://stackoverflow.com/q/23082949
score: 3
has comment: http://stackoverflow.com/comment/35284266
upvote count: 3
has comment: http://stackoverflow.com/comment/35279514
has comment: http://stackoverflow.com/comment/35279376
has body: That happens because listener is of type: Consumer&lt;? extends EventObject&gt; (so, it's a Consumer of some specific, but unknown type that extends EventObject), but you want it to accept an event of type E. The compiler cannot check if the unknown type indicated by the wildcard is equal to the type E. Why are you using wildcards at all? It would be better to get rid of them, and do something like this: public class Emitter&lt;E extends EventObject&gt; { protected HashMap&lt;String, PriorityQueue&lt;Consumer&lt;E&gt;&gt;&gt; listeners; public Emitter() { this.listeners = new HashMap&lt;String, PriorityQueue&lt;Consumer&lt;E&gt;&gt;&gt;(); } public Emitter on(String eventName, Consumer&lt;E&gt; listener) { if (!this.listeners.containsKey(eventName)) { this.listeners.put(eventName, new PriorityQueue&lt;Consumer&lt;E&gt;&gt;()); } this.listeners.get(eventName).add(listener); return this; } public Emitter emit(E event) { String eventName = event.getClass().getName(); for (Consumer&lt;E&gt; listener : this.listeners.get(eventName)) { listener.accept(event); } return this; } } Note: A wildcard type with a ? extends EventObject does not mean you can pass any object to it that extends EventObject; it specifies one specific, but unknown type that extends EventObject. Because what the exact type is, is unknown, this limits what you can do with it.
has comment: http://stackoverflow.com/comment/42136139
type: Answer

http://stackoverflow.com/comment/35354351
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23125339
type: Comment
has text: Thanks. This has actually fixed my problem. The conversion is indeed posible

http://stackoverflow.com/comment/35089947
type: Comment
comment on: http://stackoverflow.com/a/22978746
score: 0
type: AnswerComment
has text: You can easily do that by `line.split(" +")`. It will split the line into one or more space.

http://stackoverflow.com/comment/35161762
score: 0
comment on: http://stackoverflow.com/q/23018302
type: QuestionComment
type: Comment
has text: Or delete the line and add "int " before the ref in the loop to have a local declaration. It is not used outside the loop anyway.

http://stackoverflow.com/comment/35213427
has text: The `(.*)` that should be greedy as well `(.*?)`.
type: QuestionComment
comment on: http://stackoverflow.com/q/23046897
type: Comment
score: 1

http://stackoverflow.com/comment/35301532
score: 0
comment on: http://stackoverflow.com/a/23095282
type: AnswerComment
type: Comment
has text: is this method is specific to SQL-server or it it works on other databases as well?

import
type: Tag
tags question: http://stackoverflow.com/q/23127919
tags question: http://stackoverflow.com/q/23039569
tag name: import
tags question: http://stackoverflow.com/q/23046220
tags question: http://stackoverflow.com/q/23019254
tags question: http://stackoverflow.com/q/23044436

http://stackoverflow.com/comment/35188772
has text: "@Harold, wording "if Operand2 is Negative then compute it’s 2’s complement" I mentioned to avoid confusion say >>-5 don’t mislead that you are going to shift with 5 its -5 so if we keep in your program it internally take -5(2's complement of 5) only but when we check assuming 5 we will get different result. Same for -873>>
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23028977
type: QuestionComment

http://stackoverflow.com/comment/35208824
type: Comment
score: 0
type: AnswerComment
has text: @PavelHoral Yes I know that, the part I'm missing is why the proxy doesn't blow up on direct field access.
comment on: http://stackoverflow.com/a/23032626

http://stackoverflow.com/q/23091427
has answer: http://stackoverflow.com/a/23091784
has comment: http://stackoverflow.com/comment/35294306
tagged with: regex
has answer: http://stackoverflow.com/a/23091608
has comment: http://stackoverflow.com/comment/35297662
has comment: http://stackoverflow.com/comment/35298965
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/5601754
score: 24
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23091541
possible better answer: http://stackoverflow.com/a/40840145
accepted answer: http://stackoverflow.com/a/23091608
has answer: http://stackoverflow.com/a/23091761
has answer: http://stackoverflow.com/a/40840145
has body: I want to allow 0 or more white spaces in my string and one or more A-Z or a-z or 0-9 in my string. Regex allowing a space character in Java suggests [0-9A-Za-z ]+. I doubt that, this regex matches patterns having zero or more white spaces. What to do to allow 0 or more whitespaces anywhere in the string and one or more characters anywhere in the string. Will this work? ([0-9A-Za-z]+)([ ]*)
has answer: http://stackoverflow.com/a/23092673
has comment: http://stackoverflow.com/comment/35294296
has comment: http://stackoverflow.com/comment/35295977
answer count: 7
has title: Regex for ONE-or-more letters/digits And ZERO-or-more spaces
favorite count: 0
upvote count: 25
has answer: http://stackoverflow.com/a/23091642
has comment: http://stackoverflow.com/comment/35294370

http://stackoverflow.com/q/23128998
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23132856
type: UnansweredQuestion
has body: I am using arrayList in .drl rule file. In one rule i am checking list is null or not and setting setFocus(2nd rule) . in 2nd rule i am getting the element from list, bt in this rule i am getting list is null error. I want to check list is null or not and getting particular element from that arraylist in one rule. rule "Rule chesks client had already received Notifications or Not" salience 10 no-loop true when event : Event($listOfClientNotifications : clientNotifications) eval($listOfClientNotifications &lt; 1) then event.setMessage("list is null"); end 2nd rule: rule "Rule chesks " salience 05 no-loop true when event : Event($listOfClientNotifications : clientNotifications) value : ClientNotifications() from $listOfClientNotifications; // &lt;&lt;&lt; !!! then event.setMessage("Value "+**value.getMessage()**); end This &lt;&lt;&lt; !!! is where the null error occurs.
tagged with: java
type: Question
tagged with: drools
has title: Error while traversing Null array in DRools rule

http://stackoverflow.com/comment/35348041
comment on: http://stackoverflow.com/q/23120925
score: 0
type: Comment
type: QuestionComment
has text: https://developers.google.com/ad-exchange/rtb/response-guide/decrypt-hyperlocal#decryption

http://stackoverflow.com/a/23110396
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23110212
upvote count: 3
answers question: http://stackoverflow.com/q/23110212
has body: You could use JAXBSource and JAXBResult directly with your transformation. JAXBSource source = new JAXBSource(marshaller, src); JAXBResult result = new JAXBResult(jaxbContext); transformer.transform(source, result); Object result = result.getResult(); For More Information You can find an example of using JAXB with the javax.xml.transform APIs on my blog: http://blog.bdoughan.com/2012/11/using-jaxb-with-xslt-to-produce-html.html
score: 3
has comment: http://stackoverflow.com/comment/35327217
has comment: http://stackoverflow.com/comment/35328206
type: AcceptedAnswer

hadoop
tags question: http://stackoverflow.com/q/23053240
tags question: http://stackoverflow.com/q/23108910
tags question: http://stackoverflow.com/q/23054188
tags question: http://stackoverflow.com/q/22982195
tags question: http://stackoverflow.com/q/23098675
tag name: hadoop
tags question: http://stackoverflow.com/q/23075987
tags question: http://stackoverflow.com/q/23033068
tags question: http://stackoverflow.com/q/23042829
tags question: http://stackoverflow.com/q/23010764
tags question: http://stackoverflow.com/q/23009683
type: Tag
tags question: http://stackoverflow.com/q/23017937
tags question: http://stackoverflow.com/q/23005698
tags question: http://stackoverflow.com/q/22997137
tags question: http://stackoverflow.com/q/23012536
tags question: http://stackoverflow.com/q/23027229
tags question: http://stackoverflow.com/q/23057891
tags question: http://stackoverflow.com/q/23088320
tags question: http://stackoverflow.com/q/23025000
tags question: http://stackoverflow.com/q/23024960
tags question: http://stackoverflow.com/q/23010542
tags question: http://stackoverflow.com/q/23031339
tags question: http://stackoverflow.com/q/23007984
tags question: http://stackoverflow.com/q/22978937
tags question: http://stackoverflow.com/q/23045793
tags question: http://stackoverflow.com/q/22992083
tags question: http://stackoverflow.com/q/23005509
tags question: http://stackoverflow.com/q/23127955
tags question: http://stackoverflow.com/q/23068364
tags question: http://stackoverflow.com/q/23069456
tags question: http://stackoverflow.com/q/23126273
tags question: http://stackoverflow.com/q/23127840
tags question: http://stackoverflow.com/q/23008014
tags question: http://stackoverflow.com/q/23103504
tags question: http://stackoverflow.com/q/23101475
tags question: http://stackoverflow.com/q/23068082

http://stackoverflow.com/comment/91825345
has text: @Puce a note in your answer explaining why `.flatMap(Collection::stream)` is no possible would be better, I think. Should be more permanent.
comment on: http://stackoverflow.com/a/23113085
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35365737
type: Comment
has text: How did you started your main class in the first place? Before I posted my answer?
comment on: http://stackoverflow.com/a/23129147
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35112790
type: Comment
score: 0
has text: I posted the proguard configuration
type: AnswerComment
comment on: http://stackoverflow.com/a/22991040

http://stackoverflow.com/a/23034908
downvote count: 0
answers question: http://stackoverflow.com/q/23034700
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23034700
has comment: http://stackoverflow.com/comment/35691501
type: Answer
has body: You have to remember that AsyncTask is executed in a different thread at a different time. In your case, description.setText(descriptiontext); is executed first. A good approach would be preventing to use static reference of descriptiontext. What you could do in this case is to add a constructor to readtextfile and pass the TextView instance. onPostExecute() method would be executed after doInBackground() that read the string content. Subsequently, any UI related methods should be accessed in onPostExecute() method. I have slightly modified your readtextfile class as the following: public class readtextfile extends AsyncTask&lt;String, Integer, String&gt;{ private TextView textViewToSet; public readtextfile(TextView descriptionTextView){ this.textViewToSet = descriptionTextView; } @Override protected String doInBackground(String... params) { String result = ""; try { URL url = new URL("http://example.com/example.txt"); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String line = null; while ((line = in.readLine()) != null) { //get lines result+=line; } in.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return result; } protected void onProgressUpdate() { //called when the background task makes any progress } protected void onPreExecute() { //called before doInBackground() is started } @Override protected void onPostExecute(String result) { this.textViewToSet.setText(result); } } What you need to do next is to just call new readtextfile().execute("http://example.com/example.txt"); and remove this line from onCreateView method description.setText(descriptiontext);
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35927807

http://stackoverflow.com/comment/35190428
score: 0
type: QuestionComment
has text: button belongs to fragment layout while you initialize the same in Activity leading to crash
type: Comment
comment on: http://stackoverflow.com/q/23034083

http://stackoverflow.com/q/23080265
has comment: http://stackoverflow.com/comment/35277694
upvote count: 1
tagged with: gradle
type: Question
accepted answer: http://stackoverflow.com/a/23083233
tagged with: google-maps
has title: Can't import com.google.maps.android:android-maps-utils via gradle
has comment: http://stackoverflow.com/comment/35277246
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35277233
has comment: http://stackoverflow.com/comment/35277476
favorite count: 0
has answer: http://stackoverflow.com/a/23083233
tagged with: android
tagged with: android-studio
type: AnsweredQuestion
score: 1
tagged with: java
has body: I tried to import com.google.maps.android:android-maps-utils to my project in Android Studio 0.5.4. I get this Gradle Information and Error: Information:[C:\Users\Gast1_000\android studio projects\GeoPicture\app\build\exploded-aar\com.google.maps.android\android-maps-utils\0.3\AndroidManifest.xml:2, C:\Users\Gast1_000\android studio projects\GeoPicture\app\build\exploded-aar\com.google.android.gms\play-services\4.3.23\AndroidManifest.xml:3] Main manifest has &lt;uses-sdk android:minSdkVersion='8'&gt; but library uses minSdkVersion='9' Error:Execution failed for task ':app:processDebugManifest'. &gt; Manifest merging failed. See console for more info. My build.gradle: dependencies { compile 'com.android.support:support-v13:+' compile 'com.google.android.gms:play-services:4.3.+' compile 'com.google.maps.android:android-maps-utils:0.3' } Project Manifest.xml &lt;uses-sdk android:minSdkVersion="15" android:targetSdkVersion="19" /&gt; I tried to change the minSdk version manually in the manifest of the maps-utils, but with each gradle sync it chnage it back. Is there any other possiblility to add the library in AS 0.5.4?

http://stackoverflow.com/comment/35115882
score: 3
type: QuestionComment
has text: What do the arrows denote?
comment on: http://stackoverflow.com/q/22993320
type: Comment

http://stackoverflow.com/comment/35216190
type: QuestionComment
has text: In this another answer: http://stackoverflow.com/questions/23047763/write-a-program-that-prompts-the-user-to-enter-a-string-then-displays-the-total ; accept the answer which helped you more. Don't leave Questions without an answer if useful.
comment on: http://stackoverflow.com/q/23048276
score: 0
type: Comment

http://stackoverflow.com/q/23054471
type: Question
has comment: http://stackoverflow.com/comment/35227945
tagged with: jsp
tagged with: javascript
has comment: http://stackoverflow.com/comment/35227104
score: 0
has comment: http://stackoverflow.com/comment/35227850
answer count: 1
has comment: http://stackoverflow.com/comment/35281891
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23054645
has comment: http://stackoverflow.com/comment/35227892
linked to: http://stackoverflow.com/q/9788798
has body: I have done session activation and deactivation using servlets using HttpSession s = request.getSession(); s.setAttribute("uname", uname); and deactivation in logout servlet using HttpSession sess= request.getSession(); sess.invalidate(); Now I want to check in my JSP page that is session is activate or not? So for this I want this checking using JavaScript . I have method to check this using simple JSP code but I want this using JavaScript's function. So that if session is activate then I will reload same page and if session is expired then it will redirect to the login.jsp page. So I could not get any idea about it.
has title: Session checking using javascript in jsp
has comment: http://stackoverflow.com/comment/35228038
tagged with: session
tagged with: java
tagged with: servlets

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/23106123
tags question: http://stackoverflow.com/q/23071191
type: Tag
tags question: http://stackoverflow.com/q/23024107
tags question: http://stackoverflow.com/q/23095051
tags question: http://stackoverflow.com/q/23105531
tags question: http://stackoverflow.com/q/23058309
tags question: http://stackoverflow.com/q/23086424
tags question: http://stackoverflow.com/q/22973051

http://stackoverflow.com/q/23066812
favorite count: 0
has comment: http://stackoverflow.com/comment/35249830
has body: Now sorry for asking such a silly question, Now if there is a form filed &lt;form action="formServlet"&gt; number&lt;input type="text" name="num"&gt; &lt;input type="submit" value =add&gt; &lt;/form&gt; and then a request is send to servlet,where it handles it and sends a response,now my question is when it sends the response where does this out.println() of response takes it to,a page from where the request was made..or it generates a new page?? and when we send a ajax request request using get or post method,the response is send to the jquery itself?so where does this response goes?
has comment: http://stackoverflow.com/comment/35250011
downvote count: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23066904
tagged with: java
tagged with: servlets
tagged with: response
type: Question
has answer: http://stackoverflow.com/a/23066904
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/35249782
answer count: 1
has comment: http://stackoverflow.com/comment/35249812
has title: what does servlet response do

http://stackoverflow.com/a/23142506
answers question: http://stackoverflow.com/q/23129060
score: 3
has comment: http://stackoverflow.com/comment/35412020
has comment: http://stackoverflow.com/comment/35411389
downvote count: 0
has comment: http://stackoverflow.com/comment/35442358
has comment: http://stackoverflow.com/comment/35907425
has body: Re: your first query (SELECT ... FROM tableName WHERE ...) In its simplest form you could use the "Searching for a row with a specific column value" example under "Sample code" on the main Jackcess page here, i.e., Table table = DatabaseBuilder.open(new File("my.mdb")).getTable("MyTable"); Row row = CursorBuilder.findRow(table, Collections.singletonMap("a", "foo")); if(row != null) { System.out.println("Found row where 'a' == 'foo': " + row); } else { System.out.println("Could not find row where 'a' == 'foo'"); } To loop through multiple matching rows you could do something like this Table table = DatabaseBuilder.open(new File("my.mdb")).getTable("MyTable"); Cursor cursor = CursorBuilder.createCursor(table); while (cursor.findNextRow(Collections.singletonMap("a", "foo"))) { Row row = cursor.getCurrentRow(); System.out.println(String.format( "a='%s', SomeFieldName='%s'.", row.get("a"), row.get("SomeFieldName"))); } or, as @jtahlborn suggests in a comment below, Table table = DatabaseBuilder.open(new File("my.mdb")).getTable("MyTable"); Cursor cursor = CursorBuilder.createCursor(table); for (Row row : cursor.newIterable().addMatchPattern("a", "foo")) { System.out.println(String.format( "a='%s', SomeFieldName='%s'.", row.get("a"), row.get("SomeFieldName"))); } Re: your second query (SELECT ... FROM table1 INNER JOIN table2 ON ...) You could use one for or while loop (similar to above) to iterate through the relevant rows in one table, and use an inner for or while loop to iterate through the related rows in the other (related) table. If the two tables have an existing "Relationship" in Access (a.k.a. "foreign key constraint") Jackcess has a Joiner class that may be of assistance, discussed here. If you require further assistance you will need to try writing some code for yourself and then ask a new question showing the code you are attempting to use and the specific issue you have with it.
type: Answer
upvote count: 3

http://stackoverflow.com/comment/82166032
type: AnswerComment
comment on: http://stackoverflow.com/a/22990132
score: 0
type: Comment
has text: What does "payback" do here and where does it come from?

http://stackoverflow.com/comment/35533435
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23009956
has text: When running inside the application server, deployment name needs to be added, i.e. `hibernate.cache.infinispan.<warname>.<unitname>.<FQN of entity>.expiration.max_idle`. Can you try this?

http://stackoverflow.com/q/23067213
type: Question
has title: Cast generic object to generic class
accepted answer: http://stackoverflow.com/a/23137132
answer count: 2
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23137132
tagged with: android
has body: I would like to pass in a generic object into my method and have it get the property name, type, and value. Here is my class public class Login { public String token; public String customerid; public Class1 class1; public Class2 class2; public class Class1 { public Class3 class3; public String string1; public class Class3 { public int int1; public String string2; public String string3; } } public class Class2 { public int int1; public String string2; public String string3; } } I would like the output to look like this User Preferences customerid - class java.lang.String - 586969 User Preferences token - class java.lang.String - token1 User Preferences string1 - class java.lang.String - string1Value User Preferences string2 - class java.lang.String - string2Value User Preferences string3 - class java.lang.String - string3Value The code I have right now gives me issues. Here is the code: try { // Loop over all the fields and add the info for each field for (Field field : obj.getClass().getDeclaredFields()) { if(!field.isSynthetic()){ field.setAccessible(true); System.out.println("User Preferences " + field.getName() + " - " + field.getType() + " - " + field.get(obj)); } } // For any internal classes, recursively call this method and add the results // (which will in turn do this for all of that subclass's subclasses) for (Class&lt;?&gt; subClass : obj.getClass().getDeclaredClasses()) { Object subObject = subClass.cast(obj); // ISSUE addUserPreferences(subObject, prefs); } }catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); }catch(ClassCastException e) { e.printStackTrace(); } Getting the subObject, in this case Class1 or Class2, and passing it to the method is what Im having an issue with. I have tried with a class instead of an object but then I can't get the object from the class. Is there anyway to cast the object I pass in to the subclass? Thanks
tagged with: generic-programming
linked to: http://stackoverflow.com/q/709961
has answer: http://stackoverflow.com/a/23067387
downvote count: 0
possible better answer: http://stackoverflow.com/a/23067387
type: AnsweredQuestion
tagged with: reflection
score: 1
tagged with: java

http://stackoverflow.com/comment/35088523
comment on: http://stackoverflow.com/a/22977832
score: 0
type: AnswerComment
has text: If there are 100 column and I only want to find the number for the 2nd column, then how can I do. As sheetToEdit.getcolumns will take much time.
type: Comment

http://stackoverflow.com/q/23041468
upvote count: 1
tagged with: inputstream
type: Question
has body: Input file : sugar;1.2;30 milk;4.5;100 grain;3.2;200 In the output file I have to print the product with minimum and maximum price(milk and sugar). My program prints the product with the maximum price but for the minimum price it prints grain. Main class: public class Lab3 { public static void main (String[ ] args) throws IOException { double max=0, min=10000000; Product p_min=new Product("",0.0,0); Product p_max=new Product("",0.0,0); BufferedReader in=new BufferedReader (new InputStreamReader(new FileInputStream("C:\\Users\\Timotei\\Desktop\\in.txt"))); PrintStream out=new PrintStream(new FileOutputStream("C://Users//Timotei//Desktop//out.txt")); String line; while((line=in.readLine())!=null) { String[] array=line.split(";"); String name=array[0]; double price=Double.valueOf(array[1]); int quantity=Integer.valueOf(array[2]); if(price&gt;max) { max=price; p_max=new Product(name,price,quantity); } if(price&lt;min) { min=price; p_min=new Product(name,price,quantity); } } out.println("Product with maximum price is:"+p_max); System.out.println("Product with maximum price is:"+p_max); System.out.println("Product with minimum price is:"+p_min); out.println("Product with minimum price is:"+p_min); in.close(); out.close(); } } Product class: public class Product { private String name; private double price; private int quantity; public Product(String name, double price, int quantity) { this.name=name; this.price=price; this.quantity=quantity; } public Product(Product p) { p.name=name; p.price=price; p.quantity=quantity; } public String toString() { return name+" which has the price "+price+" and is present in a quantity of "+quantity; } }
accepted answer: http://stackoverflow.com/a/23041485
tagged with: arrays
has title: Product with minimum and maximum price (data is read from a text file)
answer count: 1
downvote count: 0
favorite count: 0
tagged with: io
has answer: http://stackoverflow.com/a/23041485
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: filestream

http://stackoverflow.com/q/23107179
upvote count: 1
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/23107309
tagged with: java
type: Question
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23107309
tagged with: android
has body: I have been creating an application to log and register users, in used a asynctask but think i have done it incorrelty. please see below for error messages and code 04-16 11:27:17.160: D/AndroidRuntime(31658): Shutting down VM 04-16 11:27:17.160: W/dalvikvm(31658): threadid=1: thread exiting with uncaught exception (group=0x41c4c700) 04-16 11:27:17.175: E/AndroidRuntime(31658): FATAL EXCEPTION: main 04-16 11:27:17.175: E/AndroidRuntime(31658): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.applicationnfclogin/com.applicationnfclogin.DashboardActivity}: android.view.InflateException: Binary XML file line #92: Error inflating class progressbar 04-16 11:27:17.175: E/AndroidRuntime(31658): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295) 04-16 11:27:17.175: E/AndroidRuntime(31658): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349) 04-16 11:27:17.175: E/AndroidRuntime(31658): at android.app.ActivityThread.access$700(ActivityThread.java:159) 04-16 11:27:17.175: E/AndroidRuntime(31658): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316) 04-16 11:27:17.175: E/AndroidRuntime(31658): at android.os.Handler.dispatchMessage(Handler.java:99) 04-16 11:27:17.175: E/AndroidRuntime(31658): at android.os.Looper.loop(Looper.java:176) 04-16 11:27:17.175: E/AndroidRuntime(31658): at android.app.ActivityThread.main(ActivityThread.java:5419) 04-16 11:27:17.175: E/AndroidRuntime(31658): at java.lang.reflect.Method.invokeNative(Native Method) 04-16 11:27:17.175: E/AndroidRuntime(31658): at java.lang.reflect.Method.invoke(Method.java:525) 04-16 11:27:17.175: E/AndroidRuntime(31658): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046) 04-16 11:27:17.175: E/AndroidRuntime(31658): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) 04-16 11:27:17.175: E/AndroidRuntime(31658): at dalvik.system.NativeStart.main(Native Method) 04-16 11:27:17.175: E/Android…
has title: Android crashing when operning

http://stackoverflow.com/q/23005929
has answer: http://stackoverflow.com/a/23006029
answer count: 3
accepted answer: http://stackoverflow.com/a/23006029
downvote count: 0
has answer: http://stackoverflow.com/a/23006011
favorite count: 0
has body: Suppose, I have static setter and getter like: private static List&lt;String&gt; result = new ArrayList&lt;String&gt;(); public static void setResult(String result) { result.add(result); } public static List&lt;String&gt; getResult() { return result; } public static void clearResult() { result.clear(); } I want to know if setResult() is operating from a thread and getResult() is calling from different threads and clearResult() is calling from a different thread, then what will happen? Is this functions are thread safe? will getResult() return right value? One more thing, in mid while if i call clearResult() and thread which continiuos checking getResult(), will it get right value?? if not then what should i do??
tagged with: static
has title: Thread safe for static function
has answer: http://stackoverflow.com/a/23006032
tagged with: multithreading
tagged with: android
possible better answer: http://stackoverflow.com/a/23006011
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/18873547
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35138675
tagged with: thread-safety
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35141073
linked to: http://stackoverflow.com/q/1431681

http://stackoverflow.com/comment/35206138
has text: @Ordous: it looks like the posted code doesn't insert a person in the array when the comparison is 0. So a TreeSet would do fine.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23043071

http://stackoverflow.com/a/23063562
has comment: http://stackoverflow.com/comment/35246600
has comment: http://stackoverflow.com/comment/35246915
type: Answer
has comment: http://stackoverflow.com/comment/35244489
has comment: http://stackoverflow.com/comment/35246261
has comment: http://stackoverflow.com/comment/35245676
has comment: http://stackoverflow.com/comment/35244674
has comment: http://stackoverflow.com/comment/35245549
has comment: http://stackoverflow.com/comment/35247340
has comment: http://stackoverflow.com/comment/35245031
has body: I can't really tell what you're trying to do, but I think this is a case of wrong tool for the job. JSoup is an html parser, and doesn't actually run pages. You'll want to use Selenium if you're trying to automate browsing a website.
score: 0
answers question: http://stackoverflow.com/q/23063175

http://stackoverflow.com/q/23049239
tagged with: recursion
has body: Here is the part of code of the binary tree class that I'm writing. class Node&lt;T&gt; { private T value; private Node&lt;T&gt; left; private Node&lt;T&gt; right; public T getValue() { return value; } public void setValue(T value) { this.value = value; } public Node&lt;T&gt; getLeft() { return left; } public void setLeft(Node&lt;T&gt; left) { this.left = left; } public Node&lt;T&gt; getRight() { return right; } public void setRight(Node&lt;T&gt; right) { this.right = right; } public Node() {} public Node(T value) { this.value = value; } public Node(T value, Node&lt;T&gt; left, Node&lt;T&gt; right) { this.value = value; this.left = left; this.right = right; } } import java.util.*; public class Tree&lt;T extends Comparable&lt;T&gt;&gt; { private Node&lt;T&gt; root; private List&lt;T&gt; levelOrderList = new ArrayList&lt;T&gt;(); public Node&lt;T&gt; getRoot() { return root; } public Tree() { } public Tree(Node&lt;T&gt; root) { this.root = root; } private List&lt;T&gt; getLevelOrderList(Node&lt;T&gt; root){ if (root == null) return Collections.emptyList(); Queue&lt;Node&lt;T&gt;&gt; level = new LinkedList&lt;Node&lt;T&gt;&gt;(); level.add(root); while(!level.isEmpty()){ Node&lt;T&gt; node = level.poll(); levelOrderList.add(node.getValue()); if(node.getLeft() != null) level.add(node.getLeft()); if(node.getRight() != null) level.add(node.getRight()); } return levelOrderList; } public List&lt;T&gt; getLevelOrderList() { return getLevelOrderList(root); } } The method getLevelOrderList() returns list of elements in tree in level by level order. The question is: how to rewrite method getLevelOrderList using recursion?
tagged with: java
has comment: http://stackoverflow.com/comment/35218100
has comment: http://stackoverflow.com/comment/35217785
type: Question
tagged with: tree-traversal
answer count: 1
tagged with: binary-tree
score: 0
has title: Level traversal in binary tree
has answer: http://stackoverflow.com/a/23049556
has comment: http://stackoverflow.com/comment/35217855
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/19964048

http://stackoverflow.com/comment/42943117
has text: I am in the same situation my friend, if you end up knowing how to do this kind of navigation i would really appreciate you to post it and tell me pleasee, thanks
comment on: http://stackoverflow.com/q/23036778
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35361062
comment on: http://stackoverflow.com/q/23129212
score: 0
type: Comment
type: QuestionComment
has text: [When are API methods marked “deprecated” actually going to go away?](http://stackoverflow.com/q/314540/3309790) may help you.

http://stackoverflow.com/comment/51297101
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25245051
type: Comment
has text: This is the maven-ear-plugin documentation: https://maven.apache.org/plugins/maven-ear-plugin/ear-mojo.html . There we can see that src/main/application is the default value for the earSourceDirectory configuration.

http://stackoverflow.com/comment/35214014
type: Comment
type: QuestionComment
has text: Check your boolean array, as it has a length of three. In your loop, check to see what `i` is in your `if` statement where you have `!collapsed[i+1]`. A debugger will help immensely in this case. Additionally, you have the line where the exception is being thrown, according to your stack trace.
comment on: http://stackoverflow.com/q/23047192
score: 0

http://stackoverflow.com/comment/35104183
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22986878
has text: NO I DONT KNOW ABOUT SETFILTERTEXT i used settext but it got error and changed automatically so i am asking whether it is correct or wrong what i should write there instead of setfiltertext @HannoBinder pls help me
score: 0

http://stackoverflow.com/comment/35099693
type: AnswerComment
score: 0
type: Comment
has text: How do i pass the values as parameters in getDiff()?? And wht does the array I should create look like?? The one I had created is the one that was giving me zeros.
comment on: http://stackoverflow.com/a/22984076

http://stackoverflow.com/comment/35089823
comment on: http://stackoverflow.com/a/22978514
type: AnswerComment
score: 0
has text: You are welcome. If you are doing this for a real time project then try to use stored procedure. Learning curve is there but it is much better than embedded query.
type: Comment

http://stackoverflow.com/comment/35127625
comment on: http://stackoverflow.com/q/22999256
score: 0
type: Comment
type: QuestionComment
has text: This question doesn't have much to do with progress bars.

http://stackoverflow.com/comment/35204503
type: Comment
comment on: http://stackoverflow.com/a/23041376
has text: I still dont quite understand. I declared `inputFile` as a `BufferedImage` and initialised it as `null` then used `inputFile = ImageIO.read(new File(args[0]));` within the try-catch statement to read in the file from command line. So how do I use the second variable `inputImage`???
type: AnswerComment
score: 0

http://stackoverflow.com/a/23047776
has comment: http://stackoverflow.com/comment/35264594
type: Answer
answers question: http://stackoverflow.com/q/23047716
has comment: http://stackoverflow.com/comment/35221526
has comment: http://stackoverflow.com/comment/35215869
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35264670
has comment: http://stackoverflow.com/comment/35215593
upvote count: 1
has comment: http://stackoverflow.com/comment/35218023
has body: You don't have constructors explicitly for Activties. You don't instantiate a Activity class. You only declare the Activity in manifest file. Please read the answer by Raghav Sood And i quote Raghav By treating an Activity as a normal Java class, you end up with a null context. As most methods in an Activity are called on its Context, you will get a null pointer exception, which is why your app crashes. Can i Create the object of a activity in other class?

http://stackoverflow.com/q/23082445
tagged with: java
tagged with: hibernate
has title: How to Load Collection in hibernate which fetch type is Lazy?
has body: I am using Hibernate, Spring and Dozer in my project . My Problem is that that I am unable to Load Lazy fetching Collection(List). I am using Dozer to convert entity class into (Dto) class. I think Dozer user Know these things. When I debug then I get all data from DB in entity class but when I converted into Dto through Dozer I get null in Collection which is Lazy Fetched. Please help me out here. Thanks in advance! I am unable to get Developer List when I Converted entity to Dto. I have exact Dto classes name Developer and Founder and I map these in String Configuration File. I tried @Select On join table then its loaded and working fine but I don't want that way . If I have to make extra function in my servicemanager class then help me . @Entity @Table(name = "table") public class Founder { @Id @Column(name = "foun_id") @GeneratedValue(generator = "uuid") private String id; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, optional = false) @JoinColumn(name = "reg_address_id") private Address registeredAddress; @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinTable(name = "jointable", joinColumns = { @JoinColumn(name = "foun_id", nullable = false) }, inverseJoinColumns = { @JoinColumn(name = "dev_id", nullable = true) }) private List&lt;Developer&gt; developer; public String getId() { return id; } public void setId(String id) { this.id = id; } public Address getRegisteredAddress() { return registeredAddress; } public void setRegisteredAddress(Address registeredAddress) { this.registeredAddress = registeredAddress; } public List&lt;Developer&gt; getDeveloper() { return developer; } public void setDeveloper(List&lt;Developer&gt; developer) { this.developer = developer; } } @Entity @Table(name = "tbl") public class Developer { @Id @Column(name = "dev_id") @GeneratedValue(generator = "uuid") private String id; @Column(name = "file_number") private String fileNumber; @Column(name = "flat_info") private String flatInfo; @OneToOne(fetch =…
type: Question
tagged with: lazy-initialization
has comment: http://stackoverflow.com/comment/35279444
downvote count: 0
linked to: http://stackoverflow.com/q/12370339
answer count: 1
has answer: http://stackoverflow.com/a/23083420
has comment: http://stackoverflow.com/comment/35277903
tagged with: dozer
favorite count: 0
upvote count: 2
tagged with: lazy-loading
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23083420

http://stackoverflow.com/comment/35180143
has text: From my understanding, a JPanel would always return 0 width without a component listener, is this true? Do you mean I should use getWidth() wherever I need to get the width, rather than storing it as a variable?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23028335
type: AnswerComment

http://stackoverflow.com/a/23061605
score: 0
answers question: http://stackoverflow.com/q/23061544
type: AcceptedAnswer
has body: From your comment and tools:context="com.example.symbol_temp.MainActivity$PlaceholderFragment" I assume that the views belong to fragment_main.xml. You inflate the wrong layout. And you are looking for the view in the wrong layout. Change this setContentView(R.layout.activity_main); to setContentView(R.layout.fragment_main); Also change this Integer counter=0; to int counter; // primitive data type @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); counter =0;
type: Answer
has comment: http://stackoverflow.com/comment/35240021
has comment: http://stackoverflow.com/comment/35240194
accepted answer of: http://stackoverflow.com/q/23061544

http://stackoverflow.com/a/23074878
score: 0
has comment: http://stackoverflow.com/comment/35310503
answers question: http://stackoverflow.com/q/23035512
type: Answer
has body: Your problem may actually be that Nutch isn't crawling your PDF or is truncating it because of its size. Make sure you have set the file.content.limit and http.content.limit properties in nutch-site.xml to appropriate values. You can set it to -1 to accept any file size.

http://stackoverflow.com/q/23045704
has title: Any way to store a tree datastructure in a text file for reuse
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23046149
answer count: 1
downvote count: 0
tagged with: huffman-code
favorite count: 0
tagged with: binary-tree
type: UnansweredQuestion
has body: abstract class HuffmanTree1 implements Comparable&lt;HuffmanTree1&gt; { public final int frequency; public HuffmanTree1(int freq) { frequency = freq; } public int compareTo(HuffmanTree1 tree) { return frequency - tree.frequency; } } class HuffmanLeaf1 extends HuffmanTree1 { public final char value; public HuffmanLeaf1(int freq, char val) { super(freq); value = val; } } class HuffmanNode1 extends HuffmanTree1 { public final HuffmanTree1 left, right; public HuffmanNode1(HuffmanTree1 l, HuffmanTree1 r) { super(l.frequency + r.frequency); left = l; right = r; } } public class SimpleHuffmanCode { static int ctr=0; static String[] s=new String[50]; public static HuffmanTree1 buildTree(int[] charFreqs) { PriorityQueue&lt;HuffmanTree1&gt; trees = new PriorityQueue&lt;HuffmanTree1&gt;(); for (int i = 0; i &lt; charFreqs.length; i++) if (charFreqs[i] &gt; 0) trees.offer(new HuffmanLeaf1(charFreqs[i], (char)i)); assert trees.size() &gt; 0; while (trees.size() &gt; 1) { HuffmanTree1 a = trees.poll(); HuffmanTree1 b = trees.poll(); trees.offer(new HuffmanNode1(a, b)); } return trees.poll(); } public static void main(String[] args) throws IOException { File file = new File("test.txt"); int c[]=count_freq(file); HuffmanTree1 tree = buildTree(c); } In the test.txt file suppose i have a string "hello world". Now i have calculated frequency of each character and then created a huffman tree. Now how can i store thr huffman tree in atext file to be used in any other program?? Any suggestions..
score: 1
tagged with: file
upvote count: 1

http://stackoverflow.com/comment/35245439
comment on: http://stackoverflow.com/q/23064385
has text: I don’t know which error this is, how `java.sql` works, or which SQL you’re using. Try `WHERE menuName LIKE (? || '%')`, though.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35194064
has text: Just wanted to share that I finally figured it out. Had a hard time with the imports and Fragment Manager, but I finally got it. Thanks for the assist
comment on: http://stackoverflow.com/a/23023169
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23010370
has comment: http://stackoverflow.com/comment/35152539
tagged with: maven
tagged with: emma
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/35152452
has title: Building with emma maven project with a local repository
has comment: http://stackoverflow.com/comment/35152525
has body: I have the following layout ThinClientManager |- src | |- *source projects* |- repo | |- com | |- example | |-*folders for maven created libraries. which contain the jar files required* |- target |- pom.xml If I try to build the project from Jenkins, it does not find the packages declared within the Jar files in repo/com/example If I try to run mvn emma:emma here is the output. I cannot find any code coverage reports within the target directory, apart from coverage.em [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building ThinClientManager 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> emma-maven-plugin:1.0-alpha-3:emma (default-cli) @ ThinClientManager >>> [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ThinClientManager --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 15 resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ ThinClientManager --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- emma-maven-plugin:1.0-alpha-3:instrument (default-cli) @ ThinClientManager -- - [INFO] Instrumenting classes with EMMA processing instrumentation path ... instrumentation path processed in 438 ms [51 class(es) instrumented, 18 resource(s) copied] metadata merged into [O:\Sources\GroupAPT\Workplace\AdminTools\ThinClientManager\target\coverage.em] {in 98 ms} [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ThinClientManager --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory O:\Sources\GroupAPT\Workplace\AdminTools\ThinClientManager\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompi…
has comment: http://stackoverflow.com/comment/35192994
tagged with: repository
answer count: 0
tagged with: code-coverage
type: UnansweredQuestion

http://stackoverflow.com/a/23055714
has body: You will need an Applet Context (get it by calling getAppletContext() in your Applet) (see this SO answer). There, you can call getApplets() to get an Enumeration of all Applets.
accepted answer of: http://stackoverflow.com/q/23055245
score: 0
answers question: http://stackoverflow.com/q/23055245
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/35352145
type: AnswerComment
has text: @user3542369, that doesn't sounds correct, the while loop you have in the `PlaceFruit()` method should prevent that. Is it possible that part of your play area is not being displayed? I've noticed that when I run the game there appears to be about 1 rows and 2 columns that are not displayed.
type: Comment
comment on: http://stackoverflow.com/a/23117856
score: 0

http://stackoverflow.com/comment/35172121
comment on: http://stackoverflow.com/q/23022912
type: Comment
type: QuestionComment
score: 0
has text: Such an answer would be too broad for this site.

http://stackoverflow.com/q/23038936
tagged with: fractals
has body: It is calculation function code. I heard "escape" should be 4(2^2). because if (z_r*z_r + z_i*z_i) is smaller than 4 it won't go infinity. but in this code escape is 1025^2. why ? why 1025^2? function computeRow(task) { var iter = 0; //iteration var c_i = task.i; // var max_iter = task.max_iter; // = 1024 var escape = task.escape * task.escape; //task.escape=1025 task.values = []; for(var i = 0; i &lt;task.width;i++) { var c_r = task.r_min+(task.r_max - task.r_min) * i/ task.width; var z_r = 0, z_i = 0; for(iter = 0; z_r*z_r + z_i*z_i &lt; escape &amp;&amp; iter &lt; max_iter; iter++) { // z-&gt;z^2 + c ▲ i wonder about this var tmp = z_r*z_r - z_i*z_i + c_r; z_i = 2*z_r*z_i+c_i; z_r = tmp; } if(iter == max_iter) { iter = -1; } task.values.push(iter); } return task;}
has answer: http://stackoverflow.com/a/29733749
score: 0
answer count: 1
has title: I can't understantd something about mandelbrot fractal code
has comment: http://stackoverflow.com/comment/35201090
linked to: http://stackoverflow.com/q/9253208
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/29733749
linked to: http://stackoverflow.com/q/10690224
tagged with: mandelbrot
has comment: http://stackoverflow.com/comment/35201103
tagged with: javascript

http://stackoverflow.com/a/23033262
accepted answer of: http://stackoverflow.com/q/23033157
has body: You're printing a reference to the object rand. You can either print out the random number like below: public class Randomization { public static void main (String[] args) { Random rand = new Random(); System.out.println(rand.nextInt(11)); } } Or you can store it in an int before printing: public class Randomization { public static void main (String[] args) { Random rand = new Random(); int randomNumber = rand.nextInt(11); System.out.println(randomNumber); } } Either should work fine.
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23033157
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35230433
has text: @Rehena you are welcome.If you find any problems in java then you can drop me a mail and I will try to help you
type: Comment
comment on: http://stackoverflow.com/a/23053447
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35254417
type: Comment
score: 0
has text: true...Options field was not getting inserted into mongo db.how do i insert the array of choices in to mongo db using java??
type: AnswerComment
comment on: http://stackoverflow.com/a/23067952

http://stackoverflow.com/comment/35318984
comment on: http://stackoverflow.com/a/23103937
score: 0
type: AnswerComment
type: Comment
has text: @kaze Think just a second about the second solution: Are you going to call `someMethod` from outside `className`? If that is the case, wich parameter would you pass to it?

http://stackoverflow.com/q/23044208
tagged with: android
has body: here is my java file. cant seem to find the answer on how to execute a post request method Please teach me on how to make this work. Thanks. i need to post request on a cgi script while using onClickListener. package com.example.miraapp; import java.io.IOException; import java.net.URI; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageButton; import android.widget.Toast; public class GUI extends Activity implements OnClickListener{ ImageButton IB1; ImageButton IB2; ImageButton IB3; ImageButton IB4; public URI[] urls; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_gui); IB1 = (ImageButton) findViewById(R.id.imageButton1); IB1.setOnClickListener(this); IB2 = (ImageButton) findViewById(R.id.imageButton2); IB2.setOnClickListener(this); IB3 = (ImageButton) findViewById(R.id.imageButton3); IB3.setOnClickListener(this); IB4 = (ImageButton) findViewById(R.id.imageButton4); IB4.setOnClickListener(this); } class RequestTask extends AsyncTask&lt;String, String, String&gt;{ @Override protected String doInBackground(String... params) { postData(); return null; } public void postData() { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("10.0.0.1/cgi-bin/ForwardPress.cgi"); try { // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block } public void ibutton4Click() { try { // Execute HTTP Post Request HttpResponse res…
accepted answer: http://stackoverflow.com/a/23045348
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23045348
has comment: http://stackoverflow.com/comment/35208479
type: Question
has comment: http://stackoverflow.com/comment/35208430
score: 0
answer count: 1
has title: please help me in my AsyncTask class
tagged with: android-asynctask

http://stackoverflow.com/q/23095793
type: Question
has comment: http://stackoverflow.com/comment/35388645
has comment: http://stackoverflow.com/comment/35303356
upvote count: 5
has comment: http://stackoverflow.com/comment/35303331
has comment: http://stackoverflow.com/comment/35313947
tagged with: date
answer count: 2
tagged with: retrofit
score: 5
has title: Custom gson deserializer for Date never gets called
has comment: http://stackoverflow.com/comment/35302930
has comment: http://stackoverflow.com/comment/35303418
downvote count: 0
has comment: http://stackoverflow.com/comment/35302719
has comment: http://stackoverflow.com/comment/35302998
favorite count: 0
has comment: http://stackoverflow.com/comment/35340011
tagged with: serialization
type: UnansweredQuestion
has body: As far as I can tell, gson does not automatically serialize and deserialize java.util.Date objects into ISO strings like "yyyy-MM-ddTHH:mm:ssZ" or for example "2014-04-15T18:22:00-05:00". So in order for me to communicate dates properly between my client (using Retrofit with gson) and server, I need to specify the DateFormat to gson. Here is what I've done: // code defining the creation of a RestAdapter // ... new GsonBuilder() .setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ") .create() Adding the .setDateFormat line was enough to get gson to properly deserialize timestamp strings into Date objects. However, it did not serialize Date objects into timestamp strings. So I assumed that I would have to create a custom serializer like so: // code defining the creation of a RestAdapter // ... new GsonBuilder() .setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ") .registerTypeAdapter(Date.class, new DateSerializer()) .create() and the DateSerializer class: class DateSerializer implements JsonSerializer&lt;Date&gt; { @Override public JsonElement serialize(Date arg0, Type arg1, JsonSerializationContext arg2) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US); return new JsonPrimitive(df.format(arg0)); } } Unfortunately, the serialize function is ignored. Instead gson formats the date as a string like "Tues Mar 15 18:22:00 EST 2014". So to test, I tried replacing the serialize function with: public JsonElement serialize(Date arg0, Type arg1, JsonSerializationContext arg2) { throw new RuntimeException("Serialize function called!"); } But of course that RuntimeException is never thrown. Does anyone know why my serialize function is ignored? I think I read somewhere that for some types a registerTypeAdapter will be ignored if there is one defined for a superclass, but since this is java.util.Date I would be confused if that was the problem. I'm probably just doing something stupid, but I probably don't know Date or gson well enough to realize it. EDIT: Provided more co…
has answer: http://stackoverflow.com/a/31842701
has answer: http://stackoverflow.com/a/67178324
tagged with: java
tagged with: gson
has comment: http://stackoverflow.com/comment/35383572
has comment: http://stackoverflow.com/comment/35303040

http://stackoverflow.com/comment/35221826
score: 0
has text: @NiklasB. uhm agree, will need to handle some tricky cases here, as expected from a geometry problem :)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23051419

http://stackoverflow.com/comment/35529225
score: 0
type: Comment
type: QuestionComment
has text: No worries, glad you found the problem. :D
comment on: http://stackoverflow.com/q/23057033

http://stackoverflow.com/a/23076977
answers question: http://stackoverflow.com/q/23076120
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/35269154
score: 3
has body: When in doubt about exceeding object responsabilities. There is a concept related to SRP, cohesion, which is quite objective. In Konamiman's answer, the GameManager is 100% cohesive. It means all dependencies (instance fields) are used in all public methods. 0% would be the opposite: class GameManager { private int anInt; private object aObj; public void Foo() { // Do anything but using anInt or aObj } } If you find several cohesive components inside your object: class GameManager { private T1 obj1; private T2 obj2; public void Foo() { T1.F1(); } public void Goo() { T2.G1(); } } The class should be split in two: class GameManagerFoo { private T1 obj1; public void Foo() { T1.F1(); } } class GameManagerGoo { public void Goo() { T2.G1(); } } Nice point @Jackl56: About property setters and getters you have 2 options. You could not take them into account or you could consider they lower your cohesion but to an acceptable level.
downvote count: 0

http://stackoverflow.com/q/22986673
type: AnsweredQuestion
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35107284
has body: I have this error popping up. Error:java: Cannot find JDK '' for module 'appcompatV7' I cant work out why its happening, im using compatibility library and added it in the project structure. Selected it as "Library module" and added as module dependency. Its working fine on another project with exactly the same set up.
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22988831
has answer: http://stackoverflow.com/a/22988831
has answer: http://stackoverflow.com/a/22989648
answer count: 2
has title: Cannot find JDK '<unknown>' for module 'appcompatV7'
downvote count: 0
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35104248
accepted answer: http://stackoverflow.com/a/22989648

http://stackoverflow.com/a/23093135
has comment: http://stackoverflow.com/comment/35303524
has comment: http://stackoverflow.com/comment/35346304
has body: The PKCS#11 provider only will ask for PIN when it is required. And it is only required per operation if the CKA_ALWAYS_AUTHENTICATE flag is set for the token key that is being used. To allow for a user PIN to be entered, a callback handler has to be implemented according to the PKCS#11 provider documentation.
downvote count: 0
has comment: http://stackoverflow.com/comment/35338746
upvote count: 2
has comment: http://stackoverflow.com/comment/35338480
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23091859
has comment: http://stackoverflow.com/comment/35314333

http://stackoverflow.com/q/23055168
has comment: http://stackoverflow.com/comment/35253050
tagged with: java
score: 0
has body: Following is my code. When I recorded it and ran it in eclipse, it was initially successful; but after one day I ran the same test case, and now it fails. Suggest to me what and where to modify my test so it will run properly. package testing; import java.util.regex.Pattern; import java.util.concurrent.TimeUnit; import org.junit.*; import static org.junit.Assert.*; import static org.hamcrest.CoreMatchers.*; import org.openqa.selenium.*; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.Select; public class Men_Testing { private WebDriver driver; private String baseUrl; private boolean acceptNextAlert = true; private StringBuffer verificationErrors = new StringBuffer(); @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://staging.vfitshoes.com/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public void testUntitled() throws Exception { driver.get(baseUrl + "/"); driver.findElement(By.cssSelector("li.doright &gt; a")).click(); driver.findElement(By.id("email")).clear(); driver.findElement(By.id("email")).sendKeys("8803477"); driver.findElement(By.linkText("Sign-In")).click(); driver.findElement(By.cssSelector("#category &gt; li &gt; a")).click(); driver.findElement(By.id("dolist")).click(); new Select(driver.findElement(By.id("select-sort"))).selectByVisibleText("Price Low To High"); new Select(driver.findElement(By.id("select-sort"))).selectByVisibleText("Price High To Low"); new Select(driver.findElement(By.id("select-sort"))).selectByVisibleText("Shoe Name A to Z"); new Select(driver.findElement(By.id("select-sort"))).selectByVisibleText("Shoe Name Z to A"); new Select(driver.findElement(By.id("no-on-page"))).selectByVisibleText("40"); new Select(driver.findElement(By.id("no-on-page"))).selectByVisibleText("60"); new Select(driver.findElement(By.id("no-on-page"))).selectByVisibleText("100"); driver.findElement(B…
type: UnansweredQuestion
has title: Test case after one day in selenium webdriver
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/35228552
answer count: 0
tagged with: selenium
type: Question

http://stackoverflow.com/a/23117673
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23117506
answers question: http://stackoverflow.com/q/23117506
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35341026
upvote count: 1
has body: You need the code: Hello_World greet = new Hello_World(); greet.go(); in a main method, which is the point of execution of a java program. http://csis.pace.edu/~bergin/KarelJava2ed/ch2/javamain.html
type: Answer

http://stackoverflow.com/comment/35197297
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23037802
score: 0
has text: Open as if it was a zip file (Open With > 7-Zip or whatever, on Windows). You will be able to see the .war content. Look for `RemoteService.class`. Edit: @Braj comment is the way to go.

http://stackoverflow.com/comment/35154265
type: Comment
has text: no I have just have a listview with clickable cells and 1 button per cell
type: QuestionComment
comment on: http://stackoverflow.com/q/23013889
score: 0

http://stackoverflow.com/comment/35161459
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23005940
type: AnswerComment
has text: Ohhhhh. So if I put return instead of break, it will exit both of the loop? I thought about that too but I thought even if I put return it would still go back through everything. Thank you very much!

http://stackoverflow.com/comment/35325899
has text: what is a solution.i want to split string.for example if i have 02:17 i want to recive 2* 60 +17
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23109869

http://stackoverflow.com/a/23040355
accepted answer of: http://stackoverflow.com/q/23039330
answers question: http://stackoverflow.com/q/23039330
upvote count: 1
score: 1
has body: That depends on how you initially stored the integer value in the NDEF record's payload. Converting to/from textual representation of the integer Convert integer to record payload: int myInteger = ...; String payloadString = Integer.toString(myInteger); byte[] payload = payloadString.getBytes("US-ASCII"); Convert record payload to integer: byte[] payload = ...; String payloadString = new String(payload, "US-ASCII"); int myInteger = Integer.parseInt(payloadString); Direct conversion between integer and byte array (more efficient in terms of storage) Convert integer to record payload: int myInteger = ...; ByteBuffer buffer = ByteBuffer.allocate(4); buffer.putInt(myInteger); byte[] payload = buffer.array(); Convert record payload to integer: byte[] payload = ...; ByteBuffer buffer = ByteBuffer.wrap(payload); int myInteger = buffer.getInt();
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/23049596
tagged with: android-download-manager
has answer: http://stackoverflow.com/a/23066182
has comment: http://stackoverflow.com/comment/35247450
upvote count: 1
accepted answer: http://stackoverflow.com/a/23066182
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35218571
type: Question
downvote count: 0
has body: I´m having issues trying to download files from the server on a WebView based app. This code actually works on a Galaxy S4 with android 4.4.2 but doesn't work on a Nexus 5 with the same version of Android. @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.toLowerCase().contains("video") || url.toLowerCase().contains("mp4")) { String cookie = CookieManager.getInstance().getCookie(url); DownloadManager mdDownloadManager = (DownloadManager) MainActivity.this .getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); request.addRequestHeader("Cookie", cookie); request.setDescription(getString(R.string.download_video)); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); request.setTitle(getString(R.string.app_name)); Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).mkdirs(); request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, getFileName(url)); request.setMimeType("video/mp4"); mdDownloadManager.enqueue(request); } webViewPreviousState = PAGE_REDIRECTED; view.loadUrl(appendAndroidClientIdentification(url)); return true; } Inspecting the logs found this while trying to download a file via the Nexus 5 device: I/DownloadManager﹕ Download 1755 starting W/DownloadManager﹕ Aborting request for download 1755: can't know size of download, giving up I/DownloadManager﹕ Download 1755 finished with status CANNOT_RESUME Answer: The issue was on the server side. I was using the method send_data from rails. This method doesn't send the ContentLength in the headers and this is the reason of the error in some devices. To fix this just add to the application.rb file : config.middleware.use Rack::ContentLength
tagged with: download-manager
has title: Android Download Manager - can't know size of download
tagged with: android
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35248479

http://stackoverflow.com/q/23035937
answer count: 3
upvote count: 1
has title: Adding an object to an array of objects
accepted answer: http://stackoverflow.com/a/23036038
favorite count: 0
has answer: http://stackoverflow.com/a/23036038
tagged with: object
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23036044
has answer: http://stackoverflow.com/a/23036044
has body: I'm trying to add a new Entry object to an array of objects. I don't know how I would go about writing a method to do this. Also I'd like to increase the size of the array as new elements are added to it. public class Entry { private String surname, initial, extension; public Entry() { } public Entry(String surname, String initial, String extention) { this.surname = surname; this.initial = initial; this.extension = extention; } } I want to write the method to add the elemets to the array here. The new Entry object is currently hard coded but this will obviously be altered. public class ArrayDirectory implements Directory { Entry[] entries = new Entry[4]; public void addEntry(Entry newEntry) { newEntry = new Entry("isajas","ssds", "sasdas"); } } Thank you for taking the time to read my question!
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/23035970
has comment: http://stackoverflow.com/comment/35193618

http://stackoverflow.com/q/23126504
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/6609373
tagged with: gesture
has title: Transfer constructed data via android Bluetooth
tagged with: bluetooth
downvote count: 0
has body: I have a data structure representing gestures event: public class GestureData { private int gestureType; private float arg1; private float arg2; public GestureData (int gestureType, float arg1, float arg2) { this.gestureType = gestureType; this.arg1 = arg1; this.arg2 = arg2; } } And I'm trying to transfer this object via bluetooth, from the android to the pc. I have found the current post suggesting protobuf. Is this a good practice for this purpose?
favorite count: 0
tagged with: android-bluetooth
type: UnansweredQuestion
tagged with: android

multiprocessing
tags question: http://stackoverflow.com/q/22974274
type: Tag
tag name: multiprocessing

java-web-start
tags question: http://stackoverflow.com/q/23036995
tags question: http://stackoverflow.com/q/22970015
tags question: http://stackoverflow.com/q/23099832
type: Tag
tags question: http://stackoverflow.com/q/23008323
tag name: java-web-start

http://stackoverflow.com/a/23014298
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35154028
downvote count: 0
has comment: http://stackoverflow.com/comment/35154216
type: Answer
has comment: http://stackoverflow.com/comment/35154274
upvote count: 3
has comment: http://stackoverflow.com/comment/35154042
has comment: http://stackoverflow.com/comment/35154329
has comment: http://stackoverflow.com/comment/35174312
has comment: http://stackoverflow.com/comment/35153974
score: 3
answers question: http://stackoverflow.com/q/23014163
has comment: http://stackoverflow.com/comment/35154090
has body: just go to path : /usr/lib/(installation directory)/jdk1.6.0_33/bin/jps and find your jps, if present , if not then install jdk.
accepted answer of: http://stackoverflow.com/q/23014163

http://stackoverflow.com/q/23047758
answer count: 3
has comment: http://stackoverflow.com/comment/35215218
favorite count: 0
accepted answer: http://stackoverflow.com/a/23047848
possible better answer: http://stackoverflow.com/a/23047850
tagged with: maven
has answer: http://stackoverflow.com/a/23048344
type: AnsweredQuestion
has body: What exactly do Gradle and Maven "do" that eclipse or sts doesn't? From what I've read it builds, runs, etc which can all be done in eclipse easily. If I have an existing project I've created, built, and currently runs in eclipse via tomcat, what would I use gradle for?
has title: Trying to understand what gradle and maven actually do
downvote count: 0
has answer: http://stackoverflow.com/a/23047848
tagged with: java
has answer: http://stackoverflow.com/a/23047850
score: 6
tagged with: gradle
type: Question
upvote count: 6
tagged with: eclipse

http://stackoverflow.com/q/23019267
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23019880
tagged with: comet
has answer: http://stackoverflow.com/a/23406534
has title: GWT-comet build fails with ClassNotFoundException
score: 0
has body: I've tried to setup GWT-comet using the official guide(http://code.google.com/p/gwt-comet/wiki/GettingStarted). What I did: Add gwt-comet-1.2.3.jar to project and build path. Setup the basic client and server code. Inherit the required module. &lt; inherits name='net.zschech.gwt.comet.Comet'/&gt; The crash is obviously related to the inheriting the module. Stack trace: Loading modules com.MyApp.Test Loading inherited module 'com.MyApp.Test' Loading inherited module 'net.zschech.gwt.comet.Comet' [ERROR] Unexpected error while processing XML java.lang.NoClassDefFoundError: com/google/gwt/core/ext/GeneratorExt at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at com.google.gwt.dev.cfg.ModuleDefSchema$ClassAttrCvt.convertToArg(ModuleDefSchema.java:888) at com.google.gwt.dev.util.xml.HandlerArgs.convertToArg(HandlerArgs.java:64) at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:221) at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:294) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocum…
has answer: http://stackoverflow.com/a/23019880
tagged with: gwt
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23406534

http://stackoverflow.com/q/23028980
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35184921
tagged with: android
has answer: http://stackoverflow.com/a/23029071
tagged with: java
type: Question
score: 0
has body: I need to draw custom borders in android to all of the views on my screen. Every view will have different parameters. To do this, I thought about making new CustomBotton, CustomTextView etc. classes and redefine their onDraw() methods. But the methods will contain the same code, so it's not nice to make new classes for those Views and rewrite the same onDraw() method with the same code. Is there a more elegant/faster way to do this?
answer count: 1
has comment: http://stackoverflow.com/comment/35214961
has title: Overriding: same onDraw for many Views (Button, TextView) elements

http://stackoverflow.com/comment/132086591
score: 0
type: Comment
has text: _"Firstly null means non-existence of an instance. Providing a default constant like DEFAULT or NONE, will change that meaning."_ Not in the least. The ruleset for enums _might very sensibly have been_ an enforced non-null contract. Leaving the only choices to be either 1. something akin to `Enum.DEFAULT`, etc., when unspecified, or **2. disallowing unspecified declarations at all.** The goal of enums should have been specifically to rigidly define a domain of literals. Not have a domain of literals along with an clumsy monkywrench thrown in that you have to check for.
comment on: http://stackoverflow.com/a/23056392
type: AnswerComment

http://stackoverflow.com/a/23003124
accepted answer of: http://stackoverflow.com/q/23002876
type: Answer
score: 1
upvote count: 1
has body: Path.GetFileNameWithoutExtension() only returns the name of the file, not the full path. You end up passing the value new.docx as the second parameter to ConvertDocToDocx, not the full file path. It's probably writing it to disk somewhere, but who knows exactly where. Use Path.GetDirectoryName() to get the full directory as well: var baseFile = Path.Combine(Path.GetDirectoryName(file), Path.GetFileNameWithoutExtension(file)); ConvertDocToDocx(file, string.Concat(baseFile, ".docx"));
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23002876
downvote count: 0

http://stackoverflow.com/q/23003867
tagged with: android
accepted answer: http://stackoverflow.com/a/23004375
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35135210
has comment: http://stackoverflow.com/comment/35135334
has answer: http://stackoverflow.com/a/23003980
has title: Android - Passing an Object To Another Activity
possible better answer: http://stackoverflow.com/a/23003916
has comment: http://stackoverflow.com/comment/35135187
has answer: http://stackoverflow.com/a/23003916
type: Question
tagged with: object
tagged with: java
linked to: http://stackoverflow.com/q/7181526
has answer: http://stackoverflow.com/a/23004375
has body: I am utilizing the follow class, which I have as an object: http://pastebin.com/rKmtbDgF And I am trying to pass it across using: Intent booklist = new Intent(getBaseContext(), BookList.class); Bundle bundle = new Bundle(); bundle.putParcelable("imageManager", (Parcelable) im); booklist.putExtras(bundle); booklist.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(booklist); And I am trying to receive it using: ImageManager im = (ImageManager) getIntent().getExtras().getParcelable("imageManager"); I am getting the following error: java.lang.ClassCastException: com.example.example.ImageManager
score: 0
has comment: http://stackoverflow.com/comment/36072846
has comment: http://stackoverflow.com/comment/35135393
answer count: 3
has comment: http://stackoverflow.com/comment/35135356

http://stackoverflow.com/comment/35335039
comment on: http://stackoverflow.com/a/23114609
score: 1
has text: @PeterLawrey> Yes, always dear google :) And obviously all these books are not for nothing!
type: Comment
type: AnswerComment

http://stackoverflow.com/a/23132733
has comment: http://stackoverflow.com/comment/35389916
score: 1
upvote count: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23095646
type: AcceptedAnswer
has body: Not sure why you want to use the code from https://github.com/Rockncoder/TwitterTutorial. Why don't use use http://twitter4j.org. They have give sample example to use it. Moreover it support Twitter 1.1 as well. Just include twitter-core.jar and you are ready write your code. Hope it helps.
type: Answer
answers question: http://stackoverflow.com/q/23095646

http://stackoverflow.com/comment/35137330
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23004324
has text: Remove the property `android:onClick="item2Click"` from all your buttons in your layout.

http://stackoverflow.com/comment/35162796
score: 0
type: Comment
type: QuestionComment
has text: If I remove `in.close()` in the above code, it runs faster but then stops throwing that exception.
comment on: http://stackoverflow.com/q/23017813

http://stackoverflow.com/q/23088234
duplicate of: http://stackoverflow.com/q/215497
has comment: http://stackoverflow.com/comment/35288044
favorite count: 0
has answer: http://stackoverflow.com/a/23089102
tagged with: private
has comment: http://stackoverflow.com/comment/35288541
tagged with: package
has comment: http://stackoverflow.com/comment/35288004
has comment: http://stackoverflow.com/comment/35288483
score: -3
accepted answer: http://stackoverflow.com/a/23088353
has comment: http://stackoverflow.com/comment/35288103
has comment: http://stackoverflow.com/comment/35288025
type: AnsweredQuestion
tagged with: oop
has comment: http://stackoverflow.com/comment/35288063
tagged with: java
downvote count: 3
type: Question
has body: In Java, class A defines a member variable private int num; Class B is a subclass of class A. 1- If the two classes are in the same package - does B inherit num? 2- If the two classes are not in the same package - does B inherit num?
has title: Can a subclass access a superclass' private members?
upvote count: 0
has comment: http://stackoverflow.com/comment/35288070
has comment: http://stackoverflow.com/comment/35289282
has answer: http://stackoverflow.com/a/23088353
has comment: http://stackoverflow.com/comment/35288386
answer count: 2
linked to: http://stackoverflow.com/q/215497
possible better answer: http://stackoverflow.com/a/23089102

http://stackoverflow.com/a/22997555
has body: is there an embed EJB container I can use? The Java EE specification defines what is called Application Client Container, wich seems to be suitable for your requirement. There are several implementations, for example the one provided by Oracle or JBoss.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22994116

http://stackoverflow.com/a/23024001
has comment: http://stackoverflow.com/comment/35172880
has comment: http://stackoverflow.com/comment/35172855
upvote count: 1
type: AcceptedAnswer
has body: Use Arrays.deepToString(array);. If you're looking for something a little more "2D", then you can do this (which also works for a ragged array): for (x=0;x&lt;a.length;x++){ for (y=0;y&lt;a[x].length;y++){ System.out.printf("%d ",a[x][y]); } System.out.println(); }
accepted answer of: http://stackoverflow.com/q/23023963
answers question: http://stackoverflow.com/q/23023963
type: Answer
has comment: http://stackoverflow.com/comment/35172917
downvote count: 0
score: 1

http://stackoverflow.com/a/23109885
type: Answer
has body: I cleaned up your code a bit for you, maybe it will give you some ideas in the future public static void main(String[] args) { long endTime; long startTime = System.currentTimeMillis(); for (int i = Integer.MAX_VALUE; i &gt; 0; i--) {} endTime = System.currentTimeMillis(); long timeneeded = endTime - startTime; System.out.println(MessageFormat.format("It took {0} milliseconds to count to {1}.", timeneeded, Integer.MAX_VALUE)); } Also you were not counting to 2,147,483,646 you were counting to 2,147,483,647. Remember in your for loop you made 0 the first number to be counted so you didn't have to add an extra number. Also counting backwards is much more efficient.
answers question: http://stackoverflow.com/q/23109547
score: 0

http://stackoverflow.com/q/23096491
score: 0
has title: How do I close this JOptionPane upon clicking?
accepted answer: http://stackoverflow.com/a/23096534
answer count: 1
has body: My JOptionPane shows up just fine, but when I click the button, nothing happens. Once I click the 'X', the console will print which of the buttons was clicked. It just won't close when the button is clicked: final JOptionPane newDocWarning = new JOptionPane("Would you like to save before opening a new file?", JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_CANCEL_OPTION); final JDialog newDocDialog = new JDialog(this, "New Document", true); newDocDialog.setContentPane(newDocWarning); newDocDialog.setSize(420, 150); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); newDocDialog.setLocation(dim.width/2-newDocDialog.getSize().width/2, dim.height/2- newDocDialog.getSize().height/2); newDocDialog.setVisible(true); int value = ((Integer)newDocWarning.getValue()).intValue(); if(value == JOptionPane.YES_OPTION){ System.out.println("YES OPTION WAS CLICKED"); newDocDialog.dispose(); }else if(value == JOptionPane.NO_OPTION){ System.out.println("NO OPTION WAS CLICKED"); newDocDialog.setVisible(false); }else if(value == JOptionPane.CANCEL_OPTION){ System.out.println("CANCEL OPTION WAS CLICKED"); newDocWarning.setVisible(false); }
tagged with: joptionpane
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23096534
has comment: http://stackoverflow.com/comment/35303766
type: Question
has comment: http://stackoverflow.com/comment/35303657

http://stackoverflow.com/comment/35241787
has text: I modified the struts-config.xml as follow. Sitll not working. <forward name="success" path="first" />
comment on: http://stackoverflow.com/q/23059947
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35351193
score: 0
type: Comment
has text: I also tried to put the keylistener in the JPanel but it had no effect as well.
type: AnswerComment
comment on: http://stackoverflow.com/a/23122437

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/22971683
tags question: http://stackoverflow.com/q/22988043
type: Tag
tags question: http://stackoverflow.com/q/22997137

http://stackoverflow.com/q/23027084
tagged with: jsp
has title: How to use Spring MVC handler interceptors in Controller?
tagged with: spring-mvc
type: AnsweredQuestion
has body: I am working on Spring MVC controller project. I have a JSP page which contains certain forms and people will type certain entries in it and then press submit button. As soon as I hit this url on the browser, it will show the JSP page - http://localhost:8080/testweb/testOperation Now what I am supposed to do is - I will intercept the IP Address from the request header as soon as the above url is hit and if that IP Address is in my access list, then only I will show my actual jsp page otherwise I will show an error JSP page. And I was reading about Spring MVC Handler Interceptors here but not sure how would I implement this in my example as this is my first time with Spring MVC so confuse little bit. Now below is my code base - As soon as I hit this url on the browser - http://localhost:8080/testweb/testOperation It automatically goes to below method and then it shows me my testOperation jsp page on the browser and it works fine. @RequestMapping(value = "testOperation", method = RequestMethod.GET) public Map&lt;String, String&gt; testOperation() { final Map&lt;String, String&gt; model = new LinkedHashMap&lt;String, String&gt;(); return model; } How would I do this using Spring MVC Handler Interceptors if possible at all? Is this possible to do somehow? Below is the code I use to extract IP Address from the header - String ipAddress = request.getHeader("X-FORWARDED-FOR"); if (ipAddress == null) { ipAddress = request.getRemoteAddr(); } System.out.println(ipAddress);
has comment: http://stackoverflow.com/comment/35178417
tagged with: java
linked to: http://stackoverflow.com/q/4389224
has answer: http://stackoverflow.com/a/23027751
type: Question
accepted answer: http://stackoverflow.com/a/23027751
score: 0
answer count: 1

http://stackoverflow.com/comment/35349493
comment on: http://stackoverflow.com/a/23122468
score: 0
type: Comment
has text: the last sentence said it all
type: AnswerComment

http://stackoverflow.com/a/22991040
has comment: http://stackoverflow.com/comment/35112259
score: 0
has comment: http://stackoverflow.com/comment/35114610
answers question: http://stackoverflow.com/q/22990764
has comment: http://stackoverflow.com/comment/35113442
has comment: http://stackoverflow.com/comment/35114285
has comment: http://stackoverflow.com/comment/35112356
type: Answer
has comment: http://stackoverflow.com/comment/35113129
has comment: http://stackoverflow.com/comment/35113186
has comment: http://stackoverflow.com/comment/35114044
has comment: http://stackoverflow.com/comment/35114315
has comment: http://stackoverflow.com/comment/35113663
has body: In your proguard-project.txt file, you may need to add these lines: -keep public class * extends android.app.Activity -keep public class * extends android.content.BroadcastReceiver Also, if you extends Application or Service, you'll need these directives, too: -keep public class * extends android.app.Application -keep public class * extends android.app.Service
has comment: http://stackoverflow.com/comment/35112790
has comment: http://stackoverflow.com/comment/35113909

http://stackoverflow.com/q/22983179
type: Question
score: 0
answer count: 1
tagged with: serialization
has title: JAVA .dat seems to be reset
type: UnansweredQuestion
has body: So I have a group of serializable objects that I am storing in a single serializable object. This is saved in a hierarchy: User -> Album -> Photo (where each is serialized with a different number ) For some reason the program performs as expected when adding user and albums. However, when adding photos, everything seems to work alright until I attempt to save. At this point, I get an IOException. The strange thing is that it is the same directory as the other working configurations and I am not saving anywhere else (only 1 time). When I open the .dat file, it seems to have grown in size by around 100 lines and still exists at that spot. There is an IOexception occurring after we add a photo and then try to write the UserList to the .dat file. The only thing I can think of is that there is some sort of size limit issue? Any ideas
tagged with: java
has answer: http://stackoverflow.com/a/22983310

http://stackoverflow.com/q/23059562
tagged with: ssh
has answer: http://stackoverflow.com/a/23063289
tagged with: j2ssh
has title: How do I get rid of escape sequences when using SSHTools?
score: 0
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23063289
has body: I am using SSHTools / J2SSH to connect to a server via SSH. Everything works fine, only problem is, that the output contains strange escape sequences / characters. I read somewhere, that these are color codes and that it is not an encoding issue. Now my question is: How do I get rid of them? Seems like I need some sort of Terminal Emulation, which interprets or strips off these codes. Here is the output of ls: [0m[01;34msketchbook[0m sketchbook.tar sketchbook.tar.tar [01;32msshsudo[0m [01;34mtmp[0m tmp.tar (Note: There are other commands I need to call, so ls --color=never won’t do the job.) I tried the library Jsch before, there you can use ((ChannelShell)channel).setPty(false); to get rid of these characters, but I did not find something similar for SSHTools.
type: AnsweredQuestion
tagged with: terminal
type: Question

http://stackoverflow.com/q/23119689
possible better answer: http://stackoverflow.com/a/23129010
tagged with: android
has answer: http://stackoverflow.com/a/23129010
has answer: http://stackoverflow.com/a/23140314
type: AnsweredQuestion
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/23140314
type: Question
has body: I try to use StaggeredGridView in my new applicaiton. Everything is working fine. Now i want to add a HeaderView and a FooterView, but this gives me following error: java.lang.IllegalStateException: The content of the adapter has changed but ExtendableListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ExtendableListView(2131165194, class com.tundem.numbersreloaded.view.NumbersGridView) with Adapter(class com.etsy.android.grid.HeaderViewListAdapter)] at com.etsy.android.grid.ExtendableListView.layoutChildren(ExtendableListView.java:557) at com.etsy.android.grid.StaggeredGridView.layoutChildren(StaggeredGridView.java:358) at com.etsy.android.grid.ExtendableListView.onLayout(ExtendableListView.java:513) at android.view.View.layout(View.java:14817) at android.view.ViewGroup.layout(ViewGroup.java:4631) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525) at android.widget.LinearLayout.onLayout(LinearLayout.java:1434) at android.view.View.layout(View.java:14817) at android.view.ViewGroup.layout(ViewGroup.java:4631) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453) at android.widget.FrameLayout.onLayout(FrameLayout.java:388) at android.view.View.layout(View.java:14817) at android.view.ViewGroup.layout(ViewGroup.java:4631) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453) at android.widget.FrameLayout.onLayout(FrameLayout.java:388) at android.view.View.layout(View.java:14817) at android.view.ViewGroup.layout(ViewGroup.java:4631) at com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:374) at android.view.View.layout(View.java:14817) at android.view.ViewGroup.layout(ViewGroup.java:4631) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453) at android.widget.FrameLayout.onLayout(FrameLayout.java:388) at androi…
has title: StaggeredGridView setAdapter after addHeaderView and addFooterView
tagged with: android-custom-view
answer count: 2
score: 2
downvote count: 0
favorite count: 0
tagged with: android-asynctask
tagged with: staggered-gridview

http://stackoverflow.com/comment/35251615
score: 0
type: Comment
type: QuestionComment
has text: Ah ok, yes now i've put them into one class, would i be able to search the vector and check if say "jimmy" is highrights?
comment on: http://stackoverflow.com/q/23067398

http://stackoverflow.com/q/23113574
has comment: http://stackoverflow.com/comment/35669532
has answer: http://stackoverflow.com/a/23204323
accepted answer: http://stackoverflow.com/a/23302630
favorite count: 0
has comment: http://stackoverflow.com/comment/35449987
tagged with: soapui
has comment: http://stackoverflow.com/comment/35449653
has title: How to pass session id as part of Soap request?
score: 5
tagged with: soap
tagged with: spring
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/35663404
has answer: http://stackoverflow.com/a/23293432
has answer: http://stackoverflow.com/a/23302630
answer count: 4
tagged with: session
has comment: http://stackoverflow.com/comment/35333907
downvote count: 0
has answer: http://stackoverflow.com/a/23232661
type: Question
has body: I invoke an authentication request in order receive a session id : <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> 2342422342.dc8bizxsfapi03 2342342342342353452323 </S:Body> </S:Envelope> In the docs for the Soap API that I'm using it states : A successful login will return a session ID as an HTTP Cookie. This cookie must be passed back to all subsequent HTTP Requests that invoke API operations in order to authenticate. How is the session id passed to the next http reqeust as this is not described ? I'm assuming I need to embed the session ID within an XML tag as part of the subsequesnt request but this should be detailed in the API or is there a standard mechanism I can use ?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23204323
has comment: http://stackoverflow.com/comment/35441260

http://stackoverflow.com/q/23099975
has comment: http://stackoverflow.com/comment/35321183
answer count: 0
has body: I am trying to read a Column named EMP_NAME from a DB2 Table. It works fine for most of the records however it throws an exception for certain records in my catch block. for example i have included an image of String with a special character in it which i believe is causing the error to happn. I am not sure how can i tackle this on the Java end since resultSet.getString("EMP_NAME"); throws direct error and unable to convert it ? I am okay to convert the arrow into blank but i don't think so it is possible ? while (resultSet.next()) { String NAME = resultSet.getString("EMP_NAME"); } One of the resultSet.getString("EMP_NAME"); returns the below string from the DB2 database note there is a symbol like an arrow marked in red i beleive that is causing some record to throw the below exception Error Code: from the method getDataFromEMPHCForEmployeeDetails()----- com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][3.63.123] Caught java.io.CharConversionException. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null at com.ibm.db2.jcc.am.fd.a(fd.java:663) at com.ibm.db2.jcc.am.fd.a(fd.java:60) at com.ibm.db2.jcc.am.fd.a(fd.java:112) at com.ibm.db2.jcc.am.ic.a(ic.java:2820) at com.ibm.db2.jcc.am.ic.p(ic.java:521) at com.ibm.db2.jcc.am.ic.N(ic.java:1558) at com.ibm.db2.jcc.am.vn.e(vn.java:1147) at com.ibm.db2.jcc.am.vn.getString(vn.java:1122) at com.ibm.db2.jcc.am.vn.getString(vn.java:1698) at CreateChart.getDataFromEMPHCForEmployeeDetails(CreateChart.java:330) at CreateChart.iterateDirectReportNamesFromArrayList(CreateChart.java:594) at CreateChart.getDataFromEMPHCForDirectReport(CreateChart.java:295) at CreateChart.iterateSecondLineManagerNamesFromArrayList(CreateChart.java:562) at CreateChart.getDataFromEMPHCForSecondLine(CreateChart.java:251) at CreateChart.iterateThirdLineManagerNamesFromArrayList(CreateChart.java:533) at CreateChart.getDataFromEMPHCForThirdLine(CreateChart.java:208) at CreateChart.iterateDirectorNamesFromArrayList(CreateChart.java:506) …
type: Question
has title: Select query to a DB2 table returns an arrow like symbol in java which throws an exception?
score: 0
has comment: http://stackoverflow.com/comment/35322438
tagged with: java
tagged with: db2
type: UnansweredQuestion

nexus
type: Tag
tag name: nexus
tags question: http://stackoverflow.com/q/23112507

http://stackoverflow.com/comment/35281674
type: AnswerComment
type: Comment
has text: @GangaAloori - I have updated my answer. This is an issue with Jackson not handling the default value of the `required` attribute on the `@XmlElement` annotation correctly.
comment on: http://stackoverflow.com/a/23083038
score: 0

http://stackoverflow.com/comment/35167862
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23020201
has text: That's an interesting way to do it. That also sounds like a lot of work to get running. I guess it's too much to hope for a session.goBackToWhatYouJustWere() method.

http://stackoverflow.com/q/23068223
has comment: http://stackoverflow.com/comment/35252307
has answer: http://stackoverflow.com/a/23068251
has title: Different result of a Double Variable inside Switch Case and outside switch in jsp
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23068251
answer count: 1
tagged with: jsp
score: 0
has comment: http://stackoverflow.com/comment/35252479
has body: &lt;% String amount2="0"; amount2=request.getParameter("amount"); // out.println(amount2); // Double amount1=0.00; Double amount1=Double.parseDouble(amount2); out.println("\n Double amount is = "+amount1); Double result=0.0; String currency=request.getParameter("source"); int ch=Integer.parseInt(currency); out.println("\n selection value is "+ch); switch(ch) { case 1 : { out.println("In GBP"); result=amount1*100.70; out.println(result); } case 2 : { result=amount1*0.59; } case 3 : { result=amount1*0.043; } case 4 : { result=amount1*56.64; } case 5 : { result=amount1*54.91; } case 6: { result=amount1*60.17; } case 7: { result=amount1*52.15; } } out.println(result); %> When i Try to print the value of the result variable it shows two different results.The value printed inside the switch case is correct but when i print it outside switch then it changes. i want to know why it is happening. Is it a problem with my IDE or something else ? HElP !!

http://stackoverflow.com/q/22988147
type: Question
has answer: http://stackoverflow.com/a/22988175
score: 0
tagged with: java
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35106187
has body: I have an error when run the JUnit test public class DamActionsTester { private DamActions damAction; private final Integer defualtRelease = 50; private final Integer damCapacity = 1053; private final Integer jobDuration = 14; private WaterLog log; @Before public void newDamAtctions() throws SimulationException { damAction = new DamActions(damCapacity, defualtRelease, jobDuration, log); } in here, JUnit test says java.lang.NullPointerException at asgn1Solution.DamActions.&lt;init&gt;(DamActions.java:37) at asgn1Solution.DamActionsTester.newDamAtctions(DamActionsTester.java:23) have error such as like that. here is my part error damLog.addEntry(damCapacity/2); for that, how can I fix it to run it?
tagged with: junit
has title: JUnit test error when I run it

http://stackoverflow.com/comment/35343902
comment on: http://stackoverflow.com/q/23118911
type: Comment
has text: Which is why I said it might be a phone restriciton
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35109206
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22987029
type: AnswerComment
has text: @someone2088 And what happens when you click that message?

http://stackoverflow.com/comment/35515009
has text: Jasypt use salt(Random by default , fixed) and password to encrypt in the case of making the salt dynamic how the internal decryption take in to place.
comment on: http://stackoverflow.com/q/23074809
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/37177532
type: QuestionComment
comment on: http://stackoverflow.com/q/23020415
has text: What format is the barcode ? some contain nonprinting characters.
score: 0
type: Comment

http://stackoverflow.com/q/22994459
has answer: http://stackoverflow.com/a/22994564
has title: How to replace words instead of the whole sentence with contains and replace methods?
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22994591
possible better answer: http://stackoverflow.com/a/22994564
tagged with: replace
score: 0
tagged with: contains
tagged with: string
has comment: http://stackoverflow.com/comment/35118026
has comment: http://stackoverflow.com/comment/35117954
has answer: http://stackoverflow.com/a/22994591
has body: I've write this code but i have a problem. I want to print "Hi something else" when i write "replace something else. How can i do that? import java.util.Scanner; public class replace something { public static void main(String[] args) { Scanner cumle = new Scanner(System.in); System.out.println("Enter the sentence u want to replace :"); String str1 = cumle.next(); if (str1.contains("replace")) { str1 = str1.replace("replace", "Hi"); System.out.println("Replaced Sentence: " + str1); } else { System.out.println("Sentence doesn't contains that..."); } } }
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/23109332
favorite count: 0
has title: Execution Java -cp
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23109727
score: 1
tagged with: java
has body: I have a doubt about -cp and when should I use it. This is my scenario: I have two .java, the first one: package autos.tests.paquete; public class MainAutos { public static void main(String args[]) { int x = Integer.parseInt(args[0]); Respotar objeto1 = new Respotar (x); int mostrar = objeto1.repostar(); System.out.println(mostrar); } } And the second one: package autos.tests.paquete; public class Respotar { int gasolina; public Respotar (int gasolina) { this.gasolina=gasolina; } public int repostar (){ int gasolina = this.gasolina +20; return gasolina; } } Well, I am at root directory, and there, I have that directory: autos/tests/paquete with both .java. So I compile: javac autos/tests/paquete/*.java And execute from root directory: java autos.tests.paquete.MainAutos 10 And it works, now here go my doubts: 1) I execute with java -cp . autos.tests.paquete.Main autos 10 and the behaviour is the same. 2) I move the Respotar.class from auto/tests/paquete to another directory, I compile with java autos.tests.paquete.MainAutos 10 and it works. 3) I move the MainAutos.class from auto/tests/paquete to another directory, I compile with java autos.tests.paquete.MainAutos 10 and it says: Error: Could not find or load main class autos.tests.paquete.MainAutos 4) I compile with java -cp . autos.tests.paquete.MainAutos (I have the .class on the current directory I am compiling, so I think I have to use -cp .) and it says the same: Error: Could not find or load main class autos.tests.paquete.MainAutos Thank you in advance, I hope someone can enlighten me, regards
tagged with: classpath
type: Question
answer count: 1
downvote count: 0
tagged with: compilation
accepted answer: http://stackoverflow.com/a/23109727
tagged with: execution

http://stackoverflow.com/a/23025937
type: Answer
has body: You might want to try DocBlockr. It recognizes method parameters correctly and it lets you conveniently tab through the fields (like you do it when using Sublime snippets). But it is not flawless; it seems to have trouble with functions that return arrays, and it adds an @param block for constructors, too. I guess it depends on how much automation you want. (Type /** and press enter to trigger it. The gitHub readme has more details on how to use it)
upvote count: 14
score: 14
accepted answer of: http://stackoverflow.com/q/23025800
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23025800

http://stackoverflow.com/comment/35205494
has text: second if statement inside the deleteEntry method and the if statement inside the findEntries method
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23042655

http://stackoverflow.com/a/23838350
accepted answer of: http://stackoverflow.com/q/23063474
answers question: http://stackoverflow.com/q/23063474
type: Answer
has body: Thanks for the report. This looks like a bug. I will take care of it and probably add a better answer once we have more information about why this is happening. I have filed this bug entry JDK-8043926, to track it.
score: 20
upvote count: 21
type: AcceptedAnswer
downvote count: 1

http://stackoverflow.com/q/23041944
upvote count: 1
has body: I'm having this Exception when the textfield is empty it throws me an Exception error even though I am checking wheter its empty or not. Can you please look at the method and notify me what is wrong? private void addStaff() { ControlPanelCtr logCtr = new ControlPanelCtr(); String username = userField.getText(); String password = passField.getText(); int secLevel = Integer.parseInt(secLvField.getText()); if(userField.getText().equals("") || passField.getText().equals("") || secLvField.getText().equals("")) { notificationField.setText("All fields must be fullfiled."); } else { try{ Login usrObj = new Login(); if(usrObj.getUsername().equals(username)) { } else { Login logObj = new Login(); admLogIdField.setText(String.valueOf(logObj.getId())); logCtr.addPeople(username, password, secLevel); } } catch(Exception e) { notificationField.setText("Username already exists in the database."); Toolkit.getDefaultToolkit().beep(); } } } Thank you.
has answer: http://stackoverflow.com/a/23041992
type: Question
score: 1
tagged with: java
tagged with: database
has title: Java Throws exception errors when fields are empty
answer count: 1
has comment: http://stackoverflow.com/comment/35204049
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23041992
type: AnsweredQuestion

http://stackoverflow.com/comment/35412530
type: QuestionComment
has text: The problem was i forgot to use namedjdbctemplate and used simplejdbc instead.It is resolved.
score: 1
comment on: http://stackoverflow.com/q/23114562
type: Comment

http://stackoverflow.com/comment/35147815
type: Comment
comment on: http://stackoverflow.com/a/23008726
score: 1
type: AnswerComment
has text: @Despotars, u may make ur jFrame2 extend JDialog incase u don't want user to focus on jFrame1 until jFrame2 is closed.

http://stackoverflow.com/a/22988589
answers question: http://stackoverflow.com/q/22988284
type: Answer
upvote count: 1
score: 1
has body: You created the dialog but not showing it anywhere. Your onPreExecute() should look like: @Override protected void onPreExecute() { super.onPreExecute(); // create dialog dialog=new Dialog(context); dialog.setCancelable(true); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.pogressdialog); txtprogrss=(TextView) dialog.findViewById(R.id.txtProgress); progress=(ProgressBar)dialog.findViewById(R.id.progressBar2); btnCancel=(Button)dialog.findViewById(R.id.btnProgress); btnCancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub MyTask.this.cancel(true); dialog.dismiss(); //On button click cancel AsyncTask and dismiss dialog } }); dialog.show(); //Show the dialog } You also need to dismiss the dialog when clicked on btnCancel.
downvote count: 0

http://stackoverflow.com/comment/35119277
type: QuestionComment
has text: To achieve what @Gabe has suggested, take a look at the "Lookarounds" section in the [Stack Overflow Regular Expressions FAQ](http://stackoverflow.com/a/22944075/2736496), particularly at [`(?<=...)`:positive lookbehinds](http://stackoverflow.com/a/11197672).
comment on: http://stackoverflow.com/q/22994831
score: 0
type: Comment

http://stackoverflow.com/q/23014383
has title: element.getAttribute() returns empty String
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23014486
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23014459
upvote count: 1
has answer: http://stackoverflow.com/a/23014459
type: Question
has answer: http://stackoverflow.com/a/23014528
has body: I'm trying to access all of the elements in an XML file. Here is a portion of the file (the rest is just more chord elements) <?xml version="1.0" encoding="UTF-8"?> C E G D F A Here's my java code. It will print out everything except the attribute values, so I think that getAttribute is returning an empty string, but I'm not sure why public static void main(String [] args){ try{ File fXmlFile = new File("/home/Ryan/workspace/ChoraleGenerator/Chords.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fXmlFile); doc.getDocumentElement().normalize(); System.out.println("Root element: " + doc.getDocumentElement().getNodeName()); NodeList nList = doc.getElementsByTagName("Chord"); System.out.println("----------------------------"); for(int i = 0; i < nList.getLength(); i++){ Node nNode = nList.item(i); System.out.println("\nCurrent Element:" + nNode.getNodeName()); if(nNode.getNodeType() == Node.ELEMENT_NODE){ Element eElement = (Element)nNode; System.out.println("Chord name: " + eElement.getAttribute("name")); System.out.println("Note 1: " + eElement.getAttribute("Note1")); System.out.println("Note 2: " + eElement.getAttribute("Note2")); System.out.println("Note 3: " + eElement.getAttribute("Note3")); } } }catch(Exception e){ e.printStackTrace(); } } Finally, here is my output: Root element: Chord-List Current Element:Chord Chord name: I Note 1: Note 2: Note 3: Current Element:Chord Chord name: ii Note 1: Note 2: Note 3: Any suggestions? Thanks in advance!
accepted answer: http://stackoverflow.com/a/23014528
answer count: 3
tagged with: xml-parsing
downvote count: 0
has comment: http://stackoverflow.com/comment/35154178
favorite count: 0

http://stackoverflow.com/comment/36420530
comment on: http://stackoverflow.com/a/23116839
score: 0
type: AnswerComment
has text: Back with one more question. I want to place a view in the upper left. I'm trying to edit this code `dragHandle.setX((float) (centerX + Math.hypot(imageView.getWidth(), imageView.getHeight())/2f * newScale * Math.cos(Math.toRadians(newRotation) + Math.atan2(imageView.getHeight(), imageView.getWidth()))));` but I'm not sure how to edit it to give me the top left instead of bottom right X,Y.
type: Comment

object
tags question: http://stackoverflow.com/q/22991714
tags question: http://stackoverflow.com/q/23074480
tag name: object
tags question: http://stackoverflow.com/q/23035336
tags question: http://stackoverflow.com/q/23097176
tags question: http://stackoverflow.com/q/23003753
tags question: http://stackoverflow.com/q/23122301
tags question: http://stackoverflow.com/q/23120490
tags question: http://stackoverflow.com/q/23045361
tags question: http://stackoverflow.com/q/23049606
tags question: http://stackoverflow.com/q/23003867
tags question: http://stackoverflow.com/q/23046686
tags question: http://stackoverflow.com/q/22973112
tags question: http://stackoverflow.com/q/23029646
tags question: http://stackoverflow.com/q/23078639
tags question: http://stackoverflow.com/q/23108324
tags question: http://stackoverflow.com/q/23036670
tags question: http://stackoverflow.com/q/23126566
tags question: http://stackoverflow.com/q/23096305
tags question: http://stackoverflow.com/q/23098139
tags question: http://stackoverflow.com/q/23069397
tags question: http://stackoverflow.com/q/23025768
tags question: http://stackoverflow.com/q/23069022
tags question: http://stackoverflow.com/q/23036740
tags question: http://stackoverflow.com/q/22971653
tags question: http://stackoverflow.com/q/23069902
tags question: http://stackoverflow.com/q/23051709
tags question: http://stackoverflow.com/q/23055559
tags question: http://stackoverflow.com/q/23017162
tags question: http://stackoverflow.com/q/23120743
tags question: http://stackoverflow.com/q/23050826
tags question: http://stackoverflow.com/q/23035318
tags question: http://stackoverflow.com/q/23030280
tags question: http://stackoverflow.com/q/23035937
tags question: http://stackoverflow.com/q/23002566
tags question: http://stackoverflow.com/q/23050789
tags question: http://stackoverflow.com/q/23126951
tags question: http://stackoverflow.com/q/22975745
tags question: http://stackoverflow.com/q/23072687
tags question: http://stackoverflow.com/q/23002575
tags question: http://stackoverflow.com/q/23015326
tags question: http://stackoverflow.com/q/23078525
tags question: http://stackoverflow.com/q/23088275
tags question: http://stackoverflow.com/q/23073850
tags question: http://stackoverflow.com/q/23026711
tags question: http://stackoverflow.com/q/23025376
tags question: http://stackoverflow.com/q/23026840
tags question: http://stackoverflow.com/q/23029494
tags question: http://stackoverflow.com/q/23128165
type: Tag
tags question: http://stackoverflow.com/q/23022146
tags question: http://stackoverflow.com/q/22983408
tags question: http://stackoverflow.com/q/23024957

http://stackoverflow.com/q/23084873
favorite count: 0
type: UnansweredQuestion
tagged with: uncaught-exception
tagged with: android
has body: I have set DefaultUncaughtExceptionHandler in which i send exception message to server. And after that I want to start base activity, but I need to save all objects states (avoid using System.exit(1)), just start new Intent . Is it possible, if not - why , if yes - how?
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23085317
has title: Android: Continue work from UncaughtExceptionHandler
has answer: http://stackoverflow.com/a/23150351
answer count: 2
upvote count: 1
tagged with: android-activity

http://stackoverflow.com/comment/35190999
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23031261
score: 0
has text: No problem with the code here with "weka-3-6-10" or "weka-3-7-10". Did you give "weka-3-6-10" (the latest *stable* version) a try? Also, do you have some odd Weka `.props` files in your home directory?

http://stackoverflow.com/comment/35203020
score: 0
type: Comment
type: QuestionComment
has text: It means id is not in the bounds of the array. What is id?
comment on: http://stackoverflow.com/q/23041306

jwt
tags question: http://stackoverflow.com/q/23081693
tag name: jwt
type: Tag

http://stackoverflow.com/q/22971158
has body: I have a JLabel I'm populating it like this String descriptionText = StringEscapeUtils.escapeHtml(rule.getDescription()); descriptionText = descriptionText.replaceAll("\n", " "); descriptionLbl.setText(String.format(" %s ", descriptionText)); In this case, if rule.getDescription() returns something like "/* test */" the end result is an empty JLabel? Why is this? I thought that StringEscapeUtils#escapeHtml would have caught all the escape characters.
has comment: http://stackoverflow.com/comment/35076409
tagged with: swing
score: 2
has comment: http://stackoverflow.com/comment/35076270
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35076574
has answer: http://stackoverflow.com/a/22971400
type: Question
has title: Java JLabel, Why does " /* test */ " result in the JLabel being empty?
has comment: http://stackoverflow.com/comment/35076682
has comment: http://stackoverflow.com/comment/35076481
has comment: http://stackoverflow.com/comment/35077326
accepted answer: http://stackoverflow.com/a/22971400
has comment: http://stackoverflow.com/comment/35077529
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35076426
has comment: http://stackoverflow.com/comment/35077401
favorite count: 0
tagged with: jlabel
has comment: http://stackoverflow.com/comment/35077578
upvote count: 2
linked to: http://stackoverflow.com/q/7408160

http://stackoverflow.com/comment/35179003
type: Comment
type: QuestionComment
has text: @Kayaman wow you're kind of a jerk. Maybe you should go back to the Oracle Forums where that kind of attitude is normal and expected.
comment on: http://stackoverflow.com/q/23027432
score: 0

http://stackoverflow.com/a/23014014
has body: You could check this SO question. Maximum call stack size exceeded error Also check all the comments. Different scenarios are mentioned there. I hope this helps.
has comment: http://stackoverflow.com/comment/35155653
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23013115

http://stackoverflow.com/a/24399934
has body: we first download depend.ext to check out the dependence of mtcokus.dll, then download the specific dll and add it to your java.library.path. I met the bug when I ran JLDA, and I download the depent DLL.
answers question: http://stackoverflow.com/q/23019254
score: 0
type: Answer

http://stackoverflow.com/q/23006955
tagged with: ssl
answer count: 0
has comment: http://stackoverflow.com/comment/35140590
type: UnansweredQuestion
has title: SSL connection self-signed certificate with p12 key Android Apache
has comment: http://stackoverflow.com/comment/35142374
has comment: http://stackoverflow.com/comment/35202447
has comment: http://stackoverflow.com/comment/35142040
has body: I have faced with the problem making ssl connection between android and apache server. I have self-signed certificate in PKCS12. I try do following: KeyStore keyStore = KeyStore.getInstance("PKCS12"); keyStore.load(certificateStream, password); TrustManagerFactory tmf1 = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf1.init(keyStore); KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); kmf.init(keyStore, password); SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(kmf.getKeyManagers(), tmf1.getTrustManagers(), null); // Tell the URLConnection to use a SocketFactory from our SSLContext URL url =new URL("https://172.20.175.1/kani/"); HttpsURLConnection urlConnection = (HttpsURLConnection)url.openConnection(); urlConnection.setSSLSocketFactory(sslContext.getSocketFactory()); And on last line: InputStream in = new BufferedInputStream(urlConnection.getInputStream()); I get following exception: 04-11 11:35:30.123: W/System.err(4880): javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. 04-11 11:35:30.133: W/System.err(4880): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:401) 04-11 11:35:30.133: W/System.err(4880): at libcore.net.http.HttpConnection.setupSecureSocket(HttpConnection.java:209) 04-11 11:35:30.133: W/System.err(4880): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:478) 04-11 11:35:30.133: W/System.err(4880): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:433) etc... Problem is what sslContext variable was not initialized by my p12 key. I watched in debug mode this variable and did not find any trace of my p12 key. Please help, i have tryed many solutions and nothing has come.
tagged with: android
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35142355
has comment: http://stackoverflow.com/comment/35140704
tagged with: java

http://stackoverflow.com/comment/35299188
comment on: http://stackoverflow.com/a/23093841
has text: Yes, order is important here.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35089830
type: Comment
has text: You mean you want to rotate the array ?
type: QuestionComment
comment on: http://stackoverflow.com/q/22978696
score: 0

http://stackoverflow.com/comment/35323897
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23108258
has text: i tried without @Transactional annotation. but still same exception is there.
score: 0

http://stackoverflow.com/q/23117520
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23117693
has title: How to remove an element in a 2D array
tagged with: java
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/23117713
linked to: http://stackoverflow.com/q/9909333
has body: I have a 2D array that I need to "reset" each time a tic tac toc game is started. I call a method and loop through the array setting all the elements to Zero. But this defeats the purpose of my program because i need to have all the elements empty/null again. public static char[][] initializeGame(char[][] gameBoard) { for (int row = 0; row &lt; 3; row++) { for (int col = 0; col &lt; 3; col++) { gameBoard = null; //&lt;--THIS IS THE THING AM TRYING TO NULL @ gameBoard[row][column] } } return gameBoard; } How can I set the elements of gameBoard to null?
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23117548
tagged with: multidimensional-array

http://stackoverflow.com/comment/35240168
type: AnswerComment
has text: @kcoppock how would I get the value of the field? I can get the name but when I get the value I get a IllegalArgumentException
comment on: http://stackoverflow.com/a/23020953
type: Comment
score: 0

http://stackoverflow.com/a/23024691
type: Answer
answers question: http://stackoverflow.com/q/23024663
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23024663
has comment: http://stackoverflow.com/comment/35174182
has comment: http://stackoverflow.com/comment/35270073
has body: Im not sure if that is what you are looking for: Create a String array as big as the list is Iterate over each list entry and concatenate its date string (called getDateString() in the example) and entry string (called getEntry()) and store them in the corresponding array index Code: entry = new String[logs.size()]; for (int i = 0; i &lt; logs.size(); i++) { entry[i] = logs.get(i).getDateString() + " " + logs.get(i).getEntry(); }
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/26720213
answers question: http://stackoverflow.com/q/23115751
upvote count: 2
score: 2
downvote count: 0
has body: I removed from /libs folder and cleaned and rebuild it again.problem fixed GoogleAdMobAdsSdk-6.4.1 android-support-v4
type: Answer

http://stackoverflow.com/comment/35229876
comment on: http://stackoverflow.com/a/23040301
score: 0
type: Comment
has text: @طاهر JMX is a way of calling methods exposed by MBeans remotely. It is not magic. There is nothing to stop you from calling _exactly the same_ methods from your code.
type: AnswerComment

http://stackoverflow.com/comment/35124744
comment on: http://stackoverflow.com/a/22997954
type: AnswerComment
type: Comment
has text: Depending on the longevity of the object, the reading could be off by many orders of magnitude. However, performing `System.gc()` several times before taking a reading would greatly improve it.
score: 2

http://stackoverflow.com/comment/35259495
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23071681
has text: Not suitable to you? What *is* suitable for you?

http://stackoverflow.com/comment/35351855
comment on: http://stackoverflow.com/a/23123952
has text: This answer has an example in it...
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/23014682
accepted answer: http://stackoverflow.com/a/23016000
tagged with: mouselistener
tagged with: swing
tagged with: line
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/23016000
score: 0
has body: I'm trying to get into Swing by developing a simple drawing application in Java. The problem is that I'm using an array of Points to keep track on the mouseDragged event, but when I release the mouse button and I begin to draw a new line they get connected (previous line's last node to the first point of the new line). I was thinking maybe to keep track of the Points listened by the mousePressed and mouseReleased listeners in another ArrayList, to know which are the begin and end points of every line and then, when it's time to draw the lines between the points, checking if they are in the ArrayList and avoid drawing that line. What is your suggested approach? How can I implement this in my code? Thank you! package ccdraw; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.event.MouseEvent; import java.util.ArrayList; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.event.MouseInputListener; @SuppressWarnings("serial") public class DrawingArea extends JPanel implements MouseInputListener { private ArrayList&lt;Point&gt; pointList = new ArrayList&lt;Point&gt;(); //private ArrayList&lt;Point&gt; beginEndPoints = new ArrayList&lt;Point&gt;(); public DrawingArea() { super(); super.setPreferredSize(new Dimension(400,400)); setBorder(BorderFactory.createLineBorder(Color.black)); addMouseListener(this); addMouseMotionListener(this); } public void paintComponent(Graphics g){ super.paintComponent(g); doDrawing(g); } private void doDrawing(Graphics g){ Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.RED); g2d.setStroke(new BasicStroke(1.5f)); for (int i=1;i&lt;pointList.size()-1;i++){ // here i should check when it changes between old and new line // and don't draw the line between those two points! //if(pointList.get(i).x - pointList.get(i+1).x &lt;= 1 &amp;&amp; pointList.get(i).y - pointList.get(i+1).y &lt;= 1) g2d.draw…
answer count: 1
has title: Swing - Avoid line filling between different lines

http://stackoverflow.com/comment/35348466
score: 0
has text: *"you should add two methods"*
comment on: http://stackoverflow.com/a/23120628
type: Comment
type: AnswerComment

http://stackoverflow.com/q/23089364
downvote count: 0
favorite count: 0
has body: I'm new to hibernate and am stumped by something that seems incredibly simple! I have a table defining a Contact and a view that gives the contact an approved status. @Entity @Table(name="contacts") public class Contact implements Serializable { private static final long serialVersionUID = 1L; @Id private String email; @OneToOne(targetEntity = BooleanType.class) @JoinTable( name="contactstatus", joinColumns = @JoinColumn(name="email") ) private boolean approved; ... } I simply want to set the approved flag by joining the view on the email primary key. Running the above gives me: Initial SessionFactory Creation failed.org.hibernate.AnnotationException: @OneToOne or @ManyToOne on ...Contact.approved references an unknown entity: org.hibernate.type.BooleanType I realise I could combine the contact and approval columns into a single view, however other aspects of the contact are mutable. I could also make Approved a custom type, and this is actually how I am working around this issue. However, I don't think this should be necessary in order to make the above work.
has comment: http://stackoverflow.com/comment/35291042
score: 2
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35290215
type: Question
has title: Hibernate: Setting a primitve type from join
tagged with: java
tagged with: hibernate
upvote count: 2

http://stackoverflow.com/a/22993319
type: Answer
has body: No, you cannot do that, because "subqueries may be used in the WHERE or HAVING clause" (from spec). Besides, the constructor must get only single_values_path_expression. Excerpt from the specification: select_clause ::= SELECT [DISTINCT] select_item {, select_item}* select_item ::= select_expression [ [AS] result_variable] select_expression ::= single_valued_path_expression | scalar_expression | aggregate_expression | identification_variable | OBJECT(identification_variable) | constructor_expression constructor_expression ::= NEW constructor_name ( constructor_item {, constructor_item}* ) constructor_item ::= single_valued_path_expression | scalar_expression | aggregate_expression | identification_variable aggregate_expression ::= { AVG | MAX | MIN | SUM } ([DISTINCT] state_valued_path_expression) | COUNT ([DISTINCT] identification_variable | state_valued_path_expression | single_valued_object_path_expression) | function_invocation and I am not sure whether in new FatherDto(fat, childrenList) childrenList is considered a path expression.
has comment: http://stackoverflow.com/comment/35139697
accepted answer of: http://stackoverflow.com/q/22992255
upvote count: 4
has comment: http://stackoverflow.com/comment/35116902
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35116580
score: 4
answers question: http://stackoverflow.com/q/22992255
downvote count: 0

http://stackoverflow.com/comment/35145999
type: QuestionComment
has text: I think one of the main issues you will find is that there are so many variables that even if someone does compare the two the comparison will only be valid for that exact implementation. You can't use that kind of benchmark to extrapolate what another projects performance will be. Still, I'm glad to see someone actually measuring performance of their own application and not just making a dummy app to measure.
score: 0
comment on: http://stackoverflow.com/q/23001609
type: Comment

http://stackoverflow.com/comment/35266944
type: Comment
comment on: http://stackoverflow.com/q/23076089
score: 0
type: QuestionComment
has text: @Java1 I do not, but hibernate log out that it using javaassist.

http://stackoverflow.com/q/23122949
has answer: http://stackoverflow.com/a/23123007
has comment: http://stackoverflow.com/comment/35350109
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23122991
type: Question
has body: I have a cache implementation for which i have the KeyObject implemented So the cache is HashMap&lt;KeyObject , List&lt;SomeObjects&gt;&gt; This KeyObject class ,say it has 2 variable a,b ; class KeyObject { MyObject a; AnotherMyObject b; KeyObject(MyObject a, AnotherMyObject b){ this.a = prop1 ; this.b= prop2; } } Is it ok , that i have equals method implemented depending on the properties on MyObject and AnotherMyObject.. Say something like this public boolean equals(Object keyObject){ if(keyObject.isSomeType() &amp;&amp; this.a.isSomeType(){ return keyObject.a.equals(this.a) } else{ return keyObject.a.equals(this.a) &amp;&amp; keyObject.b.equals(this.b) } } Is the equals implemenation like above a common practice? Thanks
has comment: http://stackoverflow.com/comment/35350211
tagged with: equals
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/35350345
tagged with: java
type: UnansweredQuestion
has title: Is this equals implementation ok?

http://stackoverflow.com/a/23035606
accepted answer of: http://stackoverflow.com/q/23034160
type: AcceptedAnswer
score: 4
answers question: http://stackoverflow.com/q/23034160
type: Answer
upvote count: 4
has body: Obviously, you could have getters return clones and what not but a more robust solution is... Immutability If inside myClass the color_ changes though, the color of someOtherColorInOtherClass_ will also change. And this both the intended and the expected behavior. But in your case you'd most likely call this a nasty side effect. This is because Color is a mutable class, ie. you're free to do: Color color = new Color(r, g, b, alpha1); ... color.setRGB(r2, g2, b2, alpha2); ... color.setRGB(r3, g3, b3, alpha3); thus making your Color instance vulnerable to state changes. A counter example is the notable String class which is immutable. Immutability is a nice feature that is enforced by a number of (functional) languages like Haskell and Scala and which simplifies concurrent programming and has the added bonus of making state-related matters a no-brainer because of its intrinsic lack of (nasty) side effects. Indeed, had you modeled the color field of your two classes as String, ie. an immutable class, the issue of sharing the same instance would have been technically safe (and in your case, robust). So the bottom line is, unless you have a good reason to do otherwise, make your classes immutable, especially those intended as parameters. Specifically, that means having rich constructors, no setters or private ones if needed and final fields wherever possible. If your getters return potentially mutable instances (eg. like sets/lists/maps or other objects), return [immutable] copies instead. For instance, a simplified but immutable Color class could read (with no getters to avoid boilerplate): public class Color { public final double r, g, b, alpha; public Color(double r, double g, double b, double alpha) { this.r = r; this.g = g; this.b = b; this.alpha = alpha; } } With this Color class, any number of objects can share the same color instance without potential side effects. HTH
downvote count: 0
has comment: http://stackoverflow.com/comment/35193463
has comment: http://stackoverflow.com/comment/61653079

http://stackoverflow.com/comment/35286011
comment on: http://stackoverflow.com/a/23081533
has text: where should i make those Decimals ?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23094865
upvote count: 2
type: Answer
has body: Yes, using the same text file format. Just use TextFormat.merge, passing in either the text itself as a CharSequence or a Readable (e.g. Reader) and a builder to merge the values into. See the Javadoc for TextFormat for more information, and be aware that it's not available in the "lite" runtime.
accepted answer of: http://stackoverflow.com/q/23094819
score: 2
answers question: http://stackoverflow.com/q/23094819
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35340794
type: QuestionComment
has text: it is not printing any thing when I pressed 'n' char in the code above it must be print hhhhh but it is not print.
comment on: http://stackoverflow.com/q/23117769
score: 0
type: Comment

http://stackoverflow.com/q/23047192
score: 1
tagged with: java
upvote count: 1
has body: I'm trying to learn Java and I was challenging myself rewriting the "2048" game (if you don't know how it works take a look here) So I have a 4x4 matrix called 'mat' containing the numbers of the game and 4 methods for moving numbers in the 4 directions: private int[][] mat = new int[4][4]; and the movingUp method: private boolean MoveUp() { System.out.println("Moving Up"); boolean nextRow; boolean moved = false; for(int j = 0; j &lt; 4; j++){ boolean[] collapsed = new boolean[3]; do{ nextRow = true; for(int i = 0; i &lt; 3; i++){ if((mat[i][j] == 0) &amp;&amp; (mat[i+1][j] != 0)){ mat[i][j] = mat[i+1][j]; mat[i+1][j] = 0; nextRow = false; moved = true; } else if((mat[i][j] != 0) &amp;&amp; (mat[i][j] == mat[i+1][j]) &amp;&amp; !collapsed[i] &amp;&amp; !collapsed[i+1]){ mat[i][j] += mat[i+1][j]; mat[i+1][j] = 0; collapsed[i] = true; nextRow = false; moved = true; } } } while(!nextRow); } return moved; } But after some playing I have this output: --------------------- | | | | | | | | | 4| | | | | | |----|----|----|----| | | | | | | | 2| 8| 64| | | | | | |----|----|----|----| | | | | | | | | 4| 32| | | | | | |----|----|----|----| | | | | | | | | 8| 32| | | | | | --------------------- w Moving Up Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 at Game.MoveUp(Game.java:91) at Game.Move(Game.java:35) at Game.&lt;init&gt;(Game.java:14) at Game.main(Game.java:210) I can't really understand why, anyone can help me? :) Here is the full code: import java.util.Scanner; public class Game { private int[][] mat = new int[4][4]; private boolean gameover = false; public Game(){ GenRand(); GenRand(); do{ PrintMat(); Move(); gameover = CheckGameover(); if(!gameover) GenRand(); } while(!gameover); System.out.println("Game Over!"); } private void Move(){ boolean done = false; do{ Scanner in = new Scanner(System.in); char input = in.next().charAt(0); switch(input){ case ('a'): done = MoveLeft(); break; case ('d'): done = MoveRight(); break; case ('w'): done = Move…
type: Question
has comment: http://stackoverflow.com/comment/35214212
has comment: http://stackoverflow.com/comment/35214311
has comment: http://stackoverflow.com/comment/35214014
accepted answer: http://stackoverflow.com/a/23047388
tagged with: matrix
answer count: 1
downvote count: 0
favorite count: 0
type: AnsweredQuestion
has title: Matrix random OutOfBoundException in a "Java 2048"
has answer: http://stackoverflow.com/a/23047388

http://stackoverflow.com/comment/36149200
score: 0
type: AnswerComment
type: Comment
has text: Then the problem is related to the tomcat/webapp configuration. You should provide a MANIFEST.MF file, or at least check if the various paths are correct.
comment on: http://stackoverflow.com/a/23489574

http://stackoverflow.com/q/23078500
tagged with: java
has comment: http://stackoverflow.com/comment/35271259
has comment: http://stackoverflow.com/comment/35271188
tagged with: eclipse
upvote count: 10
accepted answer: http://stackoverflow.com/a/23078903
has comment: http://stackoverflow.com/comment/35271791
downvote count: 0
linked to: http://stackoverflow.com/q/6034513
has comment: http://stackoverflow.com/comment/35271329
type: AnsweredQuestion
score: 10
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/23078903
has title: Maven throws nullpointer exception
tagged with: maven
has body: Good day, I have built a project using maven. Throughout this project, I have concluded that one more dependency has to be added for a particular module. I have added this dependency in it's pom file and when I have tried to rebuild the project using maven, a null pointer was thrown. Pom files before: (child pom:) org.hibernate.javax.persistence hibernate-jpa-2.0-api (main pom:) org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.1.Final com.solveit.crm.core crm-core ${project.version} //this dependency is for another module, it was declared at the start of the project Pom files now(which cause nullpointer): (child pom:) org.hibernate.javax.persistence hibernate-jpa-2.0-api com.solveit.crm.data crm-data (main pom:) org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.1.Final com.solveit.crm.core crm-core ${project.version} com.solveit.crm.data crm-data ${project.version} Why does maven throw null pointer exception? I am confused right now. ERROR MESSAGE: [INFO] Scanning for projects... [ERROR] Internal error: java.lang.NullPointerException -> [Help 1] org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerEx ception at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:167) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun cher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav a:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La uncher.java:415) at org.codehaus.plexus.classworlds.launcher.Lau…
answer count: 1

http://stackoverflow.com/q/23033983
tagged with: android
has answer: http://stackoverflow.com/a/23034090
tagged with: shared-libraries
upvote count: 6
favorite count: 0
linked to: http://stackoverflow.com/q/5687598
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35190111
downvote count: 7
has title: What do I need in order to start creating an android game similar to clash of clans?
tagged with: java
score: -1
type: Question
answer count: 1
tagged with: google-play-games
has body: I've been working with java for a while now, and now want to dive into making a game similar to Clash of Clans/building/empire games. I've already install the Android SDK and set up a project, but I was wondering what tools do I really need to start working on this? 1) Do I need a different SDK to create Apps on phone vs. tablet? 2) Are there any libraries that I should be looking at, because right now I have nothing. 3) What other things do I need?

http://stackoverflow.com/q/23118013
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23118095
has answer: http://stackoverflow.com/a/23118038
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35341604
tagged with: compareto
tagged with: if-statement
has answer: http://stackoverflow.com/a/23118054
has body: Basically i'm attempting to write a compareTo that does the comparison based on the value of compareByWord. If compareByWord is true, I want it to compare based on the word, but if it's false, I want it to compare based on count. class WordCount implements Comparable //Error saying WordCount must implement the inherited abstract method Comparable.compareto (Object) { String word; int count; static boolean compareByWord; public WordCount(String aWord) { setWord(aWord); count = 1; } private void setWord(String theWord) { word=theWord; } public void increment() { count+=1; } public static void sortByWord() { compareByWord = true; } public static void sortByCount() { compareByWord = false; } public String toString() { String result = String.format("%s (%d)",word, count); return result; } public String getWord() { return word; } public int getCount() { return count; } @Override public int compareTo(WordCount other) { //Error saying compareTo (WordCount) of type WordCount must override or implement a supertype method. if (compareByWord == true) { return word.compareTo(other.getWord()); } if (compareByWord == false) { return count.compareTo(other.getCount()); //Error saying it cannot invoke compareTo int on primitive type int. } return 0; } } My class was perfect before I tried to implement this, not sure where I'm going wrong here. Any and all help is much appreciated.
tagged with: class
tagged with: boolean
answer count: 3
downvote count: 0
has title: Using compareTo in Java to Sort
favorite count: 0

http://stackoverflow.com/comment/35319942
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23085971
has text: Do you use maven to build your project?

http://stackoverflow.com/comment/35379333
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23127955
has text: Can you answer following then can solve proble.. What is the detailed exception..? Is your reducer really got callled..? put sysout and watch.. open 50030 and paste details..

http://stackoverflow.com/comment/35230591
comment on: http://stackoverflow.com/a/23056135
score: 0
type: AnswerComment
type: Comment
has text: @user3337714 You need to override `equals()` and `hashCode()` in your `Person` class, and compere the objects based on `passName`.

http://stackoverflow.com/q/23118172
has body: I'm building a report which is basically a big set of pie charts (13 of them) grouped by user. Each pie chart uses a diferent query (actually, same query, different table). I laid them down, and everything was fine until pie number 11. Pie number eleven crashed PRD with the error: org.pentaho.reporting.engine.classic.core.InvalidReportStateException: Assert: Shift is not as expected: realY=252100000 != expectation=251700000; Shift=63200000; AdditionalShift=-400000; RealShift=62800000 I checked the query and it is ok. Anyone can explain what is happening, or give me a hint about what is failing? Full stacktrace: org.pentaho.reporting.engine.classic.core.InvalidReportStateException: Assert: Shift is not as expected: realY=252100000 != expectation=251700000; Shift=63200000; AdditionalShift=-400000; RealShift=62800000 at org.pentaho.reporting.engine.classic.core.layout.process.PaginationStepLib.assertBlockPosition(PaginationStepLib.java:162) at org.pentaho.reporting.engine.classic.core.layout.process.PaginationStep.handleStartBlockLevelBox(PaginationStep.java:169) at org.pentaho.reporting.engine.classic.core.layout.process.PaginationStep.startBlockLevelBox(PaginationStep.java:159) at org.pentaho.reporting.engine.classic.core.layout.process.IterateVisualProcessStep.processBlockLevelChild(IterateVisualProcessStep.java:421) at org.pentaho.reporting.engine.classic.core.layout.process.IterateVisualProcessStep.startProcessing(IterateVisualProcessStep.java:51) at org.pentaho.reporting.engine.classic.core.layout.process.IterateVisualProcessStep.processBoxChilds(IterateVisualProcessStep.java:440) at org.pentaho.reporting.engine.classic.core.layout.process.IterateVisualProcessStep.processBlockLevelChild(IterateVisualProcessStep.java:423) at org.pentaho.reporting.engine.classic.core.layout.process.IterateVisualProcessStep.startProcessing(IterateVisualProcessStep.java:51) at org.pentaho.reporting.engine.classic.core.layout.process.IterateVisualProcessStep.processBoxChilds(IterateVi…
type: AnsweredQuestion
tagged with: pentaho
has comment: http://stackoverflow.com/comment/35485848
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24177235
favorite count: 0
type: Question
tagged with: reporting
has title: Pentaho Report Designer error: Assert: Shift is not as expected
tagged with: pentaho-design-studio
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35609152
tagged with: java
has comment: http://stackoverflow.com/comment/35538706
accepted answer: http://stackoverflow.com/a/24177235

http://stackoverflow.com/a/23126577
has comment: http://stackoverflow.com/comment/35357815
type: Answer
has body: Check your getValue() Method Try this public String getValue(String id) { ProductItem value; try{ if(ITEM_MAP != null ) value = ITEM_MAP.get(id.trim());//check here later if(value != null){ Log.e("Value: ", value.toString()); } return ""; } catch(Exception ee) { ee.printStackTrace(); } return ""; }
answers question: http://stackoverflow.com/q/23125548
has comment: http://stackoverflow.com/comment/35356797
has comment: http://stackoverflow.com/comment/35357425
score: 0

http://stackoverflow.com/a/23061451
accepted answer of: http://stackoverflow.com/q/23058700
answers question: http://stackoverflow.com/q/23058700
downvote count: 0
has body: If your nodes are unique with respect to their names, you can track them in a simple HashMap to reuse nodes instead of creating new. Something like this (warning, code not tested, but this should give you the idea). HashMap&lt;String,Node&gt; nodes = new HashMap&lt;String,Node&gt;(); Transaction tx=graphDb.beginTx(); Connection conn = null; try{{ conn=ConnectionFactory.getConnection(); Statement stat=conn.createStatement(); String sql="select * from Fade where App_Int_Id &lt; 22"; ResultSet rs=stat.executeQuery(sql); String n1 = "",n2="",rel="",type=""; while(rs.next()){ n1=rs.getString(1); n2=rs.getString(7); rel=rs.getString(3); type=rs.getString(4); Node first=nodes.get(n1); // Only create it if it didn't already exist. if(first == null) { first = graphDb.createNode(); first.setProperty("name", n1); first.addLabel(DynamicLabel.label(n1)); // Now put it in the map to ensure it doesn't get created again. nodes.put(n1, first); } Node sec=nodes.get(n2); if(sec == null) { sec = graphDb.createNode(); sec.setProperty("name", n2); sec.addLabel(DynamicLabel.label(n2)); // Now put it in the map to ensure it doesn't get created again. nodes.put(n2, sec); } RelationshipType KNOWS = DynamicRelationshipType.withName(rel); if(type.equalsIgnoreCase("Incoming")){ sec.createRelationshipTo(first, KNOWS); } else if(type.equalsIgnoreCase("Outgoing")){ first.createRelationshipTo(sec, KNOWS); } Finally - don't try to do this if you have a massive number of nodes, since your HashMap will outgrow memory. But this should be workable for a few thousand at least. If you have a really huge number, use an LRU cache, and then make sure that you order to the results you're processing by name.
type: AcceptedAnswer
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/35351308
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23123345
has text: `... also I haven't heard many swell reviews about it` - I guess you don't listen to the right people then

http://stackoverflow.com/a/23067993
has body: Searching for YahooWeatherUtils, I found http://www.codota.com/android/scenarios/52fcbdbbda0ae4ff7532748f/com.google.android.gms.location.LocationClient?tag=dragonfly Their suggestion is: Location location = locationClient.getLastLocation(); YahooWeatherUtils ywu = YahooWeatherUtils.getInstance(); if PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("weatherUseCurrentLocation", true) &amp;&amp; location != null) { ywu.queryYahooWeather(getActivity(), location , this); } else { String city = PreferenceManager.getDefaultSharedPreferences(getActivity()).getString("weatherCity", "Vancouver Canada"); ywu.queryYahooWeather(getActivity(), city , this); } So, it seems that the function queryYahooWeather can get lat/long or city name. You just need enough information for city name.
downvote count: 0
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35255501
answers question: http://stackoverflow.com/q/23067587

http://stackoverflow.com/q/23114527
answer count: 2
has answer: http://stackoverflow.com/a/23120031
tagged with: knapsack-problem
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35340026
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/35335637
possible better answer: http://stackoverflow.com/a/23115469
has comment: http://stackoverflow.com/comment/35335095
has comment: http://stackoverflow.com/comment/35335966
has comment: http://stackoverflow.com/comment/35335076
upvote count: 3
has title: Knapsack algorithm, large capacity
has comment: http://stackoverflow.com/comment/35336993
type: Question
type: AnsweredQuestion
score: 3
has body: I'm currently in developing a playlist player and im facing a problem. I have gaps of variable length in my playlist that i want to fill with special audio files. These files also have a variable length, usually shorter then the gap i have in my playlist. This sounds like a classic knapsack problem, so i tried to implement this algorithm. This works fine for smaller gaps, but whenever i have a gap of 30 minutes the algorithm uses extreme amount of memory. This is expected because im using dynamic programming to solve the problem. The knapsack has a capacity of {gap in milliseconds} and the knapsack items have the weight of the audio files in milliseconds. This is extremely innefficient. So i was wondering if i could use a different algorithm, or maybe change the weight and capacity into smaller variables. So far i was thinking of dividing everything by an arbitrary number, but il lose precision if i do so. Anyone has any ideas? Edit: I have about 500 fillers to fill the gap. And changing the pitch is not possible. The set of fillers should have a perfect solution. I really want millisecond precision but I can live with under 100ms off.
accepted answer: http://stackoverflow.com/a/23120031
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/23115469

http://stackoverflow.com/q/23064917
has comment: http://stackoverflow.com/comment/35246566
possible better answer: http://stackoverflow.com/a/23065019
answer count: 3
upvote count: 1
has body: I have created small CLI client-server application. Once the server is loaded the client can connect to it and send commands to the server. The first command is to get list of files that server is loaded with. Once the socket connection is established. I request user to enter a command. ClientApp.java Socket client = new Socket(serverName, serverPort); Console c = System.console(); if (c == null) { System.err.println("No console!"); System.exit(1); } String command = c.readLine("Enter a command: "); OutputStream outToServer = client.getOutputStream(); DataOutputStream out = new DataOutputStream(outToServer); out.writeUTF(command); Then the server capture user's command and send appropriate replies. SeverApp.java - Socket server = serverSocket.accept(); DataInputStream in = new DataInputStream(server.getInputStream()); switch (in.readUTF()){ case "list": for (String fileName : files) { out.writeUTF(fileName); } out.flush(); } server.close(); Next the client retrieve server's response - ClientApp.java InputStream inFromServer = client.getInputStream(); DataInputStream in = new DataInputStream(inFromServer); String value; while((value = in.readUTF()) != null) { System.out.println(value); } client.close(); files is a ArrayList which i keep list of files loaded to the sever. When client sends list command to the sever, i need to send array of strings (list of file names) back. Similarly app will have more commands. Now when i do such request i get list of files and trows java.io.EOFException from while((value = in.readUTF()) != null) { How to fix this ? EDIT (SOLUTION) --- http://docs.oracle.com/javase/tutorial/essential/io/datastreams.html Notice that DataStreams detects an end-of-file condition by catching EOFException, instead of testing for an invalid return value. All implementations of DataInput methods use EOFException instead of return values. try { while (true) { System.out.println(in.readUTF()); } } catch (EOFException e) { }
favorite count: 0
has answer: http://stackoverflow.com/a/23101912
accepted answer: http://stackoverflow.com/a/23101912
has answer: http://stackoverflow.com/a/23064989
has title: DataInputStream giving java.io.EOFException
type: AnsweredQuestion
tagged with: serversocket
downvote count: 0
tagged with: eofexception
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23065019
linked to: http://stackoverflow.com/q/2626163
type: Question

http://stackoverflow.com/a/23054283
has body: You can use String.format(): return String.format("\nCost: $%.2f", computeRentalCost()); The format modifier %.2f tells that only two decimal places will be shown. Note: This won't modify the number, it only modifies the way it's shown.
answers question: http://stackoverflow.com/q/23054258
score: 2
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/23054258

http://stackoverflow.com/comment/35321169
type: QuestionComment
comment on: http://stackoverflow.com/q/23107050
has text: @PeterLiljenberg I use `Jenkins ver. 1.532.3.`
score: 0
type: Comment

http://stackoverflow.com/comment/35361103
score: 0
type: QuestionComment
type: Comment
has text: Make your exceptions unchecked (extend `RuntimeException`) and you won't need all these try-catches cluttering up your code (I bet they don't do anything useful in the catch block other than log and/or throw)
comment on: http://stackoverflow.com/q/23128660